Analyze zen violations (v2)
analyze_zen_violationsDetect zen rule violations in code to enforce language-specific best practices and idiomatic patterns.
Instructions
Analyze a code snippet against zen rules with stricter request-quality guardrails and richer telemetry metadata.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Source code to analyse. | |
| language | Yes | Programming language identifier. | |
| project_as | No | Projection-family target when ``perspective`` is ``projection``. | |
| perspective | No | Requested analysis perspective. Default to ``PerspectiveMode.ALL``. | all |
| severity_threshold | No | Severity threshold. Default to None. | |
| enable_external_tools | No | Enable external tools. Default to False. | |
| allow_temporary_runners | No | Allow temporary runners. Default to False. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | ||
| metrics | Yes | Container for every numeric measurement extracted from a source file. The analyser's ``compute_metrics`` hook populates this model after parsing is complete. Downstream, the detection pipeline reads these numbers to decide which zen-principle thresholds have been crossed, and the MCP server serialises them back to the client alongside the violation list. Attributes: cyclomatic: Full complexity profile with per-block detail. maintainability_index: Halstead-derived maintainability score (0-100). lines_of_code: Physical line count of the analysed source. Example: >>> m = Metrics( ... cyclomatic=CyclomaticSummary(blocks=[], average=0.0), ... maintainability_index=72.5, ... lines_of_code=340, ... ) >>> m.maintainability_index > 65 True See Also: ``CyclomaticSummary``: Detailed breakdown stored inside ``cyclomatic``. ``AnalysisResult``: Final output that embeds ``Metrics``. | |
| language | Yes | ||
| violations | Yes | ||
| overall_score | Yes | ||
| rules_summary | No | ||
| dogma_analysis | No | ||
| external_analysis | No |