diff options
Diffstat (limited to 'scripts/dev/misc_checks.py')
-rw-r--r-- | scripts/dev/misc_checks.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/scripts/dev/misc_checks.py b/scripts/dev/misc_checks.py index a66dd68fe..240b5e6f1 100644 --- a/scripts/dev/misc_checks.py +++ b/scripts/dev/misc_checks.py @@ -1,6 +1,4 @@ #!/usr/bin/env python3 -# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: - # Copyright 2014-2021 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. @@ -403,6 +401,25 @@ def check_userscript_shebangs(_args: argparse.Namespace) -> bool: return ok +def check_vim_modelines(args: argparse.Namespace) -> bool: + """Check that we're not using vim modelines.""" + ok = True + try: + for path in _get_files(verbose=args.verbose): + with tokenize.open(str(path)) as f: + for num, line in enumerate(f, start=1): + if not line.startswith("# vim:"): + continue + print(f"{path}:{num}: Remove vim modeline " + "(deprecated in favor of .editorconfig)") + ok = False + except Exception: + traceback.print_exc() + ok = False + + return ok + + def main() -> int: checkers = { 'git': check_git, @@ -412,6 +429,7 @@ def main() -> int: 'userscript-descriptions': check_userscripts_descriptions, 'userscript-shebangs': check_userscript_shebangs, 'changelog-urls': check_changelog_urls, + 'vim-modelines': check_vim_modelines, } parser = argparse.ArgumentParser() |