Skip to the content.

Features

Metripy provides comprehensive code analysis capabilities across multiple languages and projects.

πŸ“Š Code Analysis

Supported Metrics

Cyclomatic Complexity

Measures the number of linearly independent paths through the code. Lower is better.

Maintainability Index

A composite metric that indicates how maintainable the code is. Higher is better.

Lines of Code (LOC)

Physical lines of code, excluding comments and blank lines.

Method Size

Average lines of code per function/method.

Halstead Metrics

Supported Languages

Language Status Engine Features
Python βœ… Stable radon Full support with all metrics
PHP πŸ§ͺ Experimental lizard + custom AST Basic metrics
TypeScript πŸ§ͺ Experimental tree-sitter Basic metrics

More coming soon…

πŸ” Git Analysis

Analyze your repository’s history to gain insights into code evolution and team dynamics.

Git Metrics

Knowledge Distribution

Understand how knowledge is distributed across your team:

Code Hotspots

Identify files that need attention based on:

πŸ“¦ Dependency Analysis

Track and analyze your project dependencies.

Supported Package Managers

Package Manager Language File
pip Python requirements.txt, pyproject.toml
npm JavaScript/TypeScript package.json
Composer PHP composer.json

More coming soon…

Dependency Insights

License Distribution

Visualize the distribution of licenses in your dependencies:

πŸ“ˆ Trend Analysis

Track how your codebase evolves over time.

Historical Tracking

Trend Visualizations

Health Distribution Evolution

See how files move between health categories:

Top Improved Files

Celebrate wins:

Files Needing Attention

Focus your efforts:

Trend Badges

Visual indicators on the dashboard:

🎨 Report Formats

HTML Dashboard

Interactive, beautiful reports with:

Overview Page

Overview Tiles

Overview Extra Information

Top Offenders

Quickly identify problematic areas in your codebase:

Top Offenders Overview

Drill down into specific metrics:

Top Offenders - Maintainability Index

Top Offenders - Cyclomatic Complexity

Top Offenders - Cognitive Complexity

Files Page

Files Page

Git Analysis Page

Dependencies Page

Dependencies Page

Trends Page

Code Smells Page

Code Smells Page

CLI Report

Print a comprehensive overview directly to the terminal with color-coded visualizations:

"reports": {
    "cli": "."
}

Sections included:

Section Description
Overview Aggregated metrics with stacked bar charts for LOC, complexity, maintainability, method size, and LCOM4
Top Offenders Side-by-side tables showing the worst files and functions for each metric
Coupling Metrics Module count, dependencies, max coupling, and instability distribution
Code Smells Summary of detected code smells by severity (info, minor, major, critical)
Git Metrics Contributor stats and activity (if git analysis enabled)
Dependencies Package status overview (if dependency analysis enabled)

The CLI report uses ANSI colors for visual indicators:

JSON Export

Export analysis results as JSON for:

Formats:

CSV Export

Export metrics in CSV format for spreadsheet analysis and custom reporting.

GitLab Code Quality Report

Generate reports compatible with GitLab’s Code Quality feature:

"reports": {
    "gl-codequality-report": "./build/gl-codequality.json"
}

This creates a JSON report that GitLab can display in merge request diffs, highlighting code quality issues directly in the changed files.

🚦 Quality Gates (Failure Conditions)

Enforce code quality standards by defining failure conditions that cause the analysis to exit with specific exit codes when thresholds are exceeded.

How It Works

  1. Define thresholds for code metrics at file, class, or function level
  2. Specify severity levels to monitor (good, ok, warning, critical)
  3. Set the maximum allowed count before failure
  4. Assign exit codes for different failure conditions

Supported Metrics

Level Metrics
File file_loc, file_cyclomatic_complexity, file_maintainability_index, file_cognitive_complexity
Class class_loc, class_cyclomatic_complexity, class_lcom4
Function function_loc, function_cyclomatic_complexity, function_maintainability_index, function_cognitive_complexity

Example Configuration

{
    "failure": {
        "1": [
            {
                "value": "function_cyclomatic_complexity",
                "severity": "critical",
                "amount": 5
            }
        ]
    }
}

This exits with code 1 if there are 5 or more functions with critical cyclomatic complexity.

CI/CD Benefits

See Configuration Guide for detailed setup instructions.

πŸ”§ Advanced Features

Multi-Project Analysis

Analyze multiple projects in a single run:

HTML Project Index

Generate a central overview page for all your projects:

HTML Index Overview

The index page displays:

HTML Index Project Cards

Configure with:

{
    "configs": { /* your projects */ },
    "html_index": "./build/index.html"
}

Flexible Configuration

File Filtering

Control what gets analyzed:

Custom Report Paths

Output reports wherever you need:

πŸ”’ Privacy & Security

🎯 Use Cases

For Developers

For Teams

For Managers

For CI/CD

Coming Soon


View Configuration Guide β†’