Skip to content

Commit d9592ed

Browse files
committed
feat: context selection for git diff
1 parent 4e918c2 commit d9592ed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+12942
-100
lines changed

.github/workflows/cd.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
fi
8787
COMMIT_SHA=$(git rev-parse HEAD)
8888
echo "Commit SHA: $COMMIT_SHA"
89-
echo "commit_sha=$COMMIT_SHA" >> $GITHUB_OUTPUT
89+
echo "commit_sha=$COMMIT_SHA" >> "$GITHUB_OUTPUT"
9090
9191
- name: Check tag doesn't already exist
9292
run: |
@@ -121,8 +121,8 @@ jobs:
121121
- name: Set outputs
122122
id: set_outputs
123123
run: |
124-
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
125-
echo "tag_name=v${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
124+
echo "version=${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
125+
echo "tag_name=v${{ github.event.inputs.version }}" >> "$GITHUB_OUTPUT"
126126
127127
build-assets:
128128
name: Build Assets
@@ -218,7 +218,7 @@ jobs:
218218
echo "Detected ARM on macOS"
219219
fi
220220
echo "Determined ARCH: $ARCH"
221-
echo "arch=$ARCH" >> $GITHUB_OUTPUT
221+
echo "arch=$ARCH" >> "$GITHUB_OUTPUT"
222222
223223
- name: Rename asset with proper name
224224
shell: bash

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ __pycache__/
55

66
# C extensions
77
*.so
8-
8+
tree.yaml
99
# Distribution / packaging
1010
.Python
1111
build/

.markdownlintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docs/

.pre-commit-config.yaml

Lines changed: 91 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
minimum_pre_commit_version: '3.5.0'
2+
default_stages: [pre-commit]
3+
default_language_version:
4+
python: python3.12
5+
node: system
6+
7+
fail_fast: false
8+
19
repos:
210
# ============================================================================
311
# BASIC FILE QUALITY CHECKS (baseline hygiene)
@@ -22,58 +30,81 @@ repos:
2230
- id: name-tests-test
2331
args: ["--pytest-test-first"]
2432
exclude: ^tests/(utils|conftest)\.py$
33+
- id: fix-byte-order-marker
34+
- id: detect-private-key
2535

2636
# ============================================================================
27-
# CODE FORMATTING (minimal - consistency only, not quality)
28-
# Order matters: isort must run before black to avoid conflicts
37+
# GITHUB ACTIONS VALIDATION
38+
# ============================================================================
39+
- repo: https://github.com/python-jsonschema/check-jsonschema
40+
rev: 0.35.0
41+
hooks:
42+
- id: check-github-workflows
43+
name: Validate GitHub workflows
44+
args: ['--verbose']
45+
- id: check-dependabot
46+
name: Validate Dependabot config
47+
48+
- repo: https://github.com/rhysd/actionlint
49+
rev: v1.7.8
50+
hooks:
51+
- id: actionlint
52+
name: Lint GitHub Actions
53+
54+
# ============================================================================
55+
# CODE FORMATTING (Order: isort → black to avoid conflicts)
2956
# ============================================================================
3057
- repo: https://github.com/pycqa/isort
31-
rev: 5.13.2
58+
rev: 7.0.0
3259
hooks:
3360
- id: isort
3461

3562
- repo: https://github.com/psf/black
36-
rev: 25.9.0
63+
rev: 25.1.0
3764
hooks:
3865
- id: black
3966
language_version: python3
4067

68+
- repo: https://github.com/asottile/pyupgrade
69+
rev: v3.21.1
70+
hooks:
71+
- id: pyupgrade
72+
name: pyupgrade (auto-upgrade Python syntax)
73+
args: ['--py312-plus']
74+
files: ^src/.*\.py$
75+
4176
# ============================================================================
42-
# STATIC TYPING (proven to reduce TypeError/AttributeError in production)
43-
# Evidence: Dropbox/Instagram case studies show 15-40% reduction in type errors
77+
# STATIC TYPING
4478
# ============================================================================
4579
- repo: https://github.com/pre-commit/mirrors-mypy
4680
rev: v1.18.2
4781
hooks:
4882
- id: mypy
49-
name: mypy (strict mode for code health)
50-
# Runtime deps + stubs needed for mypy's isolated virtualenv
83+
name: mypy (strict mode)
5184
additional_dependencies:
5285
- types-PyYAML
5386
- PyYAML
5487
- pathspec
5588
files: ^src/
5689

