Skip to content

Commit

Permalink
Merge pull request #207 from sijis/fix/pylint_exception
Browse files Browse the repository at this point in the history
Fix missing 'UnknownMessage' exception
  • Loading branch information
carlio committed May 2, 2017
2 parents c893531 + 977ab4b commit 7787795
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 7 additions & 0 deletions prospector/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# -*- coding: utf-8 -*-

# We are trying to handle pylint changes in their exception classes
try:
# pylint < 1.7
from pylint.utils import UnknownMessage as UnknownMessageError
except ImportError:
# pylint >= 1.7
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

0 comments on commit 7787795

Please sign in to comment.