Skip to content

Commit 9f8782a

Browse files
feat(docs): code quality metrics with 5 supporting modules
stats: lines: "+625/-32 (net +593)" files: 3 complexity: "Stable complexity"
1 parent 810b0aa commit 9f8782a

7 files changed

Lines changed: 640 additions & 38 deletions

File tree

CHANGELOG.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,45 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [0.1.10] - 2026-03-29
99

10+
### Fixed
11+
- Fix smart-return-type issues (ticket-86a6c8e7)
12+
- Fix string-concat issues (ticket-6f810ec1)
13+
- Fix magic-numbers issues (ticket-ab903482)
14+
- Fix string-concat issues (ticket-54d6fbf2)
15+
- Fix magic-numbers issues (ticket-2638d3da)
16+
- Fix string-concat issues (ticket-8c41bc33)
17+
- Fix magic-numbers issues (ticket-038ee286)
18+
- Fix magic-numbers issues (ticket-dbc88434)
19+
- Fix smart-return-type issues (ticket-fb791caa)
20+
- Fix magic-numbers issues (ticket-7fc33e6d)
21+
- Fix smart-return-type issues (ticket-d641fe90)
22+
- Fix string-concat issues (ticket-89d38862)
23+
- Fix unused-imports issues (ticket-7bcc8f97)
24+
- Fix magic-numbers issues (ticket-bf655f1d)
25+
- Fix relative-imports issues (ticket-394ebd9d)
26+
- Fix smart-return-type issues (ticket-b442ee8f)
27+
- Fix unused-imports issues (ticket-3ffec5b8)
28+
- Fix magic-numbers issues (ticket-2d4335ce)
29+
- Fix relative-imports issues (ticket-a1d0b702)
30+
- Fix smart-return-type issues (ticket-27b4ad2a)
31+
- Fix duplicate-imports issues (ticket-5ef31250)
32+
- Fix magic-numbers issues (ticket-ac3e6718)
33+
- Fix llm-generated-code issues (ticket-ef1a8284)
34+
- Fix relative-imports issues (ticket-8701a6f7)
35+
- Fix smart-return-type issues (ticket-ae1af87a)
36+
- Fix unused-imports issues (ticket-3fa490f2)
37+
- Fix magic-numbers issues (ticket-2dacd769)
38+
- Fix relative-imports issues (ticket-2ad117e4)
39+
- Fix smart-return-type issues (ticket-ca37f11e)
40+
- Fix string-concat issues (ticket-42b49135)
41+
- Fix magic-numbers issues (ticket-69c69af6)
42+
- Fix string-concat issues (ticket-665a97a5)
43+
- Fix string-concat issues (ticket-9c38e1c3)
44+
- Fix unused-imports issues (ticket-4d883f27)
45+
- Fix llm-generated-code issues (ticket-419f32ba)
46+
47+
## [0.1.10] - 2026-03-29
48+
1049
### Fixed
1150
- Fix string-concat issues (ticket-0967ecb2)
1251
- Fix magic-numbers issues (ticket-5c9c519e)
@@ -76,6 +115,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
76115

77116
## [Unreleased]
78117

118+
## [0.1.48] - 2026-03-29
119+
120+
### Docs
121+
- Update CHANGELOG.md
122+
- Update TODO.md
123+
124+
### Other
125+
- Update planfile.yaml
126+
79127
## [0.1.47] - 2026-03-29
80128

81129
### Docs

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
## AI Cost Tracking
44

