From 08ea751fe1cf1a2da9cd1fc97453bb425517a4f3 Mon Sep 17 00:00:00 2001 From: Philipp Albrecht Date: Fri, 30 Jun 2023 10:50:22 +0200 Subject: Remove modeline pylint checker We're deprecating vim modelines in favor of `.editorconfig`. --- .pylintrc | 1 - .../dev/pylint_checkers/qute_pylint/modeline.py | 63 ---------------------- scripts/dev/run_vulture.py | 2 - 3 files changed, 66 deletions(-) delete mode 100644 scripts/dev/pylint_checkers/qute_pylint/modeline.py diff --git a/.pylintrc b/.pylintrc index b5a391288..6692c0fb2 100644 --- a/.pylintrc +++ b/.pylintrc @@ -4,7 +4,6 @@ ignore=resources.py extension-pkg-whitelist=PyQt5,sip load-plugins=qute_pylint.config, - qute_pylint.modeline, pylint.extensions.docstyle, pylint.extensions.emptystring, pylint.extensions.overlapping_exceptions, diff --git a/scripts/dev/pylint_checkers/qute_pylint/modeline.py b/scripts/dev/pylint_checkers/qute_pylint/modeline.py deleted file mode 100644 index 1df2c375e..000000000 --- a/scripts/dev/pylint_checkers/qute_pylint/modeline.py +++ /dev/null @@ -1,63 +0,0 @@ -# Copyright 2014-2021 Florian Bruhin (The Compiler) -# 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 . - -"""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)) diff --git a/scripts/dev/run_vulture.py b/scripts/dev/run_vulture.py index b4b46fdb3..0bbfb3bfa 100755 --- a/scripts/dev/run_vulture.py +++ b/scripts/dev/run_vulture.py @@ -100,8 +100,6 @@ def whitelist_generator(): # noqa: C901 for attr in ['msgs', 'priority', 'visit_attribute']: 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): yield 'qutebrowser.config.configtypes.' + name -- cgit v1.2.3-54-g00ecf