{"id":17119823,"url":"https://github.com/halleck45/ast-metrics","last_synced_at":"2025-10-05T15:08:42.340Z","repository":{"id":205946268,"uuid":"713926095","full_name":"Halleck45/ast-metrics","owner":"Halleck45","description":"AST Metrics is a language-agnostic static code analyzer.","archived":false,"fork":false,"pushed_at":"2025-09-17T07:57:27.000Z","size":32292,"stargazers_count":99,"open_issues_count":4,"forks_count":12,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-09-17T08:35:47.562Z","etag":null,"topics":["quality","static-analysis"],"latest_commit_sha":null,"homepage":"https://halleck45.github.io/ast-metrics/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Halleck45.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["Halleck45"]}},"created_at":"2023-11-03T14:29:26.000Z","updated_at":"2025-09-17T06:58:20.000Z","dependencies_parsed_at":"2024-03-25T17:27:45.615Z","dependency_job_id":"69a33c51-721e-4e21-bcbc-c10b747ac81b","html_url":"https://github.com/Halleck45/ast-metrics","commit_stats":null,"previous_names":["halleck45/ast-metrics"],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/Halleck45/ast-metrics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Halleck45%2Fast-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Halleck45%2Fast-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Halleck45%2Fast-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Halleck45%2Fast-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Halleck45","download_url":"https://codeload.github.com/Halleck45/ast-metrics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Halleck45%2Fast-metrics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278471125,"owners_count":25992420,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["quality","static-analysis"],"created_at":"2024-10-14T17:58:14.457Z","updated_at":"2025-10-05T15:08:42.330Z","avatar_url":"https://github.com/Halleck45.png","language":"Go","funding_links":["https://github.com/sponsors/Halleck45"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\" style=\"text-align:center\"\u003e\n\u003cimg alt=\"AST Metrics\" src=\"https://raw.githubusercontent.com/Halleck45/ast-metrics/main/docs/logo-ast-metrics-condensed.png\" height=\"200px\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\" style=\"text-align:center\"\u003e\nAST Metrics is a \u003cb\u003emulti-language static code analyzer\u003c/b\u003e.  \n\u003cbr /\u003e\nIt provides \u003cb\u003earchitectural insights\u003c/b\u003e, \u003cb\u003ecomplexity metrics\u003c/b\u003e, and \u003cb\u003eactivity analysis\u003c/b\u003e - all in a \u003cb\u003efast, standalone binary\u003c/b\u003e ready for CI/CD.\n\u003c/p\u003e\n\n\u003cp align=\"center\" style=\"text-align:center\"\u003e\n\u003ca href=\"https://github.com/Halleck45/ast-metrics/actions/workflows/test.yml\"\u003e\u003cimg src=\"https://github.com/Halleck45/ast-metrics/actions/workflows/test.yml/badge.svg\" alt=\"CI\"\u003e\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/github/v/release/Halleck45/ast-metrics\" alt=\"GitHub Release\"\u003e\n\u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" alt=\"License: MIT\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/sponsors/Halleck45\"\u003e\u003cimg src=\"https://img.shields.io/static/v1?label=Sponsor\u0026amp;message=%E2%9D%A4\u0026amp;logo=GitHub\u0026amp;color=%23fe8e86\" alt=\"\"\u003e\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/github/downloads/Halleck45/ast-metrics/total\" alt=\"GitHub all releases\"\u003e\n\u003ca href=\"https://goreportcard.com/report/github.com/Halleck45/ast-metrics\"\u003e\u003cimg src=\"https://goreportcard.com/badge/github.com/Halleck45/ast-metrics\" alt=\"Go Report Card\"\u003e\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/Halleck45/ast-metrics\"\u003e\u003cimg src=\"https://codecov.io/gh/Halleck45/ast-metrics/branch/main/graph/badge.svg\" alt=\"codecov\"\u003e\u003c/a\u003e\u003c/p\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\" style=\"text-align:center\"\u003e\n\u003ca href=\"https://halleck45.github.io/ast-metrics/\"\u003eDocumentation\u003c/a\u003e | \u003ca href=\".github/CONTRIBUTING.md\"\u003eContributing\u003c/a\u003e | \u003ca href=\"https://twitter.com/Halleck45\"\u003eTwitter\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr /\u003e\u003cbr/\u003e\n\n\u003ctable\u003e\n    \u003ctr\u003e\n        \u003ctd width=\"50%\" style=\"text-align:center\"\u003e\n            HTML Report\n        \u003c/td\u003e\n        \u003ctd width=\"50%\" style=\"text-align:center\"\u003e\n            CLI\n        \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n        \u003ctd width=\"50%\" style=\"text-align:center\"\u003e\n            \u003cimg src=\"./docs/preview-ast-metrics.gif\" alt=\"AST Metrics HTML report\"/\u003e\n        \u003c/td\u003e\n        \u003ctd width=\"50%\" style=\"text-align:center\"\u003e\n            \u003cimg src=\"./docs/preview.gif\" alt=\"AST Metrics CLI report\"/\u003e\n        \u003c/td\u003e\n    \u003c/tr\u003e\n\u003c/table\u003e\n\n\n\n## Getting Started\n\nOpen your terminal and run the following command:\n\n```console\ncurl -s https://raw.githubusercontent.com/Halleck45/ast-metrics/main/scripts/download.sh|bash\n./ast-metrics analyze --report-html=\u003cdirectory\u003e /path/to/your/code\n```\n\n\u003e To install it manually follow the detailed [installation instructions](https://halleck45.github.io/ast-metrics/getting-started/install/).\n\n\n## Linting your code\n\nRun:\n\n```bash\n# create a .ast-metrics.yaml config file\nast-metrics init \n\n# Add ruleset to your config file\nast-metrics ruleset add architecture\nast-metrics ruleset add volume\nast-metrics ruleset list # see the list of available rulesets\n\n# Run the linter\nast-metrics lint\n```\n\nYou can declare thresholds in your YAML config (*Lines of code per method, Coupling, Maintainability...*).\n\nExample:\n\n```yaml\nrequirements:\n  rules:\n    architecture:\n      coupling:\n        forbidden:\n          - from: Controller\n            to: Repository\n          - from: Repository\n            to: Service\n      max_afferent_coupling: 10\n      max_efferent_coupling: 10\n      min_maintainability: 70\n    volume:\n      max_loc: 1000\n      max_logical_loc: 600\n      max_loc_by_method: 30\n      max_logical_loc_by_method: 20\n    complexity:\n      max_cyclomatic: 10\n    golang:\n      no_package_name_in_method: true\n      max_nesting: 4\n      max_file_size: 1000\n      max_files_per_package: 50\n      slice_prealloc: true\n      ignored_error: true\n      context_missing: true\n      context_ignored: true\n```\n\nThis makes it **easy to enforce architecture and quality at scale**.\n\nRun `ast-metrics ruleset list` to see the list of available rulesets. Then `ast-metrics ruleset add \u003cruleset-name\u003e` to apply a ruleset to your project.\n\n## CI usage\n\nUse the dedicated CI command to run lint and generate all reports in one go:\n\n```bash\nast-metrics ci [options] /path/to/your/code\n```\n\nNotes:\n- This command runs the linter first, then generates HTML, Markdown, JSON, OpenMetrics and SARIF reports.\n- If any lint violations are found, the command exits with a non-zero status but still produces the reports.\n- The previous alias `analyze --ci` is deprecated and will display a warning. Please migrate to `ast-metrics ci`.\n\n## Github Action\n\nCreate a `.github/workflows/ast-metrics.yml` file in your project with the following content:\n\n```yaml\nname: \"AST Metrics\"\non: [push]\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n        - uses: halleck45/action-ast-metrics@v1\n```\n\n## Why AST Metrics?\n\n- **Catch issues early**: detect complex or tightly coupled code.\n- **Ensure architectural coherence**: validate dependencies and layering.\n- **Understand your project at scale**: from cyclomatic complexity to bus factor.\n\n## Features\n\n+ **Architectural analysis**: community detection, coupling, instability.\n+ **Linter**: enforce coding standards and best practices.\n+ **CI/CD ready**: plug into GitHub Actions, GitLab CI, or any pipeline.\n+ **Fast \u0026 dependency-free**: single binary, no setup required.\n+ **Code metrics**: complexity, maintainability, size.\n+ **Activity metrics**: commits, bus factor.\n+ **Readable reports**: detailed HTML dashboards.\n\n[Read more in the documentation](https://halleck45.github.io/ast-metrics/)\n\n## Supported languages\n\n+ ✅ **Golang** `any version`\n+ ✅ **Python** `Python 2, Python 3`\n+ ✅ **Rust** `any version`\n+ ✅ **PHP** `\u003c= PHP 8.4`\n+ 🕛 **TypeScript**\n+ 🕛 **Flutter**\n+ 🕛 **Java**\n+ 🕛 **C++**\n+ 🕛 **Ruby**\n\n## License\n\nAST Metrics is open-source software [licensed under the MIT license](LICENSE)\n\n\n## Contributing\n\nAST Metrics is an actively evolving project.\n\nWe welcome discussions, bug reports, and pull requests.\n\n➡️ Start [contributing here](.github/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalleck45%2Fast-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhalleck45%2Fast-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhalleck45%2Fast-metrics/lists"}