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

Fix missing 'UnknownMessage' exception #207

Merged
merged 2 commits into from
May 2, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# -*- coding: utf-8 -*-

try:

Choose a reason for hiding this comment

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

I'd add a comment explaining why this is here to help future reviewers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I'll put some comments in it.

from pylint.utils import UnknownMessage as UnknownMessageError
except ImportError:
from pylint.exceptions import UnknownMessageError

class FatalProspectorException(Exception):

Expand Down
4 changes: 2 additions & 2 deletions prospector/tools/pylint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import sys
import os
from pylint.config import find_pylintrc
from pylint.utils import UnknownMessage
from prospector.exceptions import UnknownMessageError
from prospector.message import Message, Location
from prospector.tools.base import ToolBase
from prospector.tools.pylint.collector import Collector
Expand Down Expand Up @@ -41,7 +41,7 @@ def _prospector_configure(self, prospector_config, linter):
try:
linter.disable(msg_id)
# pylint: disable=pointless-except
except UnknownMessage:
except UnknownMessageError:
# If the msg_id doesn't exist in PyLint any more,
# don't worry about it.
pass
Expand Down
4 changes: 2 additions & 2 deletions prospector/tools/pylint/collector.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import absolute_import
from pylint.reporters import BaseReporter
from pylint.utils import UnknownMessage
from prospector.exceptions import UnknownMessageError
from prospector.message import Location, Message


Expand All @@ -20,7 +20,7 @@ def add_message(self, msg_id, location, msg):
# more user-friendly symbol
try:
msg_data = self._message_store.check_message_id(msg_id)
except UnknownMessage:
except UnknownMessageError:
# this shouldn't happen, as all pylint errors should be
# in the message store, but just in case we'll fall back
# to using the code.
Expand Down