Skip to content

Commit 9c225a1

Browse files
author
Revenue Holdings
committed
fix: ruff lint - datetime.UTC, X|None, E501, B904, F821
1 parent bdf5f50 commit 9c225a1

5 files changed

Lines changed: 22 additions & 16 deletions

File tree

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: pip
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 5
8+
- package-ecosystem: github-actions
9+
directory: "/"
10+
schedule:
11+
interval: weekly
12+
open-pull-requests-limit: 3

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,4 @@ Thumbs.db
7070
# Project specific
7171
research/
7272
fixtures/generated/
73+
.ruff_cache/

src/deadcode/cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ def _get_fail_threshold(ctx: click.Context) -> int:
6969
@cli.command()
7070
@click.option("--json-output", "-j", is_flag=True, help="Output as JSON")
7171
@click.option("--category", "-c", type=click.Choice(ALL_CATEGORIES), default=None, help="Filter by category")
72-
@click.option("--fail", "fail_threshold", type=int, default=None, help="Exit code 1 if findings >= threshold (overrides .deadcode.yml)")
72+
@click.option("--fail", "fail_threshold", type=int, default=None,
73+
help="Exit code 1 if findings >= threshold (overrides .deadcode.yml)")
7374
@click.pass_context
7475
def scan(ctx: click.Context, json_output: bool, category: str | None, fail_threshold: int | None) -> None:
7576
"""Scan project for dead code."""
@@ -162,7 +163,8 @@ def scan(ctx: click.Context, json_output: bool, category: str | None, fail_thres
162163

163164
@cli.command()
164165
@click.option("--dry-run", is_flag=True, help="Preview what would be removed without making changes")
165-
@click.option("--category", "-c", type=click.Choice(ALL_CATEGORIES), default=None, help="Only remove findings in this category")
166+
@click.option("--category", "-c", type=click.Choice(ALL_CATEGORIES),
167+
default=None, help="Only remove findings in this category")
166168
@click.pass_context
167169
def remove(ctx: click.Context, dry_run: bool, category: str | None) -> None:
168170
"""Remove dead code (with --dry-run for preview).

tests/test_config_and_fixes.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33
from __future__ import annotations
44

55
import json
6-
import os
7-
from pathlib import Path
8-
96
import pytest
10-
11-
from deadcode.config import DeadCodeConfig
12-
from deadcode.scanner import DeadCodeScanner, ScanResult, Finding
137
from deadcode.cli import cli
8+
from deadcode.config import DeadCodeConfig
9+
from deadcode.scanner import DeadCodeScanner
1410

1511

1612
@pytest.fixture
@@ -214,7 +210,7 @@ def test_component_imported_not_reported(self, tmp_path):
214210
result = scanner.scan()
215211

216212
comp_names = {f.name for f in result.unreferenced_components}
217-
assert "Button" not in comp_names, f"Button should not be unreferenced — it's imported by App.tsx"
213+
assert "Button" not in comp_names, "Button should not be unreferenced — it's imported by App.tsx"
218214

219215
def test_component_not_imported_is_reported(self, tmp_path):
220216
"""Component with zero imports should still be reported."""

tests/test_scanner.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@
33
from __future__ import annotations
44

55
import json
6-
import os
7-
import tempfile
8-
from pathlib import Path
9-
106
import pytest
11-
12-
from deadcode.scanner import DeadCodeScanner, ScanResult, Finding
137
from deadcode.cli import cli
8+
from deadcode.scanner import DeadCodeScanner
149

1510

1611
@pytest.fixture
@@ -279,7 +274,7 @@ def test_scan_json_output(self, runner, sample_project):
279274
def test_scan_category_filter(self, runner, sample_project):
280275
result = runner.invoke(cli, ["-p", str(sample_project), "scan", "-c", "orphaned_css"])
281276
assert result.exit_code == 0
282-
data = json.loads(result.output) if "--json-output" in [] else None
277+
json.loads(result.output) if "--json-output" in [] else None
283278
# Just check it doesn't crash
284279
assert "Orphaned CSS" in result.output or result.exit_code == 0
285280

0 commit comments

Comments
 (0)