summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2019-02-13 10:57:21 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2019-02-13 10:57:21 +0100
commit46faee298e54727abd253031cd1314bbad6c9ed9 (patch)
tree71c5f48ee576534028b0c4eeae0b7c945c3a0074
parentfa52e7da184435ed2c472a86f854e386594ae99a (diff)
downloadpylint-git-46faee298e54727abd253031cd1314bbad6c9ed9.tar.gz
Added a new command line option ``list-groups`` for listing all the check groups ``pylint`` knows about.
-rw-r--r--ChangeLog2
-rw-r--r--doc/whatsnew/2.3.rst5
-rw-r--r--pylint/lint.py27
3 files changed, 33 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 44aa9091b..a6e92bbd9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@ What's New in Pylint 2.3.0?
Release date: TBA
+* Added a new command line option ``list-groups`` for listing all the check groups ``pylint`` knows about.
+
* Allow ``BaseException`` for emitting ``broad-except``, just like ``Exception``.
Close #2741
diff --git a/doc/whatsnew/2.3.rst b/doc/whatsnew/2.3.rst
index f60b74cfc..1f3cbc9ff 100644
--- a/doc/whatsnew/2.3.rst
+++ b/doc/whatsnew/2.3.rst
@@ -27,7 +27,6 @@ New checkers
Closes #2558
-
* We added a new option ``check-str-concat-over-line-jumps`` to check
``implicit-str-concat-in-sequence`` over multiple lines.
@@ -62,3 +61,7 @@ Quite a lot of bug fixes and improvements went into this release:
* Plugins can now use the ``load_configuration()`` hook.
This hook is executed after configuration is loaded to prevent overwriting plugin
specific configuration via user-based configuration.
+
+* There's a new command line option ``list-groups`` for listing all the check groups
+ ``pylint`` knows about. This is useful to know what groups you can disable or enable
+ individually.
diff --git a/pylint/lint.py b/pylint/lint.py
index 26d79abd7..017c68547 100644
--- a/pylint/lint.py
+++ b/pylint/lint.py
@@ -878,6 +878,11 @@ class PyLinter(
if c is not self
]
+ def get_checker_names(self):
+ """Get all the checker names that this linter knows about."""
+ checkers = self.get_checkers()
+ return sorted({check.name for check in checkers if check.name != "master"})
+
def prepare_checkers(self):
"""return checkers needed for activated messages and reports"""
if not self.config.reports:
@@ -1435,6 +1440,17 @@ group are mutually exclusive.",
},
),
(
+ "list-groups",
+ {
+ "action": "callback",
+ "metavar": "<msg-id>",
+ "callback": self.cb_list_groups,
+ "group": "Commands",
+ "level": 1,
+ "help": "List pylint's message groups.",
+ },
+ ),
+ (
"list-conf-levels",
{
"action": "callback",
@@ -1660,6 +1676,17 @@ group are mutually exclusive.",
self.linter.msgs_store.list_messages()
sys.exit(0)
+ def cb_list_groups(self, *args, **kwargs):
+ """List all the check groups that pylint knows about
+
+ These should be useful to know what check groups someone can disable
+ or enable.
+ """
+ checkers = self.linter.get_checker_names()
+ for check in checkers:
+ print(check)
+ sys.exit(0)
+
def cb_python3_porting_mode(self, *args, **kwargs):
"""Activate only the python3 porting checker."""
self.linter.python3_porting_mode()