Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support pylint 2.0 UnknownMessage rename to UnknownMessageError #205

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion prospector/tools/pylint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
import sys
import os
from pylint.config import find_pylintrc
from pylint.utils import UnknownMessage
try:
from pylint.utils import UnknownMessage
except ImportError:
from pylint.utils import UnknownMessageError as UnknownMessage

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://docs.pylint.org/en/latest/whatsnew/changelog.html#what-s-new-in-pylint-1-7:

InvalidMessageError, UnknownMessage, and EmptyReport exceptions are moved to the new pylint.exceptions submodule.

So perhaps from pylint.exceptions import UnknownMessageError might be a better choice here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, the pylint.exceptions submodule is a better choice. I see that there is a #207 in now which implements it this way, and isolates the try...except logic. I will close this PR as #207 is the one that should be merged into master.

from prospector.message import Message, Location
from prospector.tools.base import ToolBase
from prospector.tools.pylint.collector import Collector
Expand Down
5 changes: 4 additions & 1 deletion prospector/tools/pylint/collector.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
from __future__ import absolute_import
from pylint.reporters import BaseReporter
from pylint.utils import UnknownMessage
try:
from pylint.utils import UnknownMessage
except ImportError:
from pylint.utils import UnknownMessageError as UnknownMessage
from prospector.message import Location, Message


Expand Down