From 6892c6e76394b0eab2070f60a80ccbdaa9193490 Mon Sep 17 00:00:00 2001 From: Devyn Collier Johnson Date: Sun, 7 Oct 2018 00:09:06 -0500 Subject: [PATCH] PyLint Comments Work With Other Linter Comments This is the solution for [#2297](https://github.com/PyCQA/pylint/issues/2297), [#2470](https://github.com/PyCQA/pylint/issues/2470), and [#2485](https://github.com/PyCQA/pylint/issues/2485). --- pylint/lint.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pylint/lint.py b/pylint/lint.py index 7e54145409..003e68ad3b 100644 --- a/pylint/lint.py +++ b/pylint/lint.py @@ -814,7 +814,13 @@ def process_tokens(self, tokens): match = utils.OPTION_RGX.search(content) if match is None: continue - + # Find the Pylint comment among all other special comments on the line + _comments = content.rsplit(r'#') + for _msg in _comments: + _msg = _msg.strip() + if _msg.startswith(r'pylint:') and r'disable' in _msg: + content = r'#' + _msg + break first_group = match.group(1) if ( first_group.strip() == "disable-all"