[code-quality] pylint syntax-error for compatibility code

Dan Stromberg strombrg at gmail.com
Mon Feb 27 21:32:57 EST 2017


Hi Max.

I'm not 100% sure I know all the specifics of what you're asking, but you
could try:
http://stromberg.dnsalias.org/~strombrg/this-pylint/

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.

HTH

On Mon, Feb 27, 2017 at 2:12 AM, Max Fischer <maxfischer2781 at 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?
>
> 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 at python.org
> https://mail.python.org/mailman/listinfo/code-quality
>



-- 
Dan Stromberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/code-quality/attachments/20170227/d6133d22/attachment.html>


More information about the code-quality mailing list