cqa-analyzer 2.29.0__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.
Files changed (92) hide show
  1. cqa_analyzer-2.29.0/.pre-commit-hooks.yaml +9 -0
  2. cqa_analyzer-2.29.0/CHANGELOG.md +158 -0
  3. cqa_analyzer-2.29.0/LICENSE +21 -0
  4. cqa_analyzer-2.29.0/MANIFEST.in +6 -0
  5. cqa_analyzer-2.29.0/PKG-INFO +698 -0
  6. cqa_analyzer-2.29.0/README.md +664 -0
  7. cqa_analyzer-2.29.0/SECURITY.md +37 -0
  8. cqa_analyzer-2.29.0/cqa_analyzer/__init__.py +6 -0
  9. cqa_analyzer-2.29.0/cqa_analyzer/__main__.py +1103 -0
  10. cqa_analyzer-2.29.0/cqa_analyzer/anonymize.py +129 -0
  11. cqa_analyzer-2.29.0/cqa_analyzer/baseline.py +153 -0
  12. cqa_analyzer-2.29.0/cqa_analyzer/cache.py +243 -0
  13. cqa_analyzer-2.29.0/cqa_analyzer/changed_lines.py +255 -0
  14. cqa_analyzer-2.29.0/cqa_analyzer/complexity.py +1016 -0
  15. cqa_analyzer-2.29.0/cqa_analyzer/config.py +299 -0
  16. cqa_analyzer-2.29.0/cqa_analyzer/discovery.py +192 -0
  17. cqa_analyzer-2.29.0/cqa_analyzer/duplication.py +251 -0
  18. cqa_analyzer-2.29.0/cqa_analyzer/findings.py +57 -0
  19. cqa_analyzer-2.29.0/cqa_analyzer/go_patterns.py +288 -0
  20. cqa_analyzer-2.29.0/cqa_analyzer/languages/__init__.py +43 -0
  21. cqa_analyzer-2.29.0/cqa_analyzer/languages/go.py +669 -0
  22. cqa_analyzer-2.29.0/cqa_analyzer/languages/python.py +433 -0
  23. cqa_analyzer-2.29.0/cqa_analyzer/languages/typescript.py +732 -0
  24. cqa_analyzer-2.29.0/cqa_analyzer/maintainability.py +407 -0
  25. cqa_analyzer-2.29.0/cqa_analyzer/offline.py +33 -0
  26. cqa_analyzer-2.29.0/cqa_analyzer/package_intelligence.py +1093 -0
  27. cqa_analyzer-2.29.0/cqa_analyzer/patterns.py +356 -0
  28. cqa_analyzer-2.29.0/cqa_analyzer/plugins.py +17 -0
  29. cqa_analyzer-2.29.0/cqa_analyzer/protocols.py +156 -0
  30. cqa_analyzer-2.29.0/cqa_analyzer/python_resources.py +370 -0
  31. cqa_analyzer-2.29.0/cqa_analyzer/python_rules.py +380 -0
  32. cqa_analyzer-2.29.0/cqa_analyzer/python_suppressions.py +35 -0
  33. cqa_analyzer-2.29.0/cqa_analyzer/rater.py +166 -0
  34. cqa_analyzer-2.29.0/cqa_analyzer/registry.py +362 -0
  35. cqa_analyzer-2.29.0/cqa_analyzer/reporters.py +248 -0
  36. cqa_analyzer-2.29.0/cqa_analyzer/rule_metadata.py +269 -0
  37. cqa_analyzer-2.29.0/cqa_analyzer/safe_io.py +95 -0
  38. cqa_analyzer-2.29.0/cqa_analyzer/scanner.py +345 -0
  39. cqa_analyzer-2.29.0/cqa_analyzer/signals.py +257 -0
  40. cqa_analyzer-2.29.0/cqa_analyzer/ts_patterns.py +260 -0
  41. cqa_analyzer-2.29.0/cqa_analyzer.egg-info/PKG-INFO +698 -0
  42. cqa_analyzer-2.29.0/cqa_analyzer.egg-info/SOURCES.txt +90 -0
  43. cqa_analyzer-2.29.0/cqa_analyzer.egg-info/dependency_links.txt +1 -0
  44. cqa_analyzer-2.29.0/cqa_analyzer.egg-info/entry_points.txt +2 -0
  45. cqa_analyzer-2.29.0/cqa_analyzer.egg-info/requires.txt +11 -0
  46. cqa_analyzer-2.29.0/cqa_analyzer.egg-info/top_level.txt +1 -0
  47. cqa_analyzer-2.29.0/docs/BASELINES.md +51 -0
  48. cqa_analyzer-2.29.0/docs/CACHING.md +76 -0
  49. cqa_analyzer-2.29.0/docs/CHANGED_LINES.md +96 -0
  50. cqa_analyzer-2.29.0/docs/CONFIGURATION.md +78 -0
  51. cqa_analyzer-2.29.0/docs/PRE_COMMIT.md +93 -0
  52. cqa_analyzer-2.29.0/docs/PRIVACY.md +90 -0
  53. cqa_analyzer-2.29.0/docs/RELEASING.md +91 -0
  54. cqa_analyzer-2.29.0/docs/ROADMAP.md +153 -0
  55. cqa_analyzer-2.29.0/docs/RULES.md +380 -0
  56. cqa_analyzer-2.29.0/docs/SARIF.md +59 -0
  57. cqa_analyzer-2.29.0/docs/adr/001-analysis-authority-and-score-migration.md +34 -0
  58. cqa_analyzer-2.29.0/docs/report-schema-1.10.0.json +80 -0
  59. cqa_analyzer-2.29.0/docs/report-schema-1.11.0.json +101 -0
  60. cqa_analyzer-2.29.0/docs/report-schema-1.7.0.json +42 -0
  61. cqa_analyzer-2.29.0/docs/report-schema-1.8.0.json +47 -0
  62. cqa_analyzer-2.29.0/docs/report-schema-1.9.0.json +65 -0
  63. cqa_analyzer-2.29.0/pyproject.toml +68 -0
  64. cqa_analyzer-2.29.0/setup.cfg +4 -0
  65. cqa_analyzer-2.29.0/tests/fixtures/analysis-authority.json +13 -0
  66. cqa_analyzer-2.29.0/tests/fixtures/analysis-authority.txt +2 -0
  67. cqa_analyzer-2.29.0/tests/test_anonymize.py +136 -0
  68. cqa_analyzer-2.29.0/tests/test_baseline.py +103 -0
  69. cqa_analyzer-2.29.0/tests/test_cache.py +96 -0
  70. cqa_analyzer-2.29.0/tests/test_changed_lines.py +452 -0
  71. cqa_analyzer-2.29.0/tests/test_cli.py +678 -0
  72. cqa_analyzer-2.29.0/tests/test_complexity.py +228 -0
  73. cqa_analyzer-2.29.0/tests/test_config.py +149 -0
  74. cqa_analyzer-2.29.0/tests/test_duplication.py +183 -0
  75. cqa_analyzer-2.29.0/tests/test_findings.py +235 -0
  76. cqa_analyzer-2.29.0/tests/test_go.py +279 -0
  77. cqa_analyzer-2.29.0/tests/test_go_signals.py +175 -0
  78. cqa_analyzer-2.29.0/tests/test_maintainability.py +170 -0
  79. cqa_analyzer-2.29.0/tests/test_offline.py +27 -0
  80. cqa_analyzer-2.29.0/tests/test_package_intelligence.py +893 -0
  81. cqa_analyzer-2.29.0/tests/test_plugins.py +341 -0
  82. cqa_analyzer-2.29.0/tests/test_pre_commit_hook.py +85 -0
  83. cqa_analyzer-2.29.0/tests/test_python_resource_rules.py +116 -0
  84. cqa_analyzer-2.29.0/tests/test_rater.py +65 -0
  85. cqa_analyzer-2.29.0/tests/test_release_metadata.py +46 -0
  86. cqa_analyzer-2.29.0/tests/test_report_contract.py +44 -0
  87. cqa_analyzer-2.29.0/tests/test_sarif.py +318 -0
  88. cqa_analyzer-2.29.0/tests/test_scanner.py +218 -0
  89. cqa_analyzer-2.29.0/tests/test_score_scope.py +117 -0
  90. cqa_analyzer-2.29.0/tests/test_signals.py +69 -0
  91. cqa_analyzer-2.29.0/tests/test_ts_signals.py +143 -0
  92. cqa_analyzer-2.29.0/tests/test_typescript.py +371 -0
