forked from pylint-dev/pylint
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor - Create the pyling.message package
Following review here : pylint-dev#2654
- Loading branch information
1 parent
bf7659f
commit 60e197b
Showing
15 changed files
with
154 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright (c) 2006-2014 LOGILAB S.A. (Paris, FRANCE) <contact@logilab.fr> | ||
# Copyright (c) 2009 Vincent | ||
# Copyright (c) 2009 Mads Kiilerich <mads@kiilerich.com> | ||
# Copyright (c) 2012-2014 Google, Inc. | ||
# Copyright (c) 2014-2018 Claudiu Popa <pcmanticore@gmail.com> | ||
# Copyright (c) 2014-2015 Michal Nowikowski <godfryd@gmail.com> | ||
# Copyright (c) 2014 LCD 47 <lcd047@gmail.com> | ||
# Copyright (c) 2014 Brett Cannon <brett@python.org> | ||
# Copyright (c) 2014 Arun Persaud <arun@nubati.net> | ||
# Copyright (c) 2014 Damien Nozay <damien.nozay@gmail.com> | ||
# Copyright (c) 2015 Aru Sahni <arusahni@gmail.com> | ||
# Copyright (c) 2015 Florian Bruhin <me@the-compiler.org> | ||
# Copyright (c) 2015 Simu Toni <simutoni@gmail.com> | ||
# Copyright (c) 2015 Ionel Cristian Maries <contact@ionelmc.ro> | ||
# Copyright (c) 2016 Łukasz Rogalski <rogalski.91@gmail.com> | ||
# Copyright (c) 2016 Moises Lopez <moylop260@vauxoo.com> | ||
# Copyright (c) 2016 Glenn Matthews <glenn@e-dad.net> | ||
# Copyright (c) 2016 Glenn Matthews <glmatthe@cisco.com> | ||
# Copyright (c) 2016 Ashley Whetter <ashley@awhetter.co.uk> | ||
# Copyright (c) 2016 xmo-odoo <xmo-odoo@users.noreply.github.com> | ||
# Copyright (c) 2017-2018 hippo91 <guillaume.peillex@gmail.com> | ||
# Copyright (c) 2017 Pierre Sassoulas <pierre.sassoulas@cea.fr> | ||
# Copyright (c) 2017 Bryce Guinta <bryce.paul.guinta@gmail.com> | ||
# Copyright (c) 2017 Chris Lamb <chris@chris-lamb.co.uk> | ||
# Copyright (c) 2017 Anthony Sottile <asottile@umich.edu> | ||
# Copyright (c) 2017 Thomas Hisch <t.hisch@gmail.com> | ||
# Copyright (c) 2017 Mikhail Fesenko <proggga@gmail.com> | ||
# Copyright (c) 2017 Craig Citro <craigcitro@gmail.com> | ||
# Copyright (c) 2017 Ville Skyttä <ville.skytta@iki.fi> | ||
# Copyright (c) 2018 ssolanki <sushobhitsolanki@gmail.com> | ||
# Copyright (c) 2018 Sushobhit <31987769+sushobhit27@users.noreply.github.com> | ||
# Copyright (c) 2018 Pierre Sassoulas <pierre.sassoulas@wisebim.fr> | ||
# Copyright (c) 2018 Reverb C <reverbc@users.noreply.github.com> | ||
# Copyright (c) 2018 Nick Drozd <nicholasdrozd@gmail.com> | ||
|
||
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html | ||
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING | ||
|
||
"""All the classes related to Message handling.""" | ||
|
||
from pylint.message.constants import ( | ||
MSG_STATE_CONFIDENCE, | ||
_SCOPE_EXEMPT, | ||
MSG_STATE_SCOPE_CONFIG, | ||
MSG_STATE_SCOPE_MODULE, | ||
MSG_TYPES, | ||
MSG_TYPES_LONG, | ||
MSG_TYPES_STATUS, | ||
) | ||
from pylint.message.build_message_definition import build_message_def | ||
from pylint.message.message import Message | ||
from pylint.message.message_definition import MessageDefinition | ||
from pylint.message.message_handler_mix_in import MessagesHandlerMixIn | ||
from pylint.message.message_store import MessagesStore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html | ||
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING | ||
|
||
import warnings | ||
|
||
from pylint.interfaces import IRawChecker, ITokenChecker, implements | ||
from pylint.message.message_definition import MessageDefinition | ||
from pylint.utils.warning_scope import WarningScope | ||
|
||
|
||
def build_message_def(checker, msgid, msg_tuple): | ||
if implements(checker, (IRawChecker, ITokenChecker)): | ||
default_scope = WarningScope.LINE | ||
else: | ||
default_scope = WarningScope.NODE | ||
options = {} | ||
if len(msg_tuple) > 3: | ||
(msg, symbol, descr, options) = msg_tuple | ||
elif len(msg_tuple) > 2: | ||
(msg, symbol, descr) = msg_tuple | ||
else: | ||
# messages should have a symbol, but for backward compatibility | ||
# they may not. | ||
(msg, descr) = msg_tuple | ||
warnings.warn( | ||
"[pylint 0.26] description of message %s doesn't include " | ||
"a symbolic name" % msgid, | ||
DeprecationWarning, | ||
) | ||
symbol = None | ||
options.setdefault("scope", default_scope) | ||
return MessageDefinition(checker, msgid, msg, descr, symbol, **options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html | ||
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING | ||
|
||
MSG_STATE_CONFIDENCE = 2 | ||
_MSG_ORDER = "EWRCIF" | ||
MSG_STATE_SCOPE_CONFIG = 0 | ||
MSG_STATE_SCOPE_MODULE = 1 | ||
|
||
# The line/node distinction does not apply to fatal errors and reports. | ||
_SCOPE_EXEMPT = "FR" | ||
|
||
MSG_TYPES = { | ||
"I": "info", | ||
"C": "convention", | ||
"R": "refactor", | ||
"W": "warning", | ||
"E": "error", | ||
"F": "fatal", | ||
} | ||
MSG_TYPES_LONG = {v: k for k, v in MSG_TYPES.items()} | ||
|
||
MSG_TYPES_STATUS = {"I": 0, "C": 16, "R": 8, "W": 4, "E": 2, "F": 1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.