Lint: Add Ruff (#3429)
This commit is contained in:
parent
971a49b67a
commit
0f22268963
|
@ -20,6 +20,7 @@ contents.rst @AA-Turner
|
|||
.codespell/ @CAM-Gerlach @hugovk
|
||||
.codespellrc @CAM-Gerlach @hugovk
|
||||
.pre-commit-config.yaml @CAM-Gerlach @hugovk
|
||||
.ruff.toml @AA-Turner @CAM-Gerlach @hugovk
|
||||
check-peps.py @AA-Turner @CAM-Gerlach @hugovk
|
||||
|
||||
# Git infrastructure
|
||||
|
|
|
@ -42,6 +42,17 @@ repos:
|
|||
- id: check-yaml
|
||||
name: "Check YAML"
|
||||
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: v0.0.287
|
||||
hooks:
|
||||
- id: ruff
|
||||
name: "Lint with Ruff"
|
||||
args:
|
||||
- '--exit-non-zero-on-fix'
|
||||
- '--diff'
|
||||
- '--format=github'
|
||||
files: '^pep_sphinx_extensions/tests/'
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 23.7.0
|
||||
hooks:
|
||||
|
@ -52,14 +63,6 @@ repos:
|
|||
- '--target-version=py310'
|
||||
files: 'pep_sphinx_extensions/tests/.*'
|
||||
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.12.0
|
||||
hooks:
|
||||
- id: isort
|
||||
name: "Sort imports with isort"
|
||||
args: ['--profile=black', '--atomic']
|
||||
files: 'pep_sphinx_extensions/tests/.*'
|
||||
|
||||
- repo: https://github.com/tox-dev/tox-ini-fmt
|
||||
rev: 1.3.1
|
||||
hooks:
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
ignore = [
|
||||
"E501", # Line too long
|
||||
]
|
||||
|
||||
select = [
|
||||
"E", # pycodestyle errors
|
||||
"F", # pyflakes
|
||||
"I", # isort
|
||||
"PT", # flake8-pytest-style
|
||||
"W", # pycodestyle warnings
|
||||
]
|
||||
|
||||
show-source = true
|
||||
|
||||
target-version = "py39"
|
|
@ -93,7 +93,7 @@ def test_date_checker_too_early(date_str: str):
|
|||
[
|
||||
# the future
|
||||
"31-Dec-2999",
|
||||
"01-Jan-2100",
|
||||
"01-Jan-2042",
|
||||
"01-Jan-2100",
|
||||
(dt.datetime.now() + dt.timedelta(days=15)).strftime("%d-%b-%Y"),
|
||||
(dt.datetime.now() + dt.timedelta(days=100)).strftime("%d-%b-%Y"),
|
||||
|
|
|
@ -149,7 +149,7 @@ def test_validate_delegate(line: str):
|
|||
(r"Cardinal Ximénez <Cardinal\Ximenez@spanish.inquisition>", {"valid email"}),
|
||||
("Cardinal Ximénez <[Cardinal.Ximenez]@spanish.inquisition>", {"valid email"}),
|
||||
('Cardinal Ximénez <"Cardinal"Ximenez"@spanish.inquisition>', {"valid email"}),
|
||||
("Cardinal Ximénez <Cardinal;Ximenez@spanish.inquisition>", {"valid email"}),
|
||||
("Cardinal Ximenez <Cardinal;Ximenez@spanish.inquisition>", {"valid email"}),
|
||||
("Cardinal Ximénez <Cardinal£Ximénez@spanish.inquisition>", {"valid email"}),
|
||||
("Cardinal Ximénez <Cardinal§Ximenez@spanish.inquisition>", {"valid email"}),
|
||||
# ... entries must contain a valid email address (domain)
|
||||
|
|
|
@ -196,7 +196,7 @@ def test_validate_type_invalid(line: str):
|
|||
# duplicates
|
||||
("Governance, Governance", {"duplicates"}),
|
||||
("Release, Release", {"duplicates"}),
|
||||
("Release, Release", {"duplicates"}),
|
||||
("Packaging, Packaging", {"duplicates"}),
|
||||
("Spam, Spam", {"duplicates", "valid"}),
|
||||
("lobster, lobster", {"duplicates", "capitalisation", "valid"}),
|
||||
("governance, governance", {"duplicates", "capitalisation"}),
|
||||
|
|
|
@ -108,8 +108,6 @@ def test_validate_resolution_valid(line: str):
|
|||
"https://mail.python.org/archives/list/list-name@python.org/thread/abcXYZ123/#anchor",
|
||||
"https://mail.python.org/archives/list/list-name@python.org/message/#abcXYZ123",
|
||||
"https://mail.python.org/archives/list/list-name@python.org/message/#abcXYZ123/",
|
||||
"https://mail.python.org/archives/list/list-name@python.org/message/abcXYZ123/anchor/",
|
||||
"https://mail.python.org/archives/list/list-name@python.org/message/abcXYZ123/anchor/",
|
||||
"https://mail.python.org/archives/list/list-name@python.org/spam/abcXYZ123",
|
||||
"https://mail.python.org/archives/list/list-name@python.org/spam/abcXYZ123/",
|
||||
],
|
||||
|
@ -233,8 +231,6 @@ def test_thread_checker_valid_allow_message(thread_url: str):
|
|||
"https://mail.python.org/archives/list/list-name@python.org/thread/abcXYZ123/#anchor",
|
||||
"https://mail.python.org/archives/list/list-name@python.org/message/#abcXYZ123",
|
||||
"https://mail.python.org/archives/list/list-name@python.org/message/#abcXYZ123/",
|
||||
"https://mail.python.org/archives/list/list-name@python.org/message/abcXYZ123/anchor/",
|
||||
"https://mail.python.org/archives/list/list-name@python.org/message/abcXYZ123/anchor/",
|
||||
"https://mail.python.org/archives/list/list-name@python.org/spam/abcXYZ123",
|
||||
"https://mail.python.org/archives/list/list-name@python.org/spam/abcXYZ123/",
|
||||
],
|
||||
|
|
|
@ -18,7 +18,7 @@ from pep_sphinx_extensions.pep_zero_generator.constants import (
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_input, expected",
|
||||
("test_input", "expected"),
|
||||
[
|
||||
("my-mailing-list@example.com", "my-mailing-list@example.com"),
|
||||
("python-tulip@googlegroups.com", "https://groups.google.com/g/python-tulip"),
|
||||
|
@ -37,7 +37,7 @@ def test_generate_list_url(test_input, expected):
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_input, expected",
|
||||
("test_input", "expected"),
|
||||
[
|
||||
(
|
||||
"https://mail.python.org/pipermail/python-3000/2006-November/004190.html",
|
||||
|
@ -72,7 +72,7 @@ def test_process_pretty_url(test_input, expected):
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_input, expected",
|
||||
("test_input", "expected"),
|
||||
[
|
||||
(
|
||||
"https://example.com/",
|
||||
|
@ -94,7 +94,7 @@ def test_process_pretty_url_invalid(test_input, expected):
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_input, expected",
|
||||
("test_input", "expected"),
|
||||
[
|
||||
(
|
||||
"https://mail.python.org/pipermail/python-3000/2006-November/004190.html",
|
||||
|
@ -129,7 +129,7 @@ def test_make_link_pretty(test_input, expected):
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_input, expected",
|
||||
("test_input", "expected"),
|
||||
[
|
||||
(STATUS_ACCEPTED, "Normative proposal accepted for implementation"),
|
||||
(STATUS_ACTIVE, "Currently valid informational guidance, or an in-use process"),
|
||||
|
@ -155,7 +155,7 @@ def test_abbreviate_status_unknown():
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_input, expected",
|
||||
("test_input", "expected"),
|
||||
[
|
||||
(
|
||||
TYPE_INFO,
|
||||
|
|
|
@ -5,7 +5,7 @@ from pep_sphinx_extensions.pep_processor.transforms import pep_zero
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_input, expected",
|
||||
("test_input", "expected"),
|
||||
[
|
||||
(
|
||||
nodes.reference(
|
||||
|
|
|
@ -52,7 +52,7 @@ def test_pep_details(monkeypatch):
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_input, expected",
|
||||
("test_input", "expected"),
|
||||
[
|
||||
(
|
||||
"First Last <user@example.com>",
|
||||
|
@ -88,7 +88,7 @@ def test_parse_authors_invalid():
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_type, test_status, expected",
|
||||
("test_type", "test_status", "expected"),
|
||||
[
|
||||
(TYPE_INFO, STATUS_DRAFT, ":abbr:`I (Informational, Draft)`"),
|
||||
(TYPE_INFO, STATUS_ACTIVE, ":abbr:`IA (Informational, Active)`"),
|
||||
|
|
|
@ -30,7 +30,7 @@ def test_pep_zero_writer_emit_title():
|
|||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"test_input, expected",
|
||||
("test_input", "expected"),
|
||||
[
|
||||
(
|
||||
"pep-9000.rst",
|
||||
|
|
Loading…
Reference in New Issue