I\'m doing static code analysis using openstack/bandit. Do have a lot of repositories, some of those are in python 2 other in python 3. How can I detect if code is syntactically
You can use the "compileall" module like so:
python3.6 -m compileall -q .
Modify appropriately for the python version you want to use.
Python3 (since 3.something) puts compiled modules into a __pycache__
directory, with a arch-specific extension, so they won't conflict with Python2 or other Python3 versions.
The given command will just show errors, and will recurse from the current directory. Use python3.6 -m compileall --help
to reveal ALL the OPTIONS.