Hi Max.

I'm not 100% sure I know all the specifics of what you're asking, but you could try:

It makes it so you can ignore errors that pylint does not allow you to otherwise turn off.  It also attempts to give a meaningful exit status for use in automation.


On Mon, Feb 27, 2017 at 2:12 AM, Max Fischer <maxfischer2781@gmail.com> wrote:
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?



[2] disable=syntax-error doesn't work #986
code-quality mailing list

Dan Stromberg