Hi all,

I am having problems disabling the pylint `syntax-error` for compatibility code.
Basically, I have a compatibility sub-package [1] that tries importing 
different variants of code until it does not hit SyntaxError. There are other 
projects where I do the same.
I have found a bug report on a similar issue [2] but it was closed.

Pylint is having a hard time with this approach. When I run the check with 
python3, all python2-only code produces syntax-error. It is not possible to 
disable this error with either `# pylint: skip-file` or `# pylint: 
disable=syntax-error` at the start of the file.
I don't want to ignore compatibility code per se, as it tends to collect quite 
a lot of code smell. Since it is a severe error requiring action under most 
circumstances, I don't want a mental "just ignore syntax-error" to be a 
required for reading reports.

Is there a way to get pylint to play nice with compatibility code? Can I 
refactor my code to play nicer with pylint?

Cheers,
Max

[1]
https://github.com/maxfischer2781/chainlet/blob/master/chainlet/compat/__init__.py

[2] disable=syntax-error doesn't work #986
https://github.com/PyCQA/pylint/issues/986
_______________________________________________
code-quality mailing list
code-quality@python.org
https://mail.python.org/mailman/listinfo/code-quality

Reply via email to