Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.py]
indent_style = space
indent_size = 4
max_line_length = 88

[*.{yml,yaml}]
indent_style = space
indent_size = 2

[*.toml]
indent_style = space
indent_size = 4

[*.md]
trim_trailing_whitespace = false
13 changes: 8 additions & 5 deletions ruff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ target-version = "py312"
[lint]
select = ["ALL"]
ignore = [
"ANN", # flake8-annotations (ANN)
"COM812", # missing-trailing-comma
"D", # pydocstyle (D)
"RET504", # Unnecessary assignment to X before `return` statement
"ANN", # flake8-annotations (ANN)
"COM812", # missing-trailing-comma
"D", # pydocstyle (D)
"RET504", # Unnecessary assignment to X before `return` statement
]

[lint.per-file-ignores]
"tests/**" = ["S101"] # assert is expected in tests
"tests/**" = [
"S101", # assert is expected in tests
"PLR2004", # magic values are fine in test assertions
]
14 changes: 7 additions & 7 deletions tests/test_git_commit_guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ def test_first_found_wins(self, tmp_path):
class TestParseConfigChecks:
def test_disable_list(self):
checks = _parse_config_checks({"disable": ["signature", "body"]}, "disable")
assert len(checks) == 2 # noqa: PLR2004
assert len(checks) == 2

def test_missing_key_returns_empty(self):
assert _parse_config_checks({}, "disable") == []
Expand All @@ -538,19 +538,19 @@ def test_defaults_when_no_config_or_flag(self):

def test_cli_flag_overrides_default(self):
result = _resolve_max_subject_length(Namespace(max_subject_length=50), {})
assert result == 50 # noqa: PLR2004 Magic value used in comparison, consider replacing 50 with a constant variable
assert result == 50

def test_config_overrides_default(self):
result = _resolve_max_subject_length(
Namespace(max_subject_length=None), {"max-subject-length": 60}
)
assert result == 60 # noqa: PLR2004 Magic value used in comparison, consider replacing 60 with a constant variable
assert result == 60

def test_cli_overrides_config(self):
result = _resolve_max_subject_length(
Namespace(max_subject_length=50), {"max-subject-length": 60}
)
assert result == 50 # noqa: PLR2004 Magic value used in comparison, consider replacing 50 with a constant variable
assert result == 50


class TestResolveMinDescriptionLength:
Expand All @@ -564,19 +564,19 @@ def test_cli_flag_overrides_default(self):
result = _resolve_min_description_length(
Namespace(min_description_length=10), {}
)
assert result == 10 # noqa: PLR2004 Magic value used in comparison, consider replacing 10 with a constant variable
assert result == 10

def test_config_overrides_default(self):
result = _resolve_min_description_length(
Namespace(min_description_length=None), {"min-description-length": 8}
)
assert result == 8 # noqa: PLR2004 Magic value used in comparison, consider replacing 8 with a constant variable
assert result == 8

def test_cli_overrides_config(self):
result = _resolve_min_description_length(
Namespace(min_description_length=10), {"min-description-length": 8}
)
assert result == 10 # noqa: PLR2004 Magic value used in comparison, consider replacing 10 with a constant variable
assert result == 10


class TestResolveTypes:
Expand Down
Loading