Remove modeline pylint checker
We're deprecating vim modelines in favor of `.editorconfig`.
This commit is contained in:
parent
772c39cea2
commit
08ea751fe1
|
|
@ -4,7 +4,6 @@
|
||||||
ignore=resources.py
|
ignore=resources.py
|
||||||
extension-pkg-whitelist=PyQt5,sip
|
extension-pkg-whitelist=PyQt5,sip
|
||||||
load-plugins=qute_pylint.config,
|
load-plugins=qute_pylint.config,
|
||||||
qute_pylint.modeline,
|
|
||||||
pylint.extensions.docstyle,
|
pylint.extensions.docstyle,
|
||||||
pylint.extensions.emptystring,
|
pylint.extensions.emptystring,
|
||||||
pylint.extensions.overlapping_exceptions,
|
pylint.extensions.overlapping_exceptions,
|
||||||
|
|
|
||||||
|
|
@ -1,63 +0,0 @@
|
||||||
# Copyright 2014-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
|
|
||||||
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
|
|
||||||
|
|
||||||
# This file is part of qutebrowser.
|
|
||||||
#
|
|
||||||
# qutebrowser is free software: you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# qutebrowser is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with qutebrowser. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
"""Checker for vim modelines in files."""
|
|
||||||
|
|
||||||
import os.path
|
|
||||||
import contextlib
|
|
||||||
|
|
||||||
from pylint import interfaces, checkers
|
|
||||||
|
|
||||||
|
|
||||||
class ModelineChecker(checkers.BaseChecker):
|
|
||||||
|
|
||||||
"""Check for vim modelines in files."""
|
|
||||||
|
|
||||||
__implements__ = interfaces.IRawChecker
|
|
||||||
|
|
||||||
name = 'modeline'
|
|
||||||
msgs = {'W9102': ('Does not have vim modeline', 'modeline-missing', None),
|
|
||||||
'W9103': ('Modeline is invalid', 'invalid-modeline', None),
|
|
||||||
'W9104': ('Modeline position is wrong', 'modeline-position', None)}
|
|
||||||
options = ()
|
|
||||||
priority = -1
|
|
||||||
|
|
||||||
def process_module(self, node):
|
|
||||||
"""Process the module."""
|
|
||||||
if os.path.basename(os.path.splitext(node.file)[0]) == '__init__':
|
|
||||||
return
|
|
||||||
max_lineno = 1
|
|
||||||
with contextlib.closing(node.stream()) as stream:
|
|
||||||
for (lineno, line) in enumerate(stream):
|
|
||||||
if lineno == 1 and line.startswith(b'#!'):
|
|
||||||
max_lineno += 1
|
|
||||||
continue
|
|
||||||
elif line.startswith(b'# vim:'):
|
|
||||||
if lineno > max_lineno:
|
|
||||||
self.add_message('modeline-position', line=lineno)
|
|
||||||
if (line.rstrip() != b'# vim: ft=python '
|
|
||||||
b'fileencoding=utf-8 sts=4 sw=4 et:'):
|
|
||||||
self.add_message('invalid-modeline', line=lineno)
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
self.add_message('modeline-missing', line=1)
|
|
||||||
|
|
||||||
|
|
||||||
def register(linter):
|
|
||||||
"""Register the checker."""
|
|
||||||
linter.register_checker(ModelineChecker(linter))
|
|
||||||
|
|
@ -100,8 +100,6 @@ def whitelist_generator(): # noqa: C901
|
||||||
|
|
||||||
for attr in ['msgs', 'priority', 'visit_attribute']:
|
for attr in ['msgs', 'priority', 'visit_attribute']:
|
||||||
yield 'scripts.dev.pylint_checkers.config.' + attr
|
yield 'scripts.dev.pylint_checkers.config.' + attr
|
||||||
for attr in ['visit_call', 'process_module']:
|
|
||||||
yield 'scripts.dev.pylint_checkers.modeline.' + attr
|
|
||||||
|
|
||||||
for name, _member in inspect.getmembers(configtypes, inspect.isclass):
|
for name, _member in inspect.getmembers(configtypes, inspect.isclass):
|
||||||
yield 'qutebrowser.config.configtypes.' + name
|
yield 'qutebrowser.config.configtypes.' + name
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue