crackerjack 0.26.0__tar.gz → 0.27.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of crackerjack might be problematic. Click here for more details.
- {crackerjack-0.26.0/crackerjack → crackerjack-0.27.1}/.gitignore +11 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/.pre-commit-config-ai.yaml +54 -34
- crackerjack-0.27.1/.pre-commit-config-fast.yaml +69 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/.pre-commit-config.yaml +11 -4
- {crackerjack-0.26.0 → crackerjack-0.27.1}/CLAUDE.md +234 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/PKG-INFO +2 -1
- {crackerjack-0.26.0 → crackerjack-0.27.1}/RULES.md +3 -2
- {crackerjack-0.26.0 → crackerjack-0.27.1/crackerjack}/.gitignore +11 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/crackerjack/.pre-commit-config-ai.yaml +54 -34
- {crackerjack-0.26.0 → crackerjack-0.27.1}/crackerjack/.pre-commit-config.yaml +11 -4
- {crackerjack-0.26.0 → crackerjack-0.27.1}/crackerjack/__main__.py +25 -3
- crackerjack-0.27.1/crackerjack/crackerjack.py +2753 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/crackerjack/interactive.py +1 -1
- {crackerjack-0.26.0 → crackerjack-0.27.1}/crackerjack/py313.py +2 -2
- {crackerjack-0.26.0 → crackerjack-0.27.1/crackerjack}/pyproject.toml +52 -32
- {crackerjack-0.26.0/crackerjack → crackerjack-0.27.1}/pyproject.toml +52 -32
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/test_crackerjack.py +23 -12
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/test_crackerjack_runner.py +2 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/test_structured_errors.py +3 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/uv.lock +12 -1
- crackerjack-0.26.0/crackerjack/crackerjack.py +0 -1276
- {crackerjack-0.26.0 → crackerjack-0.27.1}/.envrc +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/.github/FUNDING.yml +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/.libcst.codemod.yaml +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/LICENSE +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/README-AI-AGENT.md +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/README.md +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/crackerjack/.libcst.codemod.yaml +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/crackerjack/.pdm.toml +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/crackerjack/__init__.py +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/crackerjack/errors.py +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/TESTING.md +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/__init__.py +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/conftest.py +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/data/comments_sample.txt +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/data/docstrings_sample.txt +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/data/expected_comments_sample.txt +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/data/init.py +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/test_errors.py +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/test_interactive.py +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/test_interactive_run.py +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/test_main.py +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/test_multiline_functions.py +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/test_py313_advanced.py +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/test_py313_features.py +0 -0
- {crackerjack-0.26.0 → crackerjack-0.27.1}/tests/test_pytest_features.py +0 -0
|
@@ -18,3 +18,14 @@
|
|
|
18
18
|
/coverage.json
|
|
19
19
|
/test-results.xml
|
|
20
20
|
/.coverage
|
|
21
|
+
|
|
22
|
+
# AI agent output files
|
|
23
|
+
/hooks-analysis.json
|
|
24
|
+
/quality-metrics.json
|
|
25
|
+
/project-structure.json
|
|
26
|
+
/error-context.json
|
|
27
|
+
/ai-agent-summary.json
|
|
28
|
+
/bandit-report.json
|
|
29
|
+
|
|
30
|
+
# Autotyping cache
|
|
31
|
+
.autotyping-cache/
|
|
@@ -1,105 +1,112 @@
|
|
|
1
|
+
# AI-optimized pre-commit hooks for comprehensive analysis and structured output
|
|
2
|
+
# Designed for AI agent workflows with enhanced reporting and metrics
|
|
3
|
+
|
|
1
4
|
repos:
|
|
2
|
-
# File
|
|
5
|
+
# Group 1: File Structure & Format Validation (parallel-safe, fast)
|
|
3
6
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
4
7
|
rev: v5.0.0
|
|
5
8
|
hooks:
|
|
6
9
|
- id: trailing-whitespace
|
|
7
10
|
name: trailing-whitespace
|
|
8
|
-
|
|
11
|
+
stages: [pre-commit]
|
|
9
12
|
- id: end-of-file-fixer
|
|
10
13
|
name: end-of-file-fixer
|
|
11
|
-
|
|
14
|
+
stages: [pre-commit]
|
|
12
15
|
- id: check-yaml
|
|
13
16
|
name: check-yaml
|
|
14
|
-
|
|
17
|
+
stages: [pre-commit]
|
|
15
18
|
- id: check-toml
|
|
16
19
|
name: check-toml
|
|
17
|
-
|
|
20
|
+
stages: [pre-commit]
|
|
18
21
|
- id: check-added-large-files
|
|
19
22
|
name: check-added-large-files
|
|
20
|
-
|
|
23
|
+
stages: [pre-commit]
|
|
21
24
|
|
|
25
|
+
# Group 2: Project Configuration Management
|
|
22
26
|
- repo: https://github.com/abravalheri/validate-pyproject
|
|
23
27
|
rev: v0.24.1
|
|
24
28
|
hooks:
|
|
25
29
|
- id: validate-pyproject
|
|
26
|
-
|
|
30
|
+
stages: [pre-commit]
|
|
27
31
|
|
|
28
32
|
- repo: https://github.com/tox-dev/pyproject-fmt
|
|
29
33
|
rev: "v2.6.0"
|
|
30
34
|
hooks:
|
|
31
35
|
- id: pyproject-fmt
|
|
32
36
|
args: ["-n"]
|
|
33
|
-
|
|
37
|
+
stages: [pre-commit]
|
|
34
38
|
|
|
35
|
-
# Package management - once structure is valid
|
|
36
39
|
- repo: https://github.com/astral-sh/uv-pre-commit
|
|
37
|
-
rev: 0.7.
|
|
40
|
+
rev: 0.7.21
|
|
38
41
|
hooks:
|
|
39
42
|
- id: uv-lock
|
|
40
43
|
files: ^pyproject\.toml$
|
|
41
|
-
|
|
44
|
+
stages: [pre-commit]
|
|
42
45
|
|
|
43
|
-
#
|
|
46
|
+
# Group 3: Security (early detection, critical)
|
|
44
47
|
- repo: https://github.com/Yelp/detect-secrets
|
|
45
48
|
rev: v1.5.0
|
|
46
49
|
hooks:
|
|
47
50
|
- id: detect-secrets
|
|
48
51
|
exclude: 'uv\.lock|pyproject\.toml|tests/.*|docs/.*|.*\.md'
|
|
49
|
-
|
|
52
|
+
stages: [pre-commit]
|
|
50
53
|
|
|
51
|
-
# Code
|
|
54
|
+
# Group 4: Code Quality & Style (fast formatting)
|
|
52
55
|
- repo: https://github.com/codespell-project/codespell
|
|
53
56
|
rev: v2.4.1
|
|
54
57
|
hooks:
|
|
55
58
|
- id: codespell
|
|
56
|
-
verbose: true
|
|
57
59
|
additional_dependencies:
|
|
58
60
|
- tomli
|
|
61
|
+
stages: [pre-commit]
|
|
59
62
|
|
|
60
63
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
61
|
-
rev: v0.12.
|
|
64
|
+
rev: v0.12.3
|
|
62
65
|
hooks:
|
|
63
66
|
- id: ruff-check
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
args: ["--output-format=json", "--fix"]
|
|
68
|
+
stages: [pre-commit]
|
|
66
69
|
- id: ruff-format
|
|
67
|
-
|
|
70
|
+
stages: [pre-commit]
|
|
68
71
|
|
|
69
72
|
- repo: https://github.com/executablebooks/mdformat
|
|
70
|
-
rev: 0.7.
|
|
73
|
+
rev: 0.7.22
|
|
71
74
|
hooks:
|
|
72
75
|
- id: mdformat
|
|
73
76
|
additional_dependencies:
|
|
74
77
|
- mdformat-ruff
|
|
78
|
+
stages: [pre-commit]
|
|
75
79
|
|
|
76
|
-
#
|
|
80
|
+
# Group 5: Static Analysis (comprehensive, slower)
|
|
77
81
|
- repo: https://github.com/jendrikseipp/vulture
|
|
78
82
|
rev: 'v2.14'
|
|
79
83
|
hooks:
|
|
80
84
|
- id: vulture
|
|
81
|
-
|
|
85
|
+
args: ["--verbose"]
|
|
86
|
+
stages: [pre-commit]
|
|
82
87
|
|
|
83
88
|
- repo: https://github.com/fredrikaverpil/creosote
|
|
84
89
|
rev: v4.0.3
|
|
85
90
|
hooks:
|
|
86
91
|
- id: creosote
|
|
87
|
-
|
|
92
|
+
args: ["--verbose"]
|
|
93
|
+
stages: [pre-commit]
|
|
88
94
|
|
|
89
95
|
- repo: https://github.com/rohaquinlop/complexipy-pre-commit
|
|
90
96
|
rev: v3.0.0
|
|
91
97
|
hooks:
|
|
92
98
|
- id: complexipy
|
|
93
|
-
args: ["-d", "low", "
|
|
94
|
-
|
|
99
|
+
args: ["-d", "low", "--output", "complexipy.json"]
|
|
100
|
+
stages: [pre-commit]
|
|
95
101
|
|
|
96
102
|
- repo: https://github.com/dosisod/refurb
|
|
97
103
|
rev: v2.1.0
|
|
98
104
|
hooks:
|
|
99
105
|
- id: refurb
|
|
100
|
-
|
|
106
|
+
args: ["--quiet"]
|
|
107
|
+
stages: [pre-commit]
|
|
101
108
|
|
|
102
|
-
#
|
|
109
|
+
# Group 6: Type Checking & Enhancement (most expensive)
|
|
103
110
|
- repo: local
|
|
104
111
|
hooks:
|
|
105
112
|
- id: autotyping
|
|
@@ -109,25 +116,38 @@ repos:
|
|
|
109
116
|
- --aggressive
|
|
110
117
|
- --only-without-imports
|
|
111
118
|
- --guess-common-names
|
|
119
|
+
- --cache-dir=.autotyping-cache
|
|
120
|
+
- --workers=4
|
|
121
|
+
- --max-line-length=88
|
|
122
|
+
- --exclude-name=test_*,conftest
|
|
112
123
|
- crackerjack
|
|
113
124
|
types_or: [ python, pyi ]
|
|
114
125
|
language: python
|
|
115
|
-
files:
|
|
116
|
-
|
|
126
|
+
files: ^crackerjack/.*\.py$
|
|
127
|
+
stages: [pre-commit]
|
|
117
128
|
additional_dependencies:
|
|
118
129
|
- autotyping>=24.3.0
|
|
119
130
|
- libcst>=1.1.0
|
|
120
131
|
|
|
121
132
|
- repo: https://github.com/PyCQA/bandit
|
|
122
|
-
rev: '1.8.
|
|
133
|
+
rev: '1.8.6'
|
|
123
134
|
hooks:
|
|
124
135
|
- id: bandit
|
|
125
|
-
args: ["-c", "pyproject.toml", "
|
|
126
|
-
|
|
136
|
+
args: ["-c", "pyproject.toml", "-f", "json", "-o", "bandit-report.json", "-r", "-ll"]
|
|
137
|
+
stages: [pre-commit]
|
|
127
138
|
|
|
128
139
|
- repo: https://github.com/RobertCraigie/pyright-python
|
|
129
|
-
rev: v1.1.
|
|
140
|
+
rev: v1.1.403
|
|
130
141
|
hooks:
|
|
131
142
|
- id: pyright
|
|
132
|
-
verbose: true
|
|
133
143
|
args: ["--outputjson"]
|
|
144
|
+
stages: [pre-commit]
|
|
145
|
+
|
|
146
|
+
# Group 7: Documentation & Security Enhancement (AI-specific)
|
|
147
|
+
# pydocstyle temporarily disabled - conflicts with code cleaning functionality
|
|
148
|
+
# - repo: https://github.com/PyCQA/pydocstyle
|
|
149
|
+
# rev: 6.3.0
|
|
150
|
+
# hooks:
|
|
151
|
+
# - id: pydocstyle
|
|
152
|
+
# args: ["--config=pyproject.toml"]
|
|
153
|
+
# stages: [pre-commit]
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# Fast pre-commit hooks for development workflow (target: <5s total)
|
|
2
|
+
repos:
|
|
3
|
+
# Tier 1: Basic structure validation (1.5s)
|
|
4
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
5
|
+
rev: v5.0.0
|
|
6
|
+
hooks:
|
|
7
|
+
- id: trailing-whitespace
|
|
8
|
+
name: trailing-whitespace
|
|
9
|
+
stages: [pre-commit]
|
|
10
|
+
- id: end-of-file-fixer
|
|
11
|
+
name: end-of-file-fixer
|
|
12
|
+
stages: [pre-commit]
|
|
13
|
+
- id: check-yaml
|
|
14
|
+
name: check-yaml
|
|
15
|
+
stages: [pre-commit]
|
|
16
|
+
- id: check-toml
|
|
17
|
+
name: check-toml
|
|
18
|
+
stages: [pre-commit]
|
|
19
|
+
- id: check-added-large-files
|
|
20
|
+
name: check-added-large-files
|
|
21
|
+
stages: [pre-commit]
|
|
22
|
+
|
|
23
|
+
- repo: https://github.com/tox-dev/pyproject-fmt
|
|
24
|
+
rev: "v2.6.0"
|
|
25
|
+
hooks:
|
|
26
|
+
- id: pyproject-fmt
|
|
27
|
+
args: ["-n"]
|
|
28
|
+
stages: [pre-commit]
|
|
29
|
+
|
|
30
|
+
# Tier 2: Package management (0.5s)
|
|
31
|
+
- repo: https://github.com/astral-sh/uv-pre-commit
|
|
32
|
+
rev: 0.7.21
|
|
33
|
+
hooks:
|
|
34
|
+
- id: uv-lock
|
|
35
|
+
files: ^pyproject\.toml$
|
|
36
|
+
stages: [pre-commit]
|
|
37
|
+
|
|
38
|
+
# Tier 3: Security (early detection) (1s)
|
|
39
|
+
- repo: https://github.com/Yelp/detect-secrets
|
|
40
|
+
rev: v1.5.0
|
|
41
|
+
hooks:
|
|
42
|
+
- id: detect-secrets
|
|
43
|
+
exclude: 'uv\.lock|pyproject\.toml|tests/.*|docs/.*|.*\.md'
|
|
44
|
+
stages: [pre-commit]
|
|
45
|
+
|
|
46
|
+
# Tier 4: Quick formatting (1.5s)
|
|
47
|
+
- repo: https://github.com/codespell-project/codespell
|
|
48
|
+
rev: v2.4.1
|
|
49
|
+
hooks:
|
|
50
|
+
- id: codespell
|
|
51
|
+
additional_dependencies:
|
|
52
|
+
- tomli
|
|
53
|
+
stages: [pre-commit]
|
|
54
|
+
|
|
55
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
56
|
+
rev: v0.12.3
|
|
57
|
+
hooks:
|
|
58
|
+
- id: ruff-check
|
|
59
|
+
stages: [pre-commit]
|
|
60
|
+
- id: ruff-format
|
|
61
|
+
stages: [pre-commit]
|
|
62
|
+
|
|
63
|
+
- repo: https://github.com/executablebooks/mdformat
|
|
64
|
+
rev: 0.7.22
|
|
65
|
+
hooks:
|
|
66
|
+
- id: mdformat
|
|
67
|
+
additional_dependencies:
|
|
68
|
+
- mdformat-ruff
|
|
69
|
+
stages: [pre-commit]
|
|
@@ -55,29 +55,33 @@ repos:
|
|
|
55
55
|
additional_dependencies:
|
|
56
56
|
- mdformat-ruff
|
|
57
57
|
|
|
58
|
-
# Code quality tier 2 - analysis
|
|
58
|
+
# Code quality tier 2 - analysis (moved to pre-push for performance)
|
|
59
59
|
- repo: https://github.com/jendrikseipp/vulture
|
|
60
60
|
rev: 'v2.14'
|
|
61
61
|
hooks:
|
|
62
62
|
- id: vulture
|
|
63
|
+
stages: [pre-push, manual]
|
|
63
64
|
|
|
64
65
|
- repo: https://github.com/fredrikaverpil/creosote
|
|
65
66
|
rev: v4.0.3
|
|
66
67
|
hooks:
|
|
67
68
|
- id: creosote
|
|
69
|
+
stages: [pre-push, manual]
|
|
68
70
|
|
|
69
71
|
- repo: https://github.com/rohaquinlop/complexipy-pre-commit
|
|
70
72
|
rev: v3.0.0
|
|
71
73
|
hooks:
|
|
72
74
|
- id: complexipy
|
|
73
75
|
args: ["-d", "low"]
|
|
76
|
+
stages: [pre-push, manual]
|
|
74
77
|
|
|
75
78
|
- repo: https://github.com/dosisod/refurb
|
|
76
79
|
rev: v2.1.0
|
|
77
80
|
hooks:
|
|
78
81
|
- id: refurb
|
|
82
|
+
stages: [pre-push, manual]
|
|
79
83
|
|
|
80
|
-
# Code quality tier 3 - thorough checks
|
|
84
|
+
# Code quality tier 3 - thorough checks (moved to pre-push for performance)
|
|
81
85
|
- repo: local
|
|
82
86
|
hooks:
|
|
83
87
|
- id: autotyping
|
|
@@ -90,7 +94,8 @@ repos:
|
|
|
90
94
|
- crackerjack
|
|
91
95
|
types_or: [ python, pyi ]
|
|
92
96
|
language: python
|
|
93
|
-
files:
|
|
97
|
+
files: ^crackerjack/.*\.py$
|
|
98
|
+
stages: [pre-push, manual]
|
|
94
99
|
additional_dependencies:
|
|
95
100
|
- autotyping>=24.3.0
|
|
96
101
|
- libcst>=1.1.0
|
|
@@ -99,9 +104,11 @@ repos:
|
|
|
99
104
|
rev: '1.8.6'
|
|
100
105
|
hooks:
|
|
101
106
|
- id: bandit
|
|
102
|
-
args: ["-c", "pyproject.toml"]
|
|
107
|
+
args: ["-c", "pyproject.toml", "-r", "-ll"]
|
|
108
|
+
stages: [pre-push, manual]
|
|
103
109
|
|
|
104
110
|
- repo: https://github.com/RobertCraigie/pyright-python
|
|
105
111
|
rev: v1.1.403
|
|
106
112
|
hooks:
|
|
107
113
|
- id: pyright
|
|
114
|
+
stages: [pre-push, manual]
|
|
@@ -44,6 +44,12 @@ python -m crackerjack -r
|
|
|
44
44
|
|
|
45
45
|
# Enable verbose output
|
|
46
46
|
python -m crackerjack -v
|
|
47
|
+
|
|
48
|
+
# Run with fast pre-commit mode (default)
|
|
49
|
+
python -m crackerjack
|
|
50
|
+
|
|
51
|
+
# Run with comprehensive pre-commit checks
|
|
52
|
+
python -m crackerjack --comprehensive
|
|
47
53
|
```
|
|
48
54
|
|
|
49
55
|
### Testing
|
|
@@ -80,6 +86,69 @@ python -m crackerjack -t --benchmark-regression --benchmark-regression-threshold
|
|
|
80
86
|
python -m crackerjack --ai-agent -t
|
|
81
87
|
```
|
|
82
88
|
|
|
89
|
+
### Running a Single Test
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Run a specific test file
|
|
93
|
+
uv run pytest tests/test_crackerjack.py
|
|
94
|
+
|
|
95
|
+
# Run a specific test function
|
|
96
|
+
uv run pytest tests/test_crackerjack.py::test_code_cleaner_remove_docstrings
|
|
97
|
+
|
|
98
|
+
# Run tests matching a pattern
|
|
99
|
+
uv run pytest -k "test_code_cleaner"
|
|
100
|
+
|
|
101
|
+
# Run with verbose output
|
|
102
|
+
uv run pytest -v tests/test_crackerjack.py
|
|
103
|
+
|
|
104
|
+
# Run with no parallel execution
|
|
105
|
+
uv run pytest -n 0 tests/test_crackerjack.py
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Benchmark Testing Strategy
|
|
109
|
+
|
|
110
|
+
Benchmarks should be run automatically at strategic intervals to catch performance regressions early:
|
|
111
|
+
|
|
112
|
+
#### **Recommended Frequency:**
|
|
113
|
+
|
|
114
|
+
**🚀 Critical Scenarios (Always Run Benchmarks):**
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Before major releases
|
|
118
|
+
python -m crackerjack -t --benchmark-regression --benchmark-regression-threshold=5.0
|
|
119
|
+
|
|
120
|
+
# After significant algorithmic changes (manual trigger)
|
|
121
|
+
python -m crackerjack -t --benchmark --ai-agent
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**📊 Regular Monitoring (Weekly):**
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Weekly automated benchmark monitoring
|
|
128
|
+
python -m crackerjack -t --benchmark-regression --benchmark-regression-threshold=10.0
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**🎲 Random Sampling (10% of commits):**
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Stochastic performance monitoring (implement in CI/CD)
|
|
135
|
+
# Run on ~10% of commits to catch gradual performance drift
|
|
136
|
+
python -m crackerjack -t --benchmark
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
#### **When to Run Benchmarks:**
|
|
140
|
+
|
|
141
|
+
1. **Always:** Before releases, after performance-critical changes
|
|
142
|
+
1. **Weekly:** Automated monitoring for performance drift detection
|
|
143
|
+
1. **Randomly:** 10% of commits for stochastic performance sampling
|
|
144
|
+
1. **On-demand:** When investigating performance issues
|
|
145
|
+
|
|
146
|
+
#### **Benchmark Thresholds:**
|
|
147
|
+
|
|
148
|
+
- **5% regression threshold:** For release candidates and critical changes
|
|
149
|
+
- **10% regression threshold:** For regular monitoring and development
|
|
150
|
+
- **Custom thresholds:** Adjust based on specific performance requirements
|
|
151
|
+
|
|
83
152
|
### Linting and Code Quality
|
|
84
153
|
|
|
85
154
|
```bash
|
|
@@ -238,6 +307,7 @@ Crackerjack follows a single-file architecture for simplicity and maintainabilit
|
|
|
238
307
|
| `-v` | `--verbose` | Enable verbose output |
|
|
239
308
|
| `-s` | `--skip-hooks` | Skip pre-commit hooks |
|
|
240
309
|
| `-n` | `--no-config-updates` | Skip configuration updates |
|
|
310
|
+
| | `--comprehensive` | Use comprehensive pre-commit hooks (slower but thorough) |
|
|
241
311
|
|
|
242
312
|
### Version Management
|
|
243
313
|
|
|
@@ -263,6 +333,7 @@ Crackerjack follows a single-file architecture for simplicity and maintainabilit
|
|
|
263
333
|
1. **Code Style**: Follow the Crackerjack style guide (see RULES.md):
|
|
264
334
|
|
|
265
335
|
- **Target Python 3.13+** - Use latest Python features
|
|
336
|
+
- **NO DOCSTRINGS** - The codebase standard is to have no docstrings (they are removed by the `-x` flag)
|
|
266
337
|
- Use static typing throughout with modern syntax (import typing as `t`)
|
|
267
338
|
- Use pathlib for file operations
|
|
268
339
|
- Prefer Protocol over ABC
|
|
@@ -302,6 +373,13 @@ When generating code, AI assistants MUST follow these standards to ensure compli
|
|
|
302
373
|
|
|
303
374
|
**IMPORTANT: Target Python 3.13+** - All code must be compatible with Python 3.13 or newer. Use the latest Python features and syntax.
|
|
304
375
|
|
|
376
|
+
**CRITICAL: NO DOCSTRINGS** - Crackerjack's standard is to have NO docstrings in the package code. The `-x` (clean) flag removes all docstrings to reduce noise and keep the codebase clean. When generating code:
|
|
377
|
+
|
|
378
|
+
- **DO NOT** add docstrings to functions, methods, classes, or modules
|
|
379
|
+
- **DO NOT** add triple-quoted string documentation anywhere
|
|
380
|
+
- Use inline comments sparingly only when absolutely necessary for complex logic
|
|
381
|
+
- The codebase prioritizes clean, self-documenting code over documentation strings
|
|
382
|
+
|
|
305
383
|
### Refurb Standards (Modern Python Patterns up to 3.12)
|
|
306
384
|
|
|
307
385
|
**Use modern syntax and built-ins:**
|
|
@@ -743,7 +821,163 @@ This enhancement ensures that the code cleaner (`-x` flag) can handle edge cases
|
|
|
743
821
|
|
|
744
822
|
**Never skip crackerjack verification** - it's the project's standard quality gate.
|
|
745
823
|
|
|
824
|
+
## Pre-commit Hook Maintenance
|
|
825
|
+
|
|
826
|
+
### Monthly Maintenance Tasks
|
|
827
|
+
|
|
828
|
+
1. **Update hook versions**: Run `pre-commit autoupdate` to get latest versions
|
|
829
|
+
1. **Review security advisories**: Check for vulnerabilities in hook dependencies
|
|
830
|
+
1. **Monitor performance**: Watch for hooks taking longer than expected
|
|
831
|
+
1. **Check deprecation warnings**: Address any warnings from tools like autotyping
|
|
832
|
+
|
|
833
|
+
### Performance Optimization
|
|
834
|
+
|
|
835
|
+
- **Autotyping monitoring**: Currently 7.3s runtime (highest cost hook)
|
|
836
|
+
- **Grouping strategy**: Consider grouping related hooks for better failure reporting
|
|
837
|
+
- **CI/CD integration**: Move expensive operations to pre-push hooks for CI/CD
|
|
838
|
+
|
|
839
|
+
### Security Maintenance
|
|
840
|
+
|
|
841
|
+
- **Regular vulnerability scanning**: Use `pre-commit autoupdate` with caution on untrusted hooks
|
|
842
|
+
- **Source verification**: Ensure all hooks come from trusted, actively maintained repositories
|
|
843
|
+
- **Dependency monitoring**: Watch for security issues in hook dependencies via Snyk or similar tools
|
|
844
|
+
|
|
845
|
+
### Quality Metrics to Monitor
|
|
846
|
+
|
|
847
|
+
- Test coverage should remain ≥90%
|
|
848
|
+
- Zero security vulnerabilities (Bandit)
|
|
849
|
+
- Zero type errors (Pyright)
|
|
850
|
+
- Zero dead code (Vulture)
|
|
851
|
+
- Zero unused dependencies (Creosote)
|
|
852
|
+
- Low complexity maintained (Complexipy)
|
|
853
|
+
|
|
854
|
+
### Hook Performance Optimization (Enhanced July 2025)
|
|
855
|
+
|
|
856
|
+
**🚀 Fast Development Mode (Default):**
|
|
857
|
+
|
|
858
|
+
- Uses `.pre-commit-config-fast.yaml` for regular commits
|
|
859
|
+
- Target execution time: \<5 seconds
|
|
860
|
+
- Includes: structure validation, formatting, basic security checks
|
|
861
|
+
- Command: `python -m crackerjack` (default behavior)
|
|
862
|
+
|
|
863
|
+
**🔍 Comprehensive Analysis Mode:**
|
|
864
|
+
|
|
865
|
+
- Uses `.pre-commit-config.yaml` for thorough analysis
|
|
866
|
+
- Target execution time: \<30 seconds
|
|
867
|
+
- Includes: all checks + type analysis, complexity, dead code detection
|
|
868
|
+
- Command: `python -m crackerjack --comprehensive`
|
|
869
|
+
|
|
870
|
+
**📦 Pre-push Hooks:**
|
|
871
|
+
|
|
872
|
+
- Expensive operations automatically moved to pre-push stage
|
|
873
|
+
- Runs comprehensive analysis before pushing changes
|
|
874
|
+
- Prevents performance bottlenecks during development
|
|
875
|
+
- Install: `pre-commit install --hook-type pre-push`
|
|
876
|
+
|
|
877
|
+
### Hook Configuration Status (Last Audit: July 2025)
|
|
878
|
+
|
|
879
|
+
✅ All hooks current and secure
|
|
880
|
+
✅ Performance optimized with dual-mode configuration
|
|
881
|
+
✅ Fast mode: \<5s execution time
|
|
882
|
+
✅ Comprehensive mode: \<30s execution time
|
|
883
|
+
✅ 90% test coverage achieved
|
|
884
|
+
✅ 0 security vulnerabilities found
|
|
885
|
+
|
|
746
886
|
## Development Memories
|
|
747
887
|
|
|
748
888
|
- Non-critical type errors are still errors that need to be fixed to pass crackerjack validation
|
|
749
889
|
- test directory files need to pass pyright tests as well in order for crackerjack to successfully complete
|
|
890
|
+
|
|
891
|
+
## AI Agent Integration
|
|
892
|
+
|
|
893
|
+
When running with `--ai-agent` flag, Crackerjack produces structured output optimized for AI assistants:
|
|
894
|
+
|
|
895
|
+
### Generated Files
|
|
896
|
+
|
|
897
|
+
- **`test-results.xml`**: JUnit XML format test results with detailed test outcomes
|
|
898
|
+
- **`coverage.json`**: JSON coverage report with line-by-line coverage data
|
|
899
|
+
- **`benchmark.json`**: Benchmark results in JSON format (when benchmarks are run)
|
|
900
|
+
- **`ai-agent-summary.json`**: Summary of the entire run with status and actions performed
|
|
901
|
+
|
|
902
|
+
### Example AI-Optimized Commands
|
|
903
|
+
|
|
904
|
+
```bash
|
|
905
|
+
# Run tests with structured output for AI analysis
|
|
906
|
+
python -m crackerjack --ai-agent -t
|
|
907
|
+
|
|
908
|
+
# Run full workflow with AI output
|
|
909
|
+
python -m crackerjack --ai-agent -a patch
|
|
910
|
+
|
|
911
|
+
# Run benchmarks with AI output
|
|
912
|
+
python -m crackerjack --ai-agent -t --benchmark
|
|
913
|
+
```
|
|
914
|
+
|
|
915
|
+
See README-AI-AGENT.md for detailed information about AI agent integration.
|
|
916
|
+
|
|
917
|
+
## Test Execution Details
|
|
918
|
+
|
|
919
|
+
### Test Configuration (pytest.ini_options)
|
|
920
|
+
|
|
921
|
+
- **asyncio_mode**: "auto" - Automatic asyncio test detection and handling
|
|
922
|
+
- **testpaths**: ["tests", "crackerjack"] - Directories to search for tests
|
|
923
|
+
- **timeout**: 300 seconds default per test
|
|
924
|
+
- **timeout_method**: "thread" - Uses thread-based timeout mechanism
|
|
925
|
+
- **coverage**: Configured with --cov=crackerjack --cov-fail-under=42
|
|
926
|
+
|
|
927
|
+
### Special Test Markers
|
|
928
|
+
|
|
929
|
+
- **unit**: Unit tests
|
|
930
|
+
- **benchmark**: Benchmark tests (disables parallel execution)
|
|
931
|
+
- **integration**: Integration tests
|
|
932
|
+
- **no_leaks**: Detect asyncio task leaks, thread leaks, and event loop blocking
|
|
933
|
+
|
|
934
|
+
### Test Parallelization
|
|
935
|
+
|
|
936
|
+
Tests run in parallel by default using pytest-xdist. The number of workers is automatically determined based on:
|
|
937
|
+
|
|
938
|
+
- Project size (small/medium/large)
|
|
939
|
+
- Available CPU cores
|
|
940
|
+
- Benchmark mode (disables parallelization)
|
|
941
|
+
- User-specified `--test-workers` option
|
|
942
|
+
|
|
943
|
+
### Benchmark Testing
|
|
944
|
+
|
|
945
|
+
When running benchmarks:
|
|
946
|
+
|
|
947
|
+
- Parallel execution is automatically disabled
|
|
948
|
+
- pytest-benchmark plugin is configured with optimized settings
|
|
949
|
+
- Results can be compared against previous runs for regression detection
|
|
950
|
+
- Benchmark results are saved in JSON format when using `--ai-agent`
|
|
951
|
+
|
|
952
|
+
## Pre-commit Hook Configurations
|
|
953
|
+
|
|
954
|
+
### Fast Mode (.pre-commit-config-fast.yaml)
|
|
955
|
+
|
|
956
|
+
Optimized for development speed (\<5s):
|
|
957
|
+
|
|
958
|
+
- Basic structure validation
|
|
959
|
+
- UV lock file updates
|
|
960
|
+
- Security checks (detect-secrets)
|
|
961
|
+
- Quick formatting (codespell, ruff)
|
|
962
|
+
- Markdown formatting (mdformat with ruff integration)
|
|
963
|
+
|
|
964
|
+
### Comprehensive Mode (.pre-commit-config.yaml)
|
|
965
|
+
|
|
966
|
+
Full analysis suite (\<30s):
|
|
967
|
+
|
|
968
|
+
- All fast mode checks
|
|
969
|
+
- Type checking (pyright)
|
|
970
|
+
- Code modernization (refurb)
|
|
971
|
+
- Security scanning (bandit)
|
|
972
|
+
- Dead code detection (vulture)
|
|
973
|
+
- Unused dependency detection (creosote)
|
|
974
|
+
- Code complexity analysis (complexipy)
|
|
975
|
+
- Automatic type annotation (autotyping)
|
|
976
|
+
|
|
977
|
+
### Pre-push Hooks
|
|
978
|
+
|
|
979
|
+
For expensive operations that should run before pushing:
|
|
980
|
+
|
|
981
|
+
- Install with: `pre-commit install --hook-type pre-push`
|
|
982
|
+
- Runs comprehensive analysis automatically
|
|
983
|
+
- Prevents pushing code that doesn't meet quality standards
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crackerjack
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.27.1
|
|
4
4
|
Summary: Crackerjack: code quality toolkit
|
|
5
5
|
Project-URL: documentation, https://github.com/lesleslie/crackerjack
|
|
6
6
|
Project-URL: homepage, https://github.com/lesleslie/crackerjack
|
|
@@ -23,6 +23,7 @@ Classifier: Topic :: Software Development :: Testing
|
|
|
23
23
|
Classifier: Topic :: Utilities
|
|
24
24
|
Classifier: Typing :: Typed
|
|
25
25
|
Requires-Python: >=3.13
|
|
26
|
+
Requires-Dist: aiofiles>=24.1
|
|
26
27
|
Requires-Dist: autotyping>=24.9
|
|
27
28
|
Requires-Dist: hatchling>=1.25
|
|
28
29
|
Requires-Dist: keyring>=25.6
|
|
@@ -23,9 +23,10 @@
|
|
|
23
23
|
- **Clean Code Architecture**
|
|
24
24
|
|
|
25
25
|
- Write modular functions that do one thing well
|
|
26
|
-
-
|
|
26
|
+
- **NO DOCSTRINGS**: Never add docstrings to any code - the codebase standard is to have no docstrings (they are automatically removed by the `-x` flag)
|
|
27
|
+
- Avoid unnecessary line comments - use them sparingly only for complex logic
|
|
27
28
|
- Use protocols (`t.Protocol`) instead of abstract base classes
|
|
28
|
-
- Choose clear, descriptive variable and function names
|
|
29
|
+
- Choose clear, descriptive variable and function names that make the code self-documenting
|
|
29
30
|
|
|
30
31
|
- **Code Organization**
|
|
31
32
|
|
|
@@ -18,3 +18,14 @@
|
|
|
18
18
|
/coverage.json
|
|
19
19
|
/test-results.xml
|
|
20
20
|
/.coverage
|
|
21
|
+
|
|
22
|
+
# AI agent output files
|
|
23
|
+
/hooks-analysis.json
|
|
24
|
+
/quality-metrics.json
|
|
25
|
+
/project-structure.json
|
|
26
|
+
/error-context.json
|
|
27
|
+
/ai-agent-summary.json
|
|
28
|
+
/bandit-report.json
|
|
29
|
+
|
|
30
|
+
# Autotyping cache
|
|
31
|
+
.autotyping-cache/
|