Skip to content

Commit bdf5f50

Browse files
author
Revenue Holdings
committed
fix: ruff lint fixes, add ruff CI step, CONTRIBUTING.md, remove BOM from config files
1 parent dbc8e89 commit bdf5f50

8 files changed

Lines changed: 71 additions & 10 deletions

File tree

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ jobs:
3232
run: twine check dist/*
3333

3434
- name: Publish to PyPI
35-
uses: pypa/gh-action-pypi-publish@release/v1
35+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
python -m pip install --upgrade pip
2727
pip install -e ".[dev]"
2828
29+
- name: Lint with ruff
30+
run: pip install ruff && ruff check src/ --target-version py310
2931
- name: Run tests
3032
run: |
3133
python -m pytest tests/ -v --tb=short
@@ -34,3 +36,4 @@ jobs:
3436
run: |
3537
deadcode --version
3638
deadcode --help
39+

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.0] - 2025-05-17
9+
10+
### Added
11+
- Initial beta release
12+
- Core functionality
13+
- CLI interface
14+
- Test suite
15+
- CI/CD workflows with ruff lint and pytest
16+
- CONTRIBUTING.md

CONTRIBUTING.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Contributing
2+
3+
Thanks for your interest in contributing!
4+
5+
## Development Setup
6+
7+
1. Fork and clone the repo
8+
2. Create a virtual environment: python -m venv .venv && source .venv/bin/activate
9+
3. Install dev dependencies: pip install -e ".[dev]"
10+
4. Run tests: pytest tests/ -v
11+
5. Lint: uff check src/
12+
13+
## Pull Requests
14+
15+
- Fork the repo and create a feature branch
16+
- Add tests for any new functionality
17+
- Ensure all existing tests pass
18+
- Run uff check src/ --fix before committing
19+
- Keep PRs focused on a single change
20+
21+
## Reporting Issues
22+
23+
- Use GitHub Issues
24+
- Include Python version, OS, and steps to reproduce
25+
- Include relevant error output
26+
27+
## Code Style
28+
29+
- Python 3.10+
30+
- Type hints where practical
31+
- Follow ruff defaults (Black-compatible formatting)
32+
33+
## License
34+
35+
By contributing, you agree your work will be licensed under the same license as this project.

pyproject.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,14 @@ where = ["src"]
4646
[tool.pytest.ini_options]
4747
testpaths = ["tests"]
4848
python_files = ["test_*.py"]
49+
50+
[tool.ruff]
51+
target-version = "py310"
52+
line-length = 120
53+
54+
[tool.ruff.lint]
55+
select = ["E", "F", "W", "I", "UP", "B", "SIM"]
56+
ignore = ["E501"]
57+
58+
[tool.ruff.lint.isort]
59+
known-first-party = ["*"]

src/deadcode/cli.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@
22

33
from __future__ import annotations
44

5+
import click
56
import json
67
import sys
78
from pathlib import Path
8-
from typing import Any
9-
10-
import click
119
from rich.console import Console
1210
from rich.table import Table
11+
1312
try:
1413
from revenueholdings_license import require_license
1514
except ImportError:
1615
require_license = None
1716

1817
from . import __version__
1918
from .config import DeadCodeConfig
20-
from .scanner import DeadCodeScanner, ScanResult, Finding
19+
from .scanner import DeadCodeScanner, Finding
2120

2221
console = Console()
2322
err_console = Console(stderr=True)

src/deadcode/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def load(cls, project_dir: str | Path) -> DeadCodeConfig:
4747
return cls()
4848

4949
try:
50-
with open(config_path, "r", encoding="utf-8") as f:
50+
with open(config_path, encoding="utf-8") as f:
5151
data = yaml.safe_load(f) or {}
5252
except Exception:
5353
return cls()

src/deadcode/scanner.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
from __future__ import annotations
1111

1212
import os
13+
import pathspec
1314
import re
1415
from dataclasses import dataclass, field
1516
from pathlib import Path
16-
from typing import Any
17-
18-
import pathspec
1917

2018
# ── Data structures ───────────────────────────────────────────────────
2119

@@ -163,7 +161,6 @@ def scan(self) -> ScanResult:
163161
css_classes: dict[str, list[tuple[str, int]]] = {} # class -> [(file, line)]
164162
used_css_classes: set[str] = set()
165163
components: dict[str, str] = {} # ComponentName -> file
166-
component_imports: set[str] = set() # names of imported components
167164
routes: list[tuple[str, str]] = [] # (route_path, file)
168165

169166
for filepath in all_files:

0 commit comments

Comments
 (0)