55
![PyPI](https://img.shields.io/badge/pypi-costs-blue) ![Version](https://img.shields.io/badge/version-0.1.31-blue) ![Python](https://img.shields.io/badge/python-3.9+-blue) ![License](https://img.shields.io/badge/license-Apache--2.0-green)
6-
![AI Cost](https://img.shields.io/badge/AI%20Cost-$0.78-orange) ![Human Time](https://img.shields.io/badge/Human%20Time-6.2h-blue) ![Model](https://img.shields.io/badge/Model-openrouter%2Fqwen%2Fqwen3--coder--next-lightgrey)
6+
![AI Cost](https://img.shields.io/badge/AI%20Cost-$0.81-orange) ![Human Time](https://img.shields.io/badge/Human%20Time-6.2h-blue) ![Model](https://img.shields.io/badge/Model-openrouter%2Fqwen%2Fqwen3--coder--next-lightgrey)
77

8-
- 🤖 **LLM usage:** $0.7771 (46 commits)
9-
- 👤 **Human dev:** ~$618 (6.2h @ $100/h, 30min dedup)
8+
- 🤖 **LLM usage:** $0.8077 (47 commits)
9+
- 👤 **Human dev:** ~$621 (6.2h @ $100/h, 30min dedup)
1010

1111
Generated on 2026-03-29 using [openrouter/qwen/qwen3-coder-next](https://openrouter.ai/qwen/qwen3-coder-next)
1212

TODO.md

Lines changed: 131 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,147 @@
11
# TODO
22

33
**Generated by:** prefact v0.1.30
4-
**Generated on:** 2026-03-29T16:27:40.925429
5-
**Total issues:** 51 active, 0 completed
4+
**Generated on:** 2026-03-29T18:45:20.202729
5+
**Total issues:** 119 active, 28 completed
66

77
---
88

9+
## ✅ Completed Tasks
10+
11+
- [x] src/costs/__init__.py:4 - Relative import (level=1): '.calculator'
12+
- [x] src/costs/__init__.py:5 - Relative import (level=1): '.models'
13+
- [x] src/costs/calculator.py:92 - String concatenation can be converted to f-string
14+
- [x] src/costs/calculator.py:85 - String concatenation can be converted to f-string
15+
- [x] src/costs/cli.py:12 - Relative import (level=1): '.calculator'
16+
- [x] src/costs/cli.py:13 - Relative import (level=1): '.git_parser'
17+
- [x] src/costs/cli.py:14 - Relative import (level=1): '.models'
18+
- [x] src/costs/cli.py:23 - Function 'version_callback' missing return type (suggested: -> None)
19+
- [x] src/costs/cli.py:30 - Function 'callback' missing return type (suggested: -> None)
20+
- [x] src/costs/cli.py:126 - Function 'analyze' missing return type (suggested: -> None)
21+
- [x] src/costs/cli.py:512 - String concatenation can be converted to f-string
22+
- [x] src/costs/cli.py:509 - String concatenation can be converted to f-string
23+
- [x] src/costs/cli.py:14 - Unused DEFAULT_OPENROUTER_API_KEY imported from models
24+
- [x] src/costs/cli.py:14 - Unused import: 'DEFAULT_OPENROUTER_API_KEY'
25+
- [x] src/costs/cli.py:376 - Duplicate import: 'update_readme_badge' (first at line 297)
26+
- [x] src/costs/cli.py:248 - Duplicate import: 'update_readme_badge' (first at line 297)
27+
- [x] src/costs/cli.py:101 - Magic number: 50 - use named constant
28+
- [x] src/costs/cli.py:103 - Magic number: 50 - use named constant
29+
- [x] src/costs/cli.py:109 - Magic number: 50 - use named constant
30+
- [x] src/costs/cli.py:526 - standalone main function
31+
- [x] src/costs/cli.py:530 - module execution block
32+
- [x] src/costs/metrics.py:9 - Magic number: 15 - use named constant
33+
- [x] src/costs/metrics.py:67 - Magic number: 30 - use named constant
34+
- [x] src/costs/reports/badge.py:89 - String concatenation can be converted to f-string
35+
- [x] src/costs/reports/badge.py:100 - String concatenation can be converted to f-string
36+
- [x] src/costs/reports/badge.py:96 - String concatenation can be converted to f-string
37+
- [x] src/costs/reports/badge.py:88 - Magic number in comparison: 50
38+
- [x] src/costs/reports/badge.py:88 - Magic number: 50 - use named constant
39+
940
## 📋 Current Issues
1041

11-
- [ ] src/costs/__init__.py:4 - Relative import (level=1): '.calculator'
12-
- [ ] src/costs/__init__.py:5 - Relative import (level=1): '.models'
42+
- [ ] examples/01_custom_pricing/main.py:35 - Function 'update_prices_from_api' missing return type (suggested: -> None)
43+
- [ ] examples/01_custom_pricing/main.py:32 - String concatenation can be converted to f-string
44+
- [ ] examples/01_custom_pricing/main.py:27 - Magic number: 500 - use named constant
45+
- [ ] examples/01_tokenizer_basic/main.py:48 - String concatenation can be converted to f-string
46+
- [ ] examples/02_multi_model_cost/main.py:43 - Magic number: 70 - use named constant
47+
- [ ] examples/02_multi_model_cost/main.py:45 - Magic number: 70 - use named constant
48+
- [ ] examples/02_multi_model_cost/main.py:60 - Magic number: 70 - use named constant
49+
- [ ] examples/02_custom_roi/main.py:57 - String concatenation can be converted to f-string
50+
- [ ] examples/02_custom_roi/main.py:14 - Magic number: 150 - use named constant
51+
- [ ] examples/02_custom_roi/main.py:15 - Magic number: 50.0 - use named constant
52+
- [ ] examples/02_custom_roi/main.py:16 - Magic number: 80 - use named constant
53+
- [ ] examples/03_batch_processing/main.py:62 - Magic number: 70 - use named constant
54+
- [ ] examples/03_batch_processing/main.py:64 - Magic number: 70 - use named constant
55+
- [ ] examples/03_batch_processing/main.py:72 - Magic number: 70 - use named constant
56+
- [ ] examples/03_multi_repo/main.py:18 - Function 'analyze_repository' missing return type (suggested: -> Any)
57+
- [ ] examples/03_multi_repo/main.py:63 - Magic number: 70 - use named constant
58+
- [ ] examples/03_multi_repo/main.py:80 - Magic number: 70 - use named constant
59+
- [ ] examples/04_cost_trends/main.py:11 - Function 'generate_sample_data' missing return type (suggested: -> Any)
60+
- [ ] examples/04_cost_trends/main.py:38 - Function 'moving_average' missing return type (suggested: -> Any)
61+
- [ ] examples/04_cost_trends/main.py:57 - String concatenation can be converted to f-string
62+
- [ ] examples/04_cost_trends/main.py:19 - String concatenation can be converted to f-string
63+
- [ ] examples/04_cost_trends/main.py:20 - String concatenation can be converted to f-string
64+
- [ ] examples/04_cost_trends/main.py:4 - Unused defaultdict imported from collections
65+
- [ ] examples/04_cost_trends/main.py:4 - Unused import: 'defaultdict'
66+
- [ ] examples/04_cost_trends/main.py:70 - Magic number: 20.0 - use named constant
67+
- [ ] examples/04_cost_trends/main.py:11 - Magic number: 30 - use named constant
68+
- [ ] examples/04_cost_trends/main.py:31 - Magic number: 30 - use named constant
69+
- [ ] src/costs/__init__.py:3 - Relative import (level=1): '.calculator'
70+
- [ ] src/costs/__init__.py:4 - Relative import (level=1): '.models'
71+
- [ ] src/costs/__init__.py:5 - Relative import (level=1): '.metrics'
72+
- [ ] src/costs/cli.py:10 - Relative import (level=1): '.models'
73+
- [ ] src/costs/cli.py:11 - Relative import (level=1): '.commands.analyze'
74+
- [ ] src/costs/cli.py:12 - Relative import (level=1): '.commands.report'
75+
- [ ] src/costs/cli.py:22 - Function 'version_callback' missing return type (suggested: -> None)
76+
- [ ] src/costs/cli.py:29 - Function 'callback' missing return type (suggested: -> None)
77+
- [ ] src/costs/cli.py:38 - Function 'analyze' missing return type (suggested: -> None)
78+
- [ ] src/costs/cli.py:10 - Unused DEFAULT_MODEL imported from models
79+
- [ ] src/costs/cli.py:10 - Unused import: 'DEFAULT_MODEL'
80+
- [ ] src/costs/cli.py:138 - standalone main function
81+
- [ ] src/costs/cli.py:142 - module execution block
82+
- [ ] src/costs/commands/analyze.py:7 - Relative import (level=2): '..calculator'
83+
- [ ] src/costs/commands/analyze.py:8 - Relative import (level=2): '..git_parser'
84+
- [ ] src/costs/commands/analyze.py:9 - Relative import (level=2): '..models'
85+
- [ ] src/costs/commands/analyze.py:98 - Function 'analyze_logic' missing return type (suggested: -> None)
86+
- [ ] src/costs/commands/analyze.py:1 - Unused import os
87+
- [ ] src/costs/commands/analyze.py:1 - Unused import: 'os'
88+
- [ ] src/costs/commands/analyze.py:74 - Magic number: 50 - use named constant
89+
- [ ] src/costs/commands/analyze.py:76 - Magic number: 50 - use named constant
90+
- [ ] src/costs/commands/analyze.py:82 - Magic number: 50 - use named constant
91+
- [ ] src/costs/commands/badge.py:4 - Relative import (level=2): '..calculator'
92+
- [ ] src/costs/commands/badge.py:5 - Relative import (level=2): '..git_parser'
93+
- [ ] src/costs/commands/badge.py:6 - Relative import (level=2): '..models'
94+
- [ ] src/costs/commands/badge.py:8 - Function 'badge_logic' missing return type (suggested: -> None)
95+
- [ ] src/costs/commands/badge.py:45 - Function 'auto_badge_logic' missing return type (suggested: -> None)
96+
- [ ] src/costs/commands/badge.py:107 - Duplicate import: 'update_readme_badge' (first at line 33)
1397
- [ ] src/costs/calculator.py:5 - Relative import (level=1): '.models'
14-
- [ ] src/costs/calculator.py:92 - String concatenation can be converted to f-string
15-
- [ ] src/costs/calculator.py:85 - String concatenation can be converted to f-string
98+
- [ ] src/costs/calculator.py:6 - Relative import (level=1): '.tokenizers'
99+
- [ ] src/costs/calculator.py:91 - String concatenation can be converted to f-string
100+
- [ ] src/costs/calculator.py:78 - String concatenation can be converted to f-string
101+
- [ ] src/costs/calculator.py:70 - Magic number: 30 - use named constant
102+
- [ ] src/costs/calculator.py:43 - LLM-style docstring in estimate_tokens
103+
- [ ] src/costs/commands/report.py:5 - Relative import (level=2): '..calculator'
104+
- [ ] src/costs/commands/report.py:6 - Relative import (level=2): '..git_parser'
105+
- [ ] src/costs/commands/report.py:44 - Relative import (level=2): '..reports'
106+
- [ ] src/costs/commands/report.py:8 - Function 'report_logic' missing return type (suggested: -> None)
107+
- [ ] src/costs/commands/report.py:1 - Unused import os
108+
- [ ] src/costs/commands/report.py:1 - Unused import: 'os'
109+
- [ ] src/costs/commands/report.py:65 - Magic number: 50 - use named constant
110+
- [ ] src/costs/commands/report.py:67 - Magic number: 50 - use named constant
111+
- [ ] src/costs/commands/report.py:72 - Magic number: 50 - use named constant
112+
- [ ] src/costs/commands/utils.py:5 - Relative import (level=2): '..calculator'
113+
- [ ] src/costs/commands/utils.py:6 - Relative import (level=2): '..git_parser'
114+
- [ ] src/costs/commands/utils.py:7 - Relative import (level=2): '..models'
115+
- [ ] src/costs/commands/utils.py:9 - Function 'estimate_logic' missing return type (suggested: -> None)
116+
- [ ] src/costs/commands/utils.py:32 - Function 'stats_logic' missing return type (suggested: -> None)
117+
- [ ] src/costs/commands/utils.py:60 - Function 'init_logic' missing return type (suggested: -> None)
118+
- [ ] src/costs/commands/utils.py:120 - String concatenation can be converted to f-string
119+
- [ ] src/costs/commands/utils.py:117 - String concatenation can be converted to f-string
120+
- [ ] src/costs/commands/utils.py:50 - Magic number: 40 - use named constant
121+
- [ ] src/costs/commands/utils.py:57 - Magic number: 40 - use named constant
122+
- [ ] src/costs/commands/utils.py:125 - Magic number: 50 - use named constant
16123
- [ ] src/costs/git_parser.py:4 - Unused timedelta imported from datetime
17124
- [ ] src/costs/git_parser.py:4 - Unused import: 'timedelta'
18125
- [ ] src/costs/git_parser.py:37 - LLM-style docstring in is_commit_in_date_range
19-
- [ ] src/costs/cli.py:12 - Relative import (level=1): '.calculator'
20-
- [ ] src/costs/cli.py:13 - Relative import (level=1): '.git_parser'
21-
- [ ] src/costs/cli.py:14 - Relative import (level=1): '.models'
22-
- [ ] src/costs/cli.py:23 - Function 'version_callback' missing return type (suggested: -> None)
23-
- [ ] src/costs/cli.py:30 - Function 'callback' missing return type (suggested: -> None)
24-
- [ ] src/costs/cli.py:126 - Function 'analyze' missing return type (suggested: -> None)
25-
- [ ] src/costs/cli.py:512 - String concatenation can be converted to f-string
26-
- [ ] src/costs/cli.py:509 - String concatenation can be converted to f-string
27-
- [ ] src/costs/cli.py:14 - Unused DEFAULT_OPENROUTER_API_KEY imported from models
28-
- [ ] src/costs/cli.py:14 - Unused import: 'DEFAULT_OPENROUTER_API_KEY'
29-
- [ ] src/costs/cli.py:376 - Duplicate import: 'update_readme_badge' (first at line 297)
30-
- [ ] src/costs/cli.py:248 - Duplicate import: 'update_readme_badge' (first at line 297)
31-
- [ ] src/costs/cli.py:101 - Magic number: 50 - use named constant
32-
- [ ] src/costs/cli.py:103 - Magic number: 50 - use named constant
33-
- [ ] src/costs/cli.py:109 - Magic number: 50 - use named constant
34-
- [ ] src/costs/cli.py:526 - standalone main function
35-
- [ ] src/costs/cli.py:530 - module execution block
126+
- [ ] src/costs/metrics.py:69 - String concatenation can be converted to f-string
127+
- [ ] src/costs/metrics.py:10 - Magic number: 30 - use named constant
128+
- [ ] src/costs/metrics.py:11 - Magic number: 30 - use named constant
129+
- [ ] src/costs/metrics.py:60 - Magic number: 30 - use named constant
36130
- [ ] src/costs/reports/__init__.py:4 - Relative import (level=1): '.base'
37131
- [ ] src/costs/reports/__init__.py:5 - Relative import (level=1): '.markdown'
38132
- [ ] src/costs/reports/__init__.py:6 - Relative import (level=1): '.html'
39-
- [ ] src/costs/metrics.py:9 - Magic number: 15 - use named constant
40-
- [ ] src/costs/metrics.py:67 - Magic number: 30 - use named constant
41133
- [ ] src/costs/models.py:4 - Unused Optional imported from typing
42134
- [ ] src/costs/models.py:4 - Unused import: 'Optional'
43-
- [ ] src/costs/reports/badge.py:7 - Relative import (level=2): '..metrics'
44-
- [ ] src/costs/reports/badge.py:22 - Relative import (level=2): '..git_parser'
45-
- [ ] src/costs/reports/badge.py:89 - String concatenation can be converted to f-string
46-
- [ ] src/costs/reports/badge.py:100 - String concatenation can be converted to f-string
47-
- [ ] src/costs/reports/badge.py:96 - String concatenation can be converted to f-string
48-
- [ ] src/costs/reports/badge.py:88 - Magic number in comparison: 50
49-
- [ ] src/costs/reports/badge.py:88 - Magic number: 50 - use named constant
50135
- [ ] src/costs/reports/base.py:11 - Magic number in comparison: 50
51136
- [ ] src/costs/reports/base.py:11 - Magic number: 50 - use named constant
137+
- [ ] src/costs/reports/badge.py:7 - Relative import (level=2): '..metrics'
138+
- [ ] src/costs/reports/badge.py:22 - Relative import (level=2): '..git_parser'
139+
- [ ] src/costs/reports/badge.py:88 - String concatenation can be converted to f-string
140+
- [ ] src/costs/reports/badge.py:106 - String concatenation can be converted to f-string
141+
- [ ] src/costs/reports/badge.py:118 - String concatenation can be converted to f-string
142+
- [ ] src/costs/reports/badge.py:87 - Magic number in comparison: 50
143+
- [ ] src/costs/reports/badge.py:87 - Magic number: 50 - use named constant
144+
- [ ] src/costs/reports/badge.py:102 - Magic number in comparison: 50
52145
- [ ] src/costs/reports/html.py:19 - String concatenation can be converted to f-string
53146
- [ ] src/costs/reports/html.py:20 - String concatenation can be converted to f-string
54147
- [ ] src/costs/reports/html.py:194 - Magic number: 50 - use named constant
@@ -59,6 +152,12 @@
59152
- [ ] src/costs/reports/markdown.py:56 - Magic number: 40 - use named constant
60153
- [ ] src/costs/reports/markdown.py:58 - Magic number: 14 - use named constant
61154
- [ ] src/costs/reports/markdown.py:75 - Magic number: 30 - use named constant
155+
- [ ] src/costs/tokenizers.py:96 - String concatenation can be converted to f-string
156+
- [ ] src/costs/tokenizers.py:128 - String concatenation can be converted to f-string
157+
- [ ] src/costs/tokenizers.py:3 - Unused Union imported from typing
158+
- [ ] src/costs/tokenizers.py:3 - Unused import: 'Union'
159+
- [ ] src/costs/tokenizers.py:22 - LLM-style docstring in count_tokens
160+
- [ ] src/costs/tokenizers.py:105 - LLM-style docstring in parse_diff_stats
62161

63162
---
64163

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.47
1+
0.1.48

0 commit comments

Comments
 (0)