{"id":13771021,"url":"https://github.com/droptheplot/abcgo","last_synced_at":"2025-04-10T16:07:05.221Z","repository":{"id":89237645,"uuid":"110476070","full_name":"droptheplot/abcgo","owner":"droptheplot","description":"ABC metrics for Go source code.","archived":false,"fork":false,"pushed_at":"2023-11-16T18:15:35.000Z","size":12,"stargazers_count":27,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T13:51:22.127Z","etag":null,"topics":["abc","abc-metrics","go","golang","metrics"],"latest_commit_sha":null,"homepage":"","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/droptheplot.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2017-11-12T22:53:42.000Z","updated_at":"2024-12-23T00:05:43.000Z","dependencies_parsed_at":"2024-06-21T04:19:53.737Z","dependency_job_id":"e6d0bb2c-36af-4c99-95e7-7015eeeab97e","html_url":"https://github.com/droptheplot/abcgo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droptheplot%2Fabcgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droptheplot%2Fabcgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droptheplot%2Fabcgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/droptheplot%2Fabcgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/droptheplot","download_url":"https://codeload.github.com/droptheplot/abcgo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248250743,"owners_count":21072682,"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","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":["abc","abc-metrics","go","golang","metrics"],"created_at":"2024-08-03T17:00:46.596Z","updated_at":"2025-04-10T16:07:05.200Z","avatar_url":"https://github.com/droptheplot.png","language":"Go","funding_links":[],"categories":["Linters"],"sub_categories":["Code Complexity"],"readme":"# ABCGo\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/droptheplot/abcgo)](https://goreportcard.com/report/github.com/droptheplot/abcgo)\n[![Build Status](https://travis-ci.org/droptheplot/abcgo.svg?branch=master)](https://travis-ci.org/droptheplot/abcgo)\n[![GoDoc](https://godoc.org/github.com/droptheplot/abcgo?status.svg)](https://godoc.org/github.com/droptheplot/abcgo)\n\nABC metrics for Go source code.\n\n## Definition\n\nABCGo uses these rules to calculate ABC:\n\n* Add one to the **assignment** count when:\n  * Occurrence of an assignment operator: `=`, `*=`, `/=`, `%=`, `+=`, `\u003c\u003c=`, `\u003e\u003e=`, `\u0026=`, `^=`.\n  * Occurrence of an increment or a decrement operator: `++`, `--`.\n* Add one to **branch** count when:\n  * Occurrence of a function call.\n* Add one to **condition** count when:\n  * Occurrence of a conditional operator: `\u003c`, `\u003e`, `\u003c=`, `\u003e=`, `==`, `!=`.\n  * Occurrence of the following keywords: `else`, `case`.\n\nFinal score is calculated as follows:\n\n\u003cimg src=\"https://wikimedia.org/api/rest_v1/media/math/render/svg/871176d94f9d4a290ba3c479b24b815567e1eaa1\" /\u003e\n\n[Read more about ABC metrics.](https://en.wikipedia.org/wiki/ABC_Software_Metric)\n\n## Getting Started\n\n### Installation\n\n```shell\n$ go get -u github.com/droptheplot/abcgo\n$ (cd $GOPATH/src/github.com/droptheplot/abcgo \u0026\u0026 go install)\n```\n\n### Usage\n\n#### Single file\n\n```shell\n$ abcgo -path main.go\nSource       Func   Score   A   B    C\nmain.go:28   init   9       1   8    5\nmain.go:54   main   13      5   13   1\n```\n\n#### Directory\n\n```shell\n$ abcgo -path ./\nSource            Func            Score   A   B    C\nmain.go:28        init            9       1   8    5\nmain.go:54        main            13      5   13   1\nmain_test.go:54   TestSomething   9       0   9    2\n```\n\n#### JSON\n\n```shell\n$ abcgo -path main.go -format json\n[\n  {\n    \"path\": \"main.go\",\n    \"line\": 54,\n    \"name\": \"main\",\n    \"assignment\": 5,\n    \"branch\": 13,\n    \"condition\": 1,\n    \"score\": 13\n  },\n  {\n    \"path\": \"main.go\",\n    \"line\": 54,\n    \"name\": \"init\",\n    \"assignment\": 1,\n    \"branch\": 8,\n    \"condition\": 5,\n    \"score\": 9\n  }\n]\n```\n\n#### Raw\n\n*(source, line, function name, score)*\n\n```shell\n$ abcgo -path main.go -format raw\nmain.go 28 init 9\nmain.go 54 main 13\nmain_test.go 54 TestSomething 9\n```\n\n#### Summary\n```shell\n$ abcgo -path ./ -format summary\n                   A    B    C\nProject summary:   22   43   15\n```\n\n### Options\n\n* `-path [path]` - Path to file or directory.\n* `-format [format]` - Output format (`table` (default), `raw` or `json`).\n* `-sort` - Sort functions by score.\n* `-no-test` - Skip `*_test.go` files.\n\n### Plugins\n\n* [Vim](https://github.com/droptheplot/abcgo/vim)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdroptheplot%2Fabcgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdroptheplot%2Fabcgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdroptheplot%2Fabcgo/lists"}