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"