90+
# ============================================================================
91+
# LINTING (Ruff for speed + correctness)
92+
# ============================================================================
93+
- repo: https://github.com/astral-sh/ruff-pre-commit
94+
rev: v0.14.0
95+
hooks:
96+
- id: ruff
97+
name: ruff (correctness-focused checks)
98+
args: ["--fix", "--unsafe-fixes"]
99+
57100
# ============================================================================
58101
# SECURITY & VULNERABILITY DETECTION
59-
# Evidence: CVE databases with reproducible advisories
60102
# ============================================================================
61103
- repo: https://github.com/trailofbits/pip-audit
62104
rev: v2.9.0
63105
hooks:
64106
- id: pip-audit
65107
name: pip-audit (CVE detection in dependencies)
66-
# CVE Ignores Documentation:
67-
# - GHSA-4xh5-x5gv-qwph (CVE-2025-8869): pip tar extraction path traversal.
68-
# Fix planned for pip 25.3 (not yet released). Low risk: requires attacker-controlled
69-
# sdist AND Python < 3.11.4. Project uses Python 3.9+ with modern interpreters.
70-
# Review after pip 25.3 release.
71-
# - GHSA-gm62-xv2j-4w53 (CVE-2025-66418): urllib3 decompression chain DoS.
72-
# Fixed in urllib3 2.6.0. Transitive dependency from pip-audit itself.
73-
# Project pins urllib3>=2.6.0 in pyproject.toml.
74-
# - GHSA-2xpw-w6gg-jr37 (CVE-2025-66471): urllib3 highly compressed data handling.
75-
# Fixed in urllib3 2.6.0. Transitive dependency from pip-audit itself.
76-
# Project pins urllib3>=2.6.0 in pyproject.toml.
77108
args:
78109
[
79110
"--desc",
@@ -93,12 +124,14 @@ repos:
93124
- id: detect-secrets
94125
args: ["--baseline", ".secrets.baseline"]
95126

96-
# ============================================================================
97-
# SEMANTIC SECURITY ANALYSIS (replaces basic Bandit)
98-
# Evidence: Testable rulepacks, widely adopted in SAST programs
99-
# ============================================================================
127+
- repo: https://github.com/gitleaks/gitleaks
128+
rev: v8.29.0
129+
hooks:
130+
- id: gitleaks
131+
name: Scan for secrets (gitleaks)
132+
100133
- repo: https://github.com/returntocorp/semgrep
101-
rev: v1.89.0
134+
rev: v1.99.0
102135
hooks:
103136
- id: semgrep
104137
name: semgrep (AST-based security & policy)
@@ -113,8 +146,7 @@ repos:
113146
files: ^src/
114147

115148
# ============================================================================
116-
# DEAD CODE DETECTION (reduces attack surface & maintenance burden)
117-
# Evidence: Direct verification - unused code is measurably wasteful
149+
# DEAD CODE DETECTION
118150
# ============================================================================
119151
- repo: https://github.com/jendrikseipp/vulture
120152
rev: v2.14
@@ -126,9 +158,7 @@ repos:
126158
pass_filenames: false
127159

128160
# ============================================================================
129-
# CODE DUPLICATION DETECTION (reduces maintenance burden & bug propagation)
130-
# Evidence: Studies show duplicated code increases bug density by 2-3x
131-
# Detects copy-pasted code blocks that should be refactored into functions
161+
# CODE DUPLICATION DETECTION
132162
# ============================================================================
133163
- repo: https://github.com/PyCQA/pylint
134164
rev: v4.0.1
@@ -147,29 +177,17 @@ repos:
147177
files: ^src/
148178

149179
# ============================================================================
150-
# LINTING (focused on correctness, not style)
151-
# Using Ruff for speed; flake8 removed to avoid redundancy
152-
# ============================================================================
153-
- repo: https://github.com/astral-sh/ruff-pre-commit
154-
rev: v0.14.0
155-
hooks:
156-
- id: ruff
157-
name: ruff (correctness-focused checks)
158-
args: ["--fix", "--unsafe-fixes"]
159-
160-
# ============================================================================
161-
# SPELL CHECKING (reduces documentation defects)
180+
# SPELL CHECKING
162181
# ============================================================================
163182
- repo: https://github.com/codespell-project/codespell
164183
rev: v2.4.1
165184
hooks:
166185
- id: codespell
167-
args:
168-
["--write-changes", "--ignore-words-list=crate,nd,ser,llm,async,cli,theses,datas"]
186+
args: ["--write-changes", "--ignore-words-list=crate,nd,ser,llm,async,cli,theses,datas"]
169187
exclude: ^(\.git/|\.venv/|venv/)
170188

171189
# ============================================================================
172-
# YAML/JSON LINTING
190+
# YAML LINTING
173191
# ============================================================================
174192
- repo: https://github.com/adrienverge/yamllint
175193
rev: v1.37.1
@@ -182,6 +200,34 @@ repos:
182200
{line-length: {max: 120}, document-start: disable,
183201
indentation: disable, comments: disable}}
184202
203+
# ============================================================================
204+
# SHELL LINTING
205+
# ============================================================================
206+
- repo: https://github.com/scop/pre-commit-shfmt
207+
rev: v3.12.0-2
208+
hooks:
209+
- id: shfmt
210+
name: shfmt (shell script formatting)
211+
args: [-w, -i, '2']
212+
213+
- repo: https://github.com/shellcheck-py/shellcheck-py
214+
rev: v0.11.0.1
215+
hooks:
216+
- id: shellcheck
217+
name: shellcheck (shell script linting)
218+
args: [-x]
219+
220+
# ============================================================================
221+
# MARKDOWN LINTING
222+
# ============================================================================
223+
- repo: https://github.com/igorshubovych/markdownlint-cli
224+
rev: v0.45.0
225+
hooks:
226+
- id: markdownlint
227+
name: Lint Markdown files
228+
args: ['--fix']
229+
files: \.(md|markdown)$
230+
185231
# ============================================================================
186232
# COMMIT MESSAGE QUALITY
187233
# ============================================================================
@@ -190,18 +236,3 @@ repos:
190236
hooks:
191237
- id: commitizen
192238
stages: [commit-msg]
193-
194-
# ============================================================================
195-
# TOOLS DEFERRED TO CI (too slow or complex for pre-commit)
196-
# ============================================================================
197-
# - CodeQL: GitHub-specific, requires workflow setup
198-
# - Pysa: Requires framework-specific taint configuration
199-
# - SonarQube/Cloud: Platform-based, not a hook
200-
# - Radon: No official pre-commit hook, run via pip in CI
201-
# - Hypothesis: Property-based testing, runs with pytest in CI
202-
# - Mutation testing (mutmut/Cosmic Ray): Too slow, CI only
203-
# - Coverage: Measured in CI with pytest-cov
204-
# - Import Linter: Requires project-specific contract definition
205-
# - Atheris/CrossHair: Fuzzing/symbolic execution - CI only
206-
#
207-
# See .github/workflows/ci.yml for integration of these tools

.treemapperignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,38 @@
1+
# Tests and test artifacts
12
tests
3+
.hypothesis
4+
.pytest_cache
5+
.coverage
6+
htmlcov
7+
.treemapperignore
8+
9+
# Build and cache
10+
build
11+
dist
12+
*.egg-info
13+
.mypy_cache
14+
.ruff_cache
15+
__pycache__
16+
17+
# Config files (not code)
18+
.gitignore
19+
.pre-commit-config.yaml
20+
.secrets.baseline
21+
.dockerignore
22+
renovate.json
23+
24+
# Output files
25+
tree.yaml
26+
tree.json
27+
tree.md
28+
tree.txt
29+
.markdownlintignore
30+
31+
# Other
32+
LICENSE
33+
README.md
34+
CLAUDE.md
35+
*.bbl
36+
*.bib
37+
*.tmp
38+
.claude

0 commit comments

Comments
 (0)