pylint-bot / pylint-unofficial

UNOFFICIAL playground for pylint github migration
0 stars 0 forks source link

[regression] New node visit methods not backwards compatible - custom checkers with old visit_ methods cause built-in checkers to fail #711

Closed pylint-bot closed 8 years ago

pylint-bot commented 8 years ago

Originally reported by: BitBucket: carlio, GitHub: @carlio?


I created a custom checker for a pylint plugin here: https://github.com/landscapeio/pylint-django/blob/master/pylint_django/checkers/models.py

Recently methods for visiting nodes changed: https://bitbucket.org/logilab/pylint/commits/c94ee95abaa5737f13b91626fe321150c0ddd140

visit_class should now be visit_classdef

When my checker still defines a visit_class method, then the logic in the PylintASTWalker assumes that all checkers have a visit_class method: https://bitbucket.org/logilab/pylint/src/0c2ba769319f426dd38a00dc9cc7e61a01848b30/pylint/utils.py?at=default&fileviewer=file-view-default#utils.py-898

This means that visit_classdef is not called for any of the built-in pylint checkers, especially the ClassChecker which breaks (as _accessed does not get populated)


pylint-bot commented 8 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Fix a crash which occurred when old visit methods are encountered in plugin modules.

If a plugin uses an old visit method (visit_class for instance), this can lead to a crash in pylint's base checkers, because the logic in the PylintASTWalker assumes that all checkers have a visit_class / leave_class method. The patch fixes this by looking for both names. Closes issue #711.

pylint-bot commented 8 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Fix a crash which occurred when old visit methods are encountered in plugin modules.

If a plugin uses an old visit method (visit_class for instance), this can lead to a crash in pylint's base checkers, because the logic in the PylintASTWalker assumes that all checkers have a visit_class / leave_class method. The patch fixes this by looking for both names. Closes issue #711.

pylint-bot commented 8 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Should be fixed, I'll try to push a new bug fix release later today or earlier tomorrow. Please tell if it works for you or if you have other problems with this release.

pylint-bot commented 8 years ago

Original comment by Florian Bruhin (BitBucket: The-Compiler, GitHub: @The-Compiler?):


Issue #713 was marked as a duplicate of this issue.