What to use for finding as many syntax errors as possible.
Cameron Simpson
cs at cskk.id.au
Sun Oct 9 18:45:12 EDT 2022
On 09Oct2022 21:46, Antoon Pardon <antoon.pardon at vub.be> wrote:
>>Is it that onerous to fix one thing and run it again? It was once when
>>you
>>handed in punch cards and waited a day or on very busy machines.
>
>Yes I find it onerous, especially since I have a pipeline with unit tests
>and other tools that all have to redo their work each time a bug is
>corrected.
It is easy to get the syntax right before submitting to such a pipeline.
I usually run a linter on my code for serious commits, and I've got a
`lint1` alias which basicly runs the short fast flavour of that which
does a syntax check and the very fast less thorough lint phase.
I say this just to ease your write/run-tests cycle.
Regarding your main request, had you considered writing your own wrapper
tool? Something which ran something like:
python -We:invalid -m py_compile your_python_file.py
If there's an error, report it, then make a new file commencing with the
next unindented line after the error, with all preceeding lines
commented out (to keep the line numbers the same). Then run the check
again. Repeat until the file's empty or there are no errors.
This doesn't sound very complex.
Cheers,
Cameron Simpson <cs at cskk.id.au>
More information about the Python-list
mailing list