reuse: Add linting for old license comments

This commit is contained in:
Florian Bruhin 2023-07-23 13:53:31 +02:00
parent 9d749bd7d2
commit 09fd975af7
3 changed files with 11 additions and 2 deletions

View File

@ -76,7 +76,7 @@ class-const-naming-style = snake_case
[FORMAT]
# FIXME:v4 (lint) down to 88 again once we use black
max-line-length=190
ignore-long-lines=(<?https?://|file://|^# Copyright 201\d|link:)
ignore-long-lines=(<?https?://|file://|link:)
expected-line-ending-format=LF
[VARIABLES]

View File

@ -266,6 +266,14 @@ def check_spelling(args: argparse.Namespace) -> Optional[bool]:
re.compile(r'pathlib\.Path\(tmpdir\)'),
"use tmp_path instead",
),
(
re.compile(r' Copyright 2'),
"use 'SPDX-FileCopyrightText: ...' without year instead",
),
(
re.compile(r'qutebrowser is free software: you can redistribute'),
"use 'SPDX-License-Identifier: GPL-3.0-or-later' instead",
),
]
# Files which should be ignored, e.g. because they come from another
@ -276,6 +284,7 @@ def check_spelling(args: argparse.Namespace) -> Optional[bool]:
pathlib.Path('scripts', 'dev', 'enums.txt'),
pathlib.Path('qutebrowser', '3rdparty', 'pdfjs'),
pathlib.Path('qutebrowser', 'qt', '_core_pyqtproperty.py'),
pathlib.Path('qutebrowser', 'javascript', 'caret.js'),
hint_data / 'ace' / 'ace.js',
hint_data / 'bootstrap' / 'bootstrap.css',
]

View File

@ -63,7 +63,7 @@ def main():
args = [
'--disable={}'.format(','.join(disabled)),
'--ignored-modules=helpers,pytest,PyQt5',
r'--ignore-long-lines=(<?https?://|^# Copyright 201\d)|^ *def [a-z]',
r'--ignore-long-lines=(<?https?://)|^ *def [a-z]',
r'--method-rgx=[a-z_][A-Za-z0-9_]{1,100}$',
] + sys.argv[2:] + files
env = os.environ.copy()