{"id":16218050,"url":"https://github.com/quasilyte/go-namecheck","last_synced_at":"2025-06-26T21:36:12.290Z","repository":{"id":57490115,"uuid":"154948408","full_name":"quasilyte/go-namecheck","owner":"quasilyte","description":"Source code analyzer that helps you to maintain variable/field naming conventions inside your project.","archived":false,"fork":false,"pushed_at":"2019-05-30T08:32:00.000Z","size":16,"stargazers_count":40,"open_issues_count":4,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-11T03:36:22.803Z","etag":null,"topics":["consistency","consistency-checking","conventions","go","golang","linter","manifest","source-code-analysis"],"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/quasilyte.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}},"created_at":"2018-10-27T09:44:25.000Z","updated_at":"2024-12-05T21:57:30.000Z","dependencies_parsed_at":"2022-08-29T19:31:44.399Z","dependency_job_id":null,"html_url":"https://github.com/quasilyte/go-namecheck","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/quasilyte/go-namecheck","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quasilyte%2Fgo-namecheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quasilyte%2Fgo-namecheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quasilyte%2Fgo-namecheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quasilyte%2Fgo-namecheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quasilyte","download_url":"https://codeload.github.com/quasilyte/go-namecheck/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quasilyte%2Fgo-namecheck/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262145378,"owners_count":23265909,"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":["consistency","consistency-checking","conventions","go","golang","linter","manifest","source-code-analysis"],"created_at":"2024-10-10T11:48:20.880Z","updated_at":"2025-06-26T21:36:12.248Z","avatar_url":"https://github.com/quasilyte.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-namecheck\n\nSource code analyzer that helps you to maintain variable/field naming conventions inside your project.\n\n## Quick start / Installation\n\nTo install `go-namecheck` binary under your `$(go env GOPATH)/bin`:\n\n```bash\ngo get -v github.com/quasilyte/go-namecheck\n```\n\nIf `$GOPATH/bin` is under your system `$PATH`, `go-namecheck` command should be available after that.\u003cbr\u003e\nThis should print the help message:\n\n```bash\ngo-namecheck --help\n```\n\nIn big teams, same things end up being called differently eventually.\nSometimes you bring inconsistencies on your own.\nSuppose it's considered idiomatic to call `string` parameter `s` if\nyou can't figure a more descriptive name, but sometimes you see `str`\nnames used by other programmers from your team.\nThis is where `go-namecheck` can help.\n\nFor a better illustration, suppose we also want to catch regexp\nvariables that use `re` prefix and propose `RE` suffix instead,\nso `var reFoo *regexp.Regexp` becomes `var fooRE *regexp.Regexp`.\n\n```json\n{\n  \"string\": {\"param\": {\"str\": \"s\"}},\n  \"regexp\\\\.Regexp\": {\n    \"local+global\": {\"^re[A-Z]\\\\w*$\": \"use RE suffix instead of re prefix\"}\n  }\n}\n```\n\nRules above implement checks we described.\n\nFirst key describes regular expression that matches a type.\nFor that key there is an object for scopes.\nScope can be one of:\n\n* `param` - function input params\n* `receiver` - method receiver\n* `global` - any global constant or variable\n* `local` - any local constant or variable\n* `field` - struct field\n\nYou can combine several scopes like `param+receiver+local`, etc.\n\nInside a scope there is an JSON object that maps \"from\" =\u003e \"to\" pair.\nIn the simplest form, it's a simple literal matching that suggests\nto replace one name with another, like in `str`=\u003e`s` rule.\nKey can also be a regular expression, in this case, the \"to\" part\ndoes not describe exact substitution, but rather describes\nhow to make name idiomatic (what to change).\n\nYou start by creating your rules file (or borrowing someone else set).\nThen you can run `go-namecheck` like this:\n\n```bash\ngo-namecheck foo.go bar.go mypkg\n```\n\nYou can also use `std`, `./...` and other conventional targets that are normally\nunderstood by Go tools.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquasilyte%2Fgo-namecheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquasilyte%2Fgo-namecheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquasilyte%2Fgo-namecheck/lists"}