Commit 809db88
authored
Add forbidden name detection, DI violations, and severity icons (#7)
* Add forbidden name detection, DI violations, and severity icons
- Add FORBIDDEN severity level with 🚫 icon to AntiPattern.Severity and FindingSeverity
- Detect forbidden package names (utils, helpers, managers, common, misc, base, shared)
- Detect dependency inversion violations: flag concrete class usage when interface exists
- Update all renderers (Dashboard, ProjectReport, IncludedBuild) to use emoji severity icons
- Smell classes in forbidden-named packages elevated to FORBIDDEN severity
- Tests for all new detection rules
* Add cross-build hub class detection
ContextTask now collects source dirs from root project AND all
included builds, runs the full analysis pipeline on the merged
set. Hub classes referenced across build boundaries now appear
in a Hot Classes (cross-build) section with a table and per-hub
dependent lists. Uses model-layer AnalysisSummary to respect
package boundary rules (report does not import from analysis).
* Make forbidden patterns configurable via DSL
Add forbiddenPackages and forbiddenClassSuffixes to the srcx
extension DSL. Both are additive on top of defaults. Also adds
detectForbiddenClassNames for suffix-based class name detection.
Usage:
srcx {
forbiddenPackages.add("legacy")
forbiddenClassSuffixes.add("BaseActivity")
}
* Use varargs DSL and contains matching for forbidden patterns
- forbiddenPackages("legacy", "internal") vararg syntax
- forbiddenClassPatterns("Base", "Impl") vararg syntax
- Class name matching uses contains instead of endsWith
so BaseActivity, DataHelperImpl, AbstractManager all match
- Rename DEFAULT_FORBIDDEN_CLASS_SUFFIXES to DEFAULT_FORBIDDEN_CLASS_PATTERNS
- Remove class doc comments from constants
* Replace string concatenation with templates, fix line length
Extract long string literals into vals. Use triple-quoted templates
where needed. Remove @Suppress("MaxLineLength") annotations.
All messages stay as single strings, no + concatenation.
* Split output into focused files, add layer detection
New split output files under .srcx/:
- hot-classes.md, entry-points.md, anti-patterns.md
- interfaces.md, cross-build.md, flows/{EntryPoint}.md
New analysis: ArchitecturalLayer enum, EntryPointKind classification.
context.md slimmed to overview + links to detail files.
6 new renderers with tests. Coverage at 91.8%.
* Rename Hot Classes to Hub Classes across all output files
* Fix false positive cycles, add test icons to hub classes
- Strip KDoc and comments before same-package reference matching
to eliminate false circular deps from @see cross-references
- Skip self-edges in cycle detection (Case -> Case)
- Add isTest field to HubClass model
- Hub classes renderer separates production and test classes
with 🧪 icon prefix for test classes
* Improve output formats, remove flows, fix false positives
- Hub classes: tree format with ├── └── connectors, test paths marked 🧪
- Entry points: removed useless "First Call" column, added description
- Cross-build: tree showing dependents per hub with file paths
- Interfaces: fixed false detection of enum values, grouped by source set
- Flows: removed entirely (import-chain tracing produced identical diagrams)
- Dashboard: slimmed to overview + tables + links only, removed class diagram
- Fixed false positive cycles from KDoc @see references (strip comments)
- Fixed self-cycles in cycle detection (skip self-edges)
* Fix kotlin-compiler-embeddable version conflict
Remove pinned 2.1.20 version — use Gradle's embedded Kotlin version
instead. The pinned version conflicts with Gradle 9.4.1's embedded
Kotlin 2.3.0, causing ClasspathEntrySnapshotTransform failures in
composite builds.
Also remove self-applied srcx plugin from settings (causes bootstrap
conflict) and rename build-logic for composite build compatibility.
* Fix entry point classification: use classifyEntryPoints for proper TEST/APP/MOCK split
Test classes (ending in Test/Spec, in /test/ paths) were incorrectly
listed as App Entry Points because buildEntryPoints() used
findEntryPoints() which returns graph roots without filtering tests.
Replaced with classifyEntryPoints() which already handles TEST/MOCK/APP
classification. Simplified EntryPointsRenderer to accept pre-classified
entries instead of doing its own broken source-set-based detection.
* Fix dashboard view links resolving to wrong directory
context.md lives inside .srcx/, so relative links to included build
reports need an extra ../ to escape the .srcx directory first.
* Address CodeRabbit review feedback
- Fix DI violation message: "Dependency on concrete" instead of
misleading "Constructor takes concrete" (detection is import-based)
- Add Windows path separator check for test file exclusion consistency
- Include included-build warnings in dashboard totalWarnings count
- Add empty-state message in CrossBuildRenderer for present but empty analysis
- Exclude mock/fake/stub classes from interface implementation counts1 parent 1d0f29a commit 809db88
29 files changed
Lines changed: 2770 additions & 221 deletions
File tree
- src
- main/kotlin/zone/clanker/gradle/srcx
- analysis
- model
- report
- task
- test/kotlin/zone/clanker/gradle/srcx
- analysis
- report
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
74 | 81 | | |
75 | 82 | | |
76 | 83 | | |
77 | | - | |
78 | | - | |
79 | 84 | | |
80 | 85 | | |
81 | 86 | | |
82 | 87 | | |
| 88 | + | |
| 89 | + | |
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
| |||
89 | 96 | | |
90 | 97 | | |
91 | 98 | | |
92 | | - | |
93 | 99 | | |
94 | | - | |
95 | | - | |
96 | 100 | | |
97 | | - | |
98 | | - | |
99 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
100 | 116 | | |
101 | 117 | | |
102 | 118 | | |
| |||
120 | 136 | | |
121 | 137 | | |
122 | 138 | | |
| 139 | + | |
| 140 | + | |
123 | 141 | | |
124 | 142 | | |
125 | 143 | | |
| |||
163 | 181 | | |
164 | 182 | | |
165 | 183 | | |
| 184 | + | |
| 185 | + | |
166 | 186 | | |
167 | 187 | | |
168 | 188 | | |
| |||
Lines changed: 160 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| 44 | + | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
47 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
48 | 53 | | |
49 | 54 | | |
50 | 55 | | |
51 | 56 | | |
| 57 | + | |
52 | 58 | | |
53 | 59 | | |
54 | 60 | | |
| |||
80 | 86 | | |
81 | 87 | | |
82 | 88 | | |
| 89 | + | |
83 | 90 | | |
84 | 91 | | |
85 | 92 | | |
86 | 93 | | |
87 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
88 | 104 | | |
89 | | - | |
| 105 | + | |
90 | 106 | | |
91 | 107 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 108 | + | |
95 | 109 | | |
96 | 110 | | |
97 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
98 | 234 | | |
99 | 235 | | |
100 | 236 | | |
| |||
104 | 240 | | |
105 | 241 | | |
106 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
107 | 247 | | |
108 | 248 | | |
109 | | - | |
110 | | - | |
111 | | - | |
| 249 | + | |
112 | 250 | | |
113 | | - | |
114 | | - | |
115 | | - | |
| 251 | + | |
116 | 252 | | |
117 | 253 | | |
118 | 254 | | |
| |||
131 | 267 | | |
132 | 268 | | |
133 | 269 | | |
| 270 | + | |
| 271 | + | |
134 | 272 | | |
135 | 273 | | |
136 | 274 | | |
137 | 275 | | |
138 | | - | |
139 | | - | |
140 | | - | |
| 276 | + | |
141 | 277 | | |
142 | 278 | | |
143 | 279 | | |
| |||
207 | 343 | | |
208 | 344 | | |
209 | 345 | | |
210 | | - | |
211 | | - | |
212 | | - | |
| 346 | + | |
213 | 347 | | |
214 | 348 | | |
215 | 349 | | |
| |||
242 | 376 | | |
243 | 377 | | |
244 | 378 | | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
245 | 384 | | |
246 | 385 | | |
247 | 386 | | |
248 | 387 | | |
249 | 388 | | |
250 | | - | |
251 | | - | |
252 | | - | |
| 389 | + | |
253 | 390 | | |
254 | 391 | | |
255 | 392 | | |
| |||
0 commit comments