Skip to content

Configuration

pfranccino edited this page Jun 15, 2026 · 1 revision

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.

analyzer_config.json

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

Example

{
  "icons": {
    "payment": "πŸ’Έ",
    "cart":    "πŸ›’",
    "auth":    "πŸ”"
  },
  "colors": {
    "cycle": "#FF0000"
  }
}

Only include the fields you want to change β€” the rest use defaults.

Lookup order:

  1. Explicit --config <path>
  2. analyzer_config.json in the current directory (where you run the command)
  3. Internal defaults

Tip: if you always analyze the same project, put analyzer_config.json at its root and run the command from there. If you analyze multiple projects, use --config ~/my-config.json.

"Misplaced shared logic" detector (coupling_limits)

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.


analyzer.yml (per-project config)

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-calls

Fields 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.

Supported scopes

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)

Clone this wiki locally