@@ -0,0 +1,9 @@
1
+ - id: code-quality-analyzer
2
+ name: code-quality-analyzer
3
+ description: Run privacy-first Python and Go code-quality analysis locally.
4
+ entry: code-quality-analyzer . --offline
5
+ language: python
6
+ types: [file]
7
+ files: '(^|/)[^/]+\.(py|go)$|^(pyproject\.toml|go\.mod|\.code-quality\.toml|\.gitignore)$'
8
+ pass_filenames: false
9
+ require_serial: true
@@ -0,0 +1,158 @@
1
+ # Changelog
2
+
3
+ All notable changes are documented in this file. Versions follow semantic versioning for the analyzer CLI and independent semantic versions for report and ruleset contracts.
4
+
5
+ ## Unreleased
6
+
7
+ ## 2.29.0 - 2026-09-09
8
+
9
+ ### Added
10
+
11
+ - `architecture_signal_scope` report field naming the signal-capable
12
+ languages (currently `["python"]`) and whether the score applies to
13
+ this analysis.
14
+ - Exit code 5: `--fail-under` on a not-applicable score exits distinctly
15
+ instead of silently passing or failing.
16
+ - Bounded Go identifier extraction: `GoFacts.identifiers` captures
17
+ declared func/type/var/const and short-declaration names plus selector
18
+ call sites from blanked source, the prerequisite for Go architecture
19
+ signals. Go adapter and cache codec 1.0.0 → 1.1.0 (old cache entries
20
+ miss safely).
21
+ - Go architecture signals: a `go-architecture-signals` provider matches
22
+ Go-idiom DSA and design pattern definitions (`container/heap`,
23
+ `sort.Search`, corroborated BFS/DFS, `net/http`/gRPC API design,
24
+ `database/sql`/GORM, message queues, `sync.Once` singletons, JWT/crypto
25
+ auth, and more) against blanked source through the shared
26
+ language-neutral matcher. Go pattern IDs reuse the shared scoring
27
+ catalog, so Go and mixed projects now earn real architecture signal
28
+ scores; Go-only projects are no longer reported as not applicable.
29
+ - TypeScript/JavaScript pilot: a bounded no-toolchain adapter for
30
+ `.ts`/`.tsx`/`.js`/`.jsx`/`.mjs`/`.cjs` blanks comments, strings, and
31
+ template literals (interpolations included), extracts bounded
32
+ identifiers and import specifiers, emits `TS-COR-001` for empty catch
33
+ blocks, and passively reads the root `package.json` to flag
34
+ imported-but-undeclared dependencies (`TS-PKG-001`) and invalid
35
+ manifests (`TS-PKG-002`). Workspace manifests skip drift analysis;
36
+ node builtins, path aliases, and non-npm-name specifiers are never
37
+ flagged. TS/JS architecture signals match ecosystem idioms
38
+ (`new Map`/`new Set`, memoization, express/fastify/NestJS/tRPC API
39
+ design, Prisma/TypeORM data access, redis/react-query caching,
40
+ kafkajs/bullmq queues, jsonwebtoken/next-auth authentication,
41
+ vitest/jest/playwright testing) through the shared scoring catalog,
42
+ so TS/JS-only projects earn real scores and full-stack projects
43
+ aggregate one score across Python, Go, and TS/JS.
44
+ Ruleset 2.13.0 → 2.14.0.
45
+ - Nested `package.json` discovery: dependency-drift analysis covers
46
+ manifests in subdirectories (bounded), associating each TS/JS file
47
+ with its nearest enclosing manifest, unioning declared dependencies
48
+ up the ancestor chain, skipping workspace or unreadable chains, and
49
+ locating findings at each manifest's project-relative path.
50
+ TypeScript package provider capability 1.0.0 → 1.1.0.
51
+ - Frontend build-output directories (`.next`, `.nuxt`, `.turbo`,
52
+ `.svelte-kit`, `out`, `coverage`, `bower_components`, `.yarn`,
53
+ `.pnpm-store`) are now excluded from discovery.
54
+
55
+ ### Changed
56
+
57
+ - Projects with no successfully analyzed Python source now report the
58
+ architecture signal score as **not applicable** (`null` in JSON,
59
+ an explicit panel in text output) instead of a misleading 1.0 floor.
60
+ Report schema 1.10.0 → 1.11.0 (score and `rating` are now nullable).
61
+
62
+ ## 2.28.0 - 2026-09-08
63
+
64
+ ### Added
65
+
66
+ - `PY-DUP-001` cross-file duplicate function implementation detection: a
67
+ default-enabled `python-duplication` project provider compares
68
+ docstring-stripped function bodies, parameter lists, and return annotations
69
+ by exact AST structure. Renamed and re-decorated copies still report;
70
+ trivial functions (fewer than three statements or forty AST nodes) and
71
+ functions nested inside an already-reported duplicate do not. Findings
72
+ flow through the standard severity policy, baseline, changed-line, SARIF,
73
+ suppression, and privacy contracts. JSON reports expose aggregate group
74
+ data under `project_analyses` (`python:duplication`).
75
+ - `--version` flag that prints the analyzer version and exits.
76
+
77
+ ### Changed
78
+
79
+ - Ruleset version 2.12.0 → 2.13.0 (new rule `PY-DUP-001`).
80
+ - README restructured to lead with the privacy-first data boundary and to
81
+ pin the published `v2.27.0` pre-commit tag.
82
+
83
+ ## 2.27.0 - 2026-09-01
84
+
85
+ First public release. Earlier 2.x versions were development-only and were not
86
+ tagged or published.
87
+
88
+ ### Added
89
+
90
+ - Python package intelligence and optional complexity project providers
91
+ - Bounded Go adapter and `GO-COR-001` ignored-error pilot rule
92
+ - Mixed Python/Go reports with language counts and adapter versions
93
+ - Language-neutral plugin contracts and deterministic extension registry
94
+ - Built-in Python adapter and normalized Python rule-pack plugin
95
+ - Fully anonymized text and JSON reports with opaque source-identity tokens
96
+ - Explicit offline enforcement that denies socket operations during analysis
97
+ - Privacy-state metadata in the JSON report contract
98
+ - Privacy-safe finding baselines and severity-based CI gates
99
+ - Passive Python package metadata and import-graph analysis
100
+ - Source-located actionable Python findings
101
+ - Versioned JSON report metadata
102
+ - Versioned analysis-authority schema, score-migration ADR, and golden contract fixtures
103
+ - Bounded `.code-quality.toml` source selection and per-rule policy
104
+ - Root `.gitignore`-aware inventory with deterministic negation handling
105
+ - Reason-required Python inline suppressions that never expose reason text
106
+ - Privacy-safe effective-configuration fingerprints in JSON reports
107
+ - High-confidence Python findings for broad handlers, swallowed exceptions, and unreachable statements
108
+ - Measured Python cyclomatic and cognitive complexity findings
109
+ - Python findings for long functions, excessive parameters, and boolean mode proliferation
110
+ - Conservative Python findings for blocking async calls and unmanaged local resources
111
+ - Literal `__all__` checks for missing module bindings and duplicate exports
112
+ - Bounded setuptools PEP 420 namespace discovery using shared parsed artifacts
113
+ - `PY-PKG-006` for missing literal static setuptools package-data targets
114
+ - Deterministic, privacy-bounded SARIF 2.1.0 output with a stable built-in rule catalog
115
+ - Bounded changed-line manifests with aggregate-only text, JSON, and SARIF selection metadata
116
+ - First-class serial offline pre-commit hook with advisory and gated adoption profiles
117
+ - Explicit deterministic content-hash caching for bounded Python and Go parse artifacts
118
+
119
+ ### Changed
120
+
121
+ - Renamed the PyPI distribution to `cqa-analyzer` and the import package to
122
+ `cqa_analyzer`; the `code-quality-analyzer` CLI name is unchanged.
123
+ - Analyzer version advanced to 2.27.0; report schema remains 1.10.0 and ruleset remains 2.12.0
124
+ - Scanner instances are explicitly single-use to prevent accumulated results.
125
+ - Optional complexity analysis now handles set and generator comprehensions,
126
+ compares competing space allocations correctly, and requires stronger binary-search evidence.
127
+ - Reports now qualify authority with source-candidate, readable-file, and successful-analysis counts, completeness ratio, and stable reason codes
128
+ - `architecture_signal_score` replaces `rating` as the primary score name; `rating` remains a documented equal-valued 2.x compatibility alias
129
+ - Source candidates with zero successful analyses now exit 3 even without strict mode
130
+ - Built-in text, JSON, and SARIF reporters implement the versioned reporter contract and are selected dynamically through the plugin registry
131
+ - The CLI emits an immutable report envelope through negotiated reporters instead of directly serializing JSON
132
+ - Go imports now preserve default, explicit, blank, and dot-import semantics; `GO-COR-001` follows explicit aliases without trusting blank or dot imports
133
+ - A passive Go project provider now aggregates multi-file packages and local module import edges from shared facts and a bounded `go.mod` read
134
+ - JSON reports expose privacy-projected project-provider results and generic project-analysis health
135
+ - Optional Python complexity analysis now consumes the scanner's shared AST artifacts instead of discovering, reading, and parsing source again
136
+ - Plugins now declare a core API target; project providers and reporters are resolved through explicit versioned capability negotiation
137
+ - Python package and complexity analysis now resolve through cached project providers
138
+ - Reports now inventory registered language adapters and analyzed language counts
139
+ - Anonymized package intelligence exposes aggregate facts only
140
+ - Verbose anonymized reports replace source-derived signals and reasoning
141
+ - Reports use project-relative paths and omit semantic evidence from malformed source
142
+ - Strict mode covers truncation, package metadata, and requested complexity gaps
143
+ - Big-O output is explicitly experimental
144
+
145
+ ### Security
146
+
147
+ - Project metadata, source, configuration, baseline, changed-line, and Go module
148
+ reads use bounded descriptor-based regular-file checks with symlink rejection.
149
+ - GitHub Actions are pinned to reviewed immutable commit SHAs.
150
+ - Parse caches enforce aggregate entry and byte limits with deterministic pruning.
151
+
152
+ - Offline mode blocks connection and name-resolution socket entry points
153
+ - Baselines retain stable private identities without exposing them in reports
154
+ - Baselines store bounded SHA-256 fingerprints rather than source identifiers
155
+ - Changed-line manifests are strictly bounded and reports retain aggregate selection metadata only
156
+ - The published pre-commit hook enforces analyzer runtime `--offline` mode
157
+ - Parse cache entries use bounded typed JSON, restrictive permissions, and atomic replacement
158
+ - Skipped-file examples no longer expose absolute paths
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Code Quality Analyzer contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,6 @@
1
+ include LICENSE
2
+ include SECURITY.md
3
+ include CHANGELOG.md
4
+ include .pre-commit-hooks.yaml
5
+ recursive-include docs *.md *.json
6
+ recursive-include tests/fixtures *.json *.txt