-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
There are two configuration files, both optional: the tool works without either of them.
-
analyzer_config.jsonβ colors, icons, score weights, and coupling detector. Looked up from the directory where you run the command. -
analyzer.ymlβ per-project defaults (output dirs, CI gates, format). Looked up from the root of the analyzed project.
Without a config, the analyzer uses generic defaults for any Android project. To customize colors, icons, and styles, create an analyzer_config.json in the directory where you run the command:
Installed with pipx:
# macOS / Linux
curl -o analyzer_config.json \
https://raw.githubusercontent.com/pfranccino/android-gradle-analyzer/main/analyzer_config.example.json
# Windows (PowerShell)
Invoke-WebRequest `
-Uri "https://raw.githubusercontent.com/pfranccino/android-gradle-analyzer/main/analyzer_config.example.json" `
-OutFile "analyzer_config.json"With the cloned repo:
cp analyzer_config.example.json analyzer_config.json{
"icons": {
"payment": "πΈ",
"cart": "π",
"auth": "π"
},
"colors": {
"cycle": "#FF0000"
}
}Only include the fields you want to change β the rest use defaults.
Lookup order:
- Explicit
--config <path> -
analyzer_config.jsonin the current directory (where you run the command) - Internal defaults
Tip: if you always analyze the same project, put
analyzer_config.jsonat its root and run the command from there. If you analyze multiple projects, use--config ~/my-config.json.
Detects a leaf (feature or app: high I, at the tip of the graph) that other modules depend on β a signal that shared code got stuck at the top instead of moving down to core/shared. It doesn't rely on names or plugins: it's based on the metrics the tool already computes. core/common are automatically excluded by having low I.
Works without configuration using these defaults. It is advisory (penalty: 0 β only appears in the report, does not affect the score); raise it to activate the CI gate.
{
"coupling_limits": {
"leaf_instability": 0.70,
"leaf_max_ca": 1,
"leaf_penalty": 0,
"app_max_ca": 0,
"app_penalty": 0
},
"coupling_overrides": { "legacy:util": "ignore" }
}The entry point is detected by the com.android.application plugin; coupling_overrides lets you force ("app"/"leaf") or exclude ("ignore") specific modules.
If you create an analyzer.yml file at the root of the analyzed Android project, the tools will read it automatically and use its values as defaults. CLI flags always take precedence over the yml.
sanity:
fail_on_cycle: true
fail_on_score_below: 70
output_dir: reports/sanity
impact:
default_module: app
output_dir: reports/impact
analyzer:
output_dir: reports/diagrams
format: mermaid
engine: auto
externals:
output_dir: reports/external-callsFields per section:
| Section | Field | CLI equivalent |
|---|---|---|
sanity |
fail_on_cycle |
--fail-on-cycle |
sanity |
fail_on_score_below |
--fail-on-score-below N |
sanity |
output_dir |
--output-dir |
sanity |
engine |
--engine |
impact |
default_module |
second positional argument |
impact |
output_dir |
--output-dir |
impact |
engine |
--engine |
analyzer |
output_dir |
--output-dir |
analyzer |
format |
--format |
analyzer |
engine |
--engine |
externals |
output_dir |
--output-dir |
externals |
engine |
--engine |
Rules:
- The yml is looked up from the path you pass as the first argument, not from the CWD.
- CLI flags always override the yml.
- Requires
pyyaml(optional install:pip install android-gradle-analyzer[yaml]). If not installed, the yml is silently ignored.
| Scope | Visual category |
|---|---|
api, implementation, compileOnly
|
Solid arrow (compile) |
kapt, annotationProcessor
|
Dashed arrow (build) |
testImplementation, androidTestImplementation, debugImplementation, releaseImplementation, runtimeOnly, testRuntimeOnly
|
Dashed arrow with label (test/debug) |