Skip to content

Commit 39ccd4c

Browse files
author
Dominikus Nold
committed
Fix tests and linter conflicts
1 parent ec877d0 commit 39ccd4c

File tree

7 files changed

+27
-51
lines changed

7 files changed

+27
-51
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ Please check all that apply:
7070

7171
## Checklist
7272

73-
- [ ] My code follows the style guidelines (PEP 8, Black, isort)
73+
- [ ] My code follows the style guidelines (PEP 8, ruff format, isort)
7474
- [ ] I have performed a self-review of my code
7575
- [ ] I have added/updated contracts (`@icontract`, `@beartype`)
7676
- [ ] I have added/updated docstrings (Google style)

pyproject.toml

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ dev = [
7272
"pytest-asyncio>=1.2.0",
7373
"pytest-xdist>=3.8.0",
7474
"basedpyright>=1.32.1",
75-
"black>=25.9.0",
7675
"isort>=7.0.0",
7776
"pylint>=4.0.2",
7877
"ruff>=0.14.2",
@@ -118,7 +117,6 @@ dependencies = [
118117
"python-dotenv",
119118
"pre-commit",
120119
# Ensure format/lint tools are available in the hatch env
121-
"black>=25.9.0",
122120
"isort>=7.0.0",
123121
"basedpyright>=1.32.1",
124122
"pylint>=4.0.2",
@@ -137,9 +135,9 @@ dependencies = [
137135
test = "pytest {args}"
138136
test-cov = "pytest --cov=src --cov-report=term-missing {args}"
139137
type-check = "basedpyright {args}"
140-
lint = "black . --line-length=120 && basedpyright && ruff check . && ruff format . --check && pylint src tests tools"
138+
lint = "ruff format . --check && basedpyright && ruff check . && pylint src tests tools"
141139
governance = "pylint src tests tools --reports=y --output-format=parseable"
142-
format = "black . --line-length=120 && ruff check . --fix && ruff format ."
140+
format = "ruff check . --fix && ruff format ."
143141

144142
# Code scanning (Semgrep)
145143
scan = "semgrep --config tools/semgrep/async.yml {args}"
@@ -366,28 +364,8 @@ exclude = [
366364
# [tool.hatch.envs.default.env-vars] # Add if you have default env vars for hatch environments
367365
# MY_VAR = "value"
368366

369-
[tool.black]
370-
line-length = 120
371-
target-version = ["py312"] # From your original config
372-
include = '''\.pyi?$''' # From template
373-
exclude = '''
374-
/(
375-
\.eggs
376-
| \.git
377-
| \.hg
378-
| \.mypy_cache
379-
| \.tox
380-
| \.venv
381-
| _build
382-
| buck-out
383-
| build
384-
| dist
385-
# Add project-specific excludes if any
386-
)/
387-
'''
388-
389367
[tool.isort]
390-
profile = "black"
368+
profile = "ruff"
391369
multi_line_output = 3
392370
line_length = 120 # From your original config
393371

@@ -517,8 +495,8 @@ disable = [
517495
"C0115", # missing-class-docstring
518496
"C0116", # missing-function-docstring
519497
"C0103", # invalid-name (too restrictive for some cases)
520-
"C0330", # bad-continuation (handled by black)
521-
"C0326", # bad-whitespace (handled by black)
498+
"C0330", # bad-continuation (handled by ruff format)
499+
"C0326", # bad-whitespace (handled by ruff format)
522500
"R0903", # too-few-public-methods
523501
"R0913", # too-many-arguments (too restrictive for APIs)
524502
"R0912", # too-many-branches
@@ -580,7 +558,7 @@ select = [
580558
]
581559

582560
ignore = [
583-
"E501", # line too long (handled by black)
561+
"E501", # line too long (handled by ruff format)
584562
"C901", # too complex (leave to pylint for governance)
585563
"PLR0913", # too many arguments (pylint handles this better)
586564
"PLR0912", # too many branches (pylint handles this better)
@@ -638,8 +616,8 @@ ignore = [
638616
]
639617

640618
[tool.ruff.lint.isort]
641-
# Match isort black profile configuration
642-
# Black-compatible: multi_line_output = 3, combine_as_imports = true
619+
# Match isort ruff profile configuration
620+
# Ruff-compatible: multi_line_output = 3, combine_as_imports = true
643621
force-single-line = false
644622
force-wrap-aliases = false
645623
combine-as-imports = true

src/specfact_cli/agents/analyze_agent.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,7 @@ def _load_codebase_context(self, repo_path: Path) -> dict[str, Any]:
294294
context["dependencies"] = dependencies
295295

296296
# Generate summary
297-
context[
298-
"summary"
299-
] = f"""
297+
context["summary"] = f"""
300298
Repository: {repo_path.name}
301299
Total code files: {len(filtered_files)}
302300
Languages detected: {", ".join({f.suffix for f in filtered_files[:20]})}

src/specfact_cli/commands/sync.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def _is_test_mode() -> bool:
3333
return True
3434
# Check if running under pytest (common patterns)
3535
import sys
36+
3637
return any("pytest" in arg or "test" in arg.lower() for arg in sys.argv) or "pytest" in sys.modules
3738

3839

tests/e2e/test_complete_workflow.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,12 +1962,12 @@ def test_story_points_fibonacci_compliance(self):
19621962

19631963
for feature in plan.features:
19641964
for story in feature.stories:
1965-
assert (
1966-
story.story_points in valid_fibonacci
1967-
), f"Story {story.key} has invalid story points: {story.story_points}"
1968-
assert (
1969-
story.value_points in valid_fibonacci
1970-
), f"Story {story.key} has invalid value points: {story.value_points}"
1965+
assert story.story_points in valid_fibonacci, (
1966+
f"Story {story.key} has invalid story points: {story.story_points}"
1967+
)
1968+
assert story.value_points in valid_fibonacci, (
1969+
f"Story {story.key} has invalid value points: {story.value_points}"
1970+
)
19711971

19721972
print("✅ All stories use valid Fibonacci numbers")
19731973

tests/e2e/test_watch_mode_e2e.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ def run_watch_mode() -> None:
180180
@pytest.mark.timeout(10)
181181
def test_watch_mode_bidirectional_sync(self) -> None:
182182
"""Test that watch mode handles bidirectional sync with changes on both sides."""
183-
import shutil
184183

185184
with TemporaryDirectory() as tmpdir:
186185
repo_path = Path(tmpdir)
@@ -280,10 +279,10 @@ def run_watch_mode() -> None:
280279
if file.is_file():
281280
file.unlink()
282281
# Try to remove the directory
283-
try:
284-
gates_results.rmdir()
285-
except OSError:
286-
pass # Directory might not be empty, that's okay
282+
from contextlib import suppress
283+
284+
with suppress(OSError):
285+
gates_results.rmdir() # Directory might not be empty, that's okay
287286

288287
def test_watch_mode_detects_repository_changes(self) -> None:
289288
"""Test that watch mode detects and syncs repository code changes."""

tests/integration/analyzers/test_code_analyzer_integration.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -426,16 +426,16 @@ def __init__(self):
426426
if module_b_name and module_a_name:
427427
# Module B should depend on Module A
428428
# Edge direction: module_b -> module_a (B imports A, so B depends on A)
429-
assert analyzer.dependency_graph.has_edge(
430-
module_b_name, module_a_name
431-
), f"Missing edge from {module_b_name} to {module_a_name}. Available edges: {edges}"
429+
assert analyzer.dependency_graph.has_edge(module_b_name, module_a_name), (
430+
f"Missing edge from {module_b_name} to {module_a_name}. Available edges: {edges}"
431+
)
432432

433433
if module_c_name and module_b_name and module_c_name != module_b_name:
434434
# Module C should depend on Module B
435435
# Edge direction: module_c -> module_b (C imports B, so C depends on B)
436-
assert analyzer.dependency_graph.has_edge(
437-
module_c_name, module_b_name
438-
), f"Missing edge from {module_c_name} to {module_b_name}. Available edges: {edges}"
436+
assert analyzer.dependency_graph.has_edge(module_c_name, module_b_name), (
437+
f"Missing edge from {module_c_name} to {module_b_name}. Available edges: {edges}"
438+
)
439439
else:
440440
# If no edges, at least verify we have the nodes
441441
assert len(module_names) >= 3, f"Expected at least 3 modules, got: {module_names}"

0 commit comments

Comments
 (0)