Testing as in running as a pre-commit hook on the example configs in Asterisk repo results in:
$ pre-commit try-repo ../mirrors-asterisklint dialplan-check --verbose --all-files
[WARNING] Creating temporary repo with uncommitted changes...
===============================================================================
Using config:
===============================================================================
repos:
- repo: /tmp/tmpy_9oi7z_/shadow-repo
rev: a0a794368016cda785cef32e75de44de13982d18
hooks:
- id: dialplan-check
===============================================================================
[INFO] Initializing environment for /tmp/tmpy_9oi7z_/shadow-repo.
[INFO] Installing environment for /tmp/tmpy_9oi7z_/shadow-repo.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
dialplan-check...........................................................Failed
- hook id: dialplan-check
- duration: 0.15s
- exit code: 1
configs/basic-pbx/extensions.conf:1 H_DP_GLOBALS_MISPLACED: [globals] context not found or not at position two
configs/basic-pbx/extensions.conf:9 W_WSH_VARSET: expected no horizontal whitespace around equals operator
Traceback (most recent call last):
File "/tmp/tmpy_9oi7z_/repo_urfu3v9/py_env-python3.9/lib/python3.9/site-packages/asterisklint/config.py", line 186, in __iter__
self.on_varset(element)
File "/tmp/tmpy_9oi7z_/repo_urfu3v9/py_env-python3.9/lib/python3.9/site-packages/asterisklint/dialplan.py", line 600, in on_varset
dialplanvarset = DialplanVarset.from_varset(varset)
File "/tmp/tmpy_9oi7z_/repo_urfu3v9/py_env-python3.9/lib/python3.9/site-packages/asterisklint/dialplan.py", line 473, in from_varset
assert varset.arrow # W_ARROW
AssertionError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/tmp/tmpy_9oi7z_/repo_urfu3v9/py_env-python3.9/bin/asterisklint", line 34, in <module>
sys.exit(main(sys.argv[1:], os.environ))
File "/tmp/tmpy_9oi7z_/repo_urfu3v9/py_env-python3.9/lib/python3.9/site-packages/asterisklint/main.py", line 178, in main
return command_module.main(args, envs)
File "/tmp/tmpy_9oi7z_/repo_urfu3v9/py_env-python3.9/lib/python3.9/site-packages/asterisklint/mainutil.py", line 35, in __call__
return self.handle_args(args)
File "/tmp/tmpy_9oi7z_/repo_urfu3v9/py_env-python3.9/lib/python3.9/site-packages/asterisklint/commands/dialplan-check.py", line 50, in handle_args
dialplan = next(iter(parser))
File "/tmp/tmpy_9oi7z_/repo_urfu3v9/py_env-python3.9/lib/python3.9/site-packages/asterisklint/config.py", line 192, in __iter__
raise ProgrammingError(str(element.where)) from exc
asterisklint.config.ProgrammingError: An unexpected exception was raised. This is most likely a bug in the asterisklint library. If you can reproduce the problem and file an issue on the bug tracker, that would be nice. Further info: configs/basic-pbx/extensions.conf:9
Testing as in running as a pre-commit hook on the example configs in Asterisk repo results in: