{"id":13410444,"url":"https://github.com/tsoding/snitch","last_synced_at":"2025-04-29T12:20:47.126Z","repository":{"id":38421177,"uuid":"149132236","full_name":"tsoding/snitch","owner":"tsoding","description":"Language agnostic tool that collects TODOs in the source code and reports them as Issues","archived":false,"fork":false,"pushed_at":"2023-02-20T14:58:43.000Z","size":1083,"stargazers_count":475,"open_issues_count":39,"forks_count":39,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-02-17T09:36:56.729Z","etag":null,"topics":["hacktoberfest","hacktoberfest2020"],"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/tsoding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2018-09-17T13:48:20.000Z","updated_at":"2024-05-30T04:33:45.643Z","dependencies_parsed_at":"2024-05-30T04:43:48.717Z","dependency_job_id":null,"html_url":"https://github.com/tsoding/snitch","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/tsoding%2Fsnitch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2Fsnitch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2Fsnitch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsoding%2Fsnitch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsoding","download_url":"https://codeload.github.com/tsoding/snitch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251499139,"owners_count":21599021,"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":["hacktoberfest","hacktoberfest2020"],"created_at":"2024-07-30T20:01:06.932Z","updated_at":"2025-04-29T12:20:47.102Z","avatar_url":"https://github.com/tsoding.png","language":"Go","funding_links":["https://www.patreon.com/tsoding"],"categories":["Go","hacktoberfest"],"sub_categories":[],"readme":"[![Tsoding](https://img.shields.io/badge/twitch.tv-tsoding-purple?logo=twitch\u0026style=for-the-badge)](https://www.twitch.tv/tsoding)\n[![Build Status](https://travis-ci.org/tsoding/snitch.svg?branch=master)](https://travis-ci.org/tsoding/snitch)\n[![Build Status](https://github.com/tsoding/snitch/workflows/Go/badge.svg)](https://github.com/tsoding/snitch/actions?query=workflow%3AGo)\n\n# Snitch\n\nA simple tool that collects TODOs in the source code and reports them as GitHub issues.\n\n## How it works\n\n1. Snitch finds an unreported TODO,\n2. Reports it to the GitHub as an issue,\n3. Assigns the Issue number to the TODO marking it a reported,\n4. Commits the reported TODO to the git repo,\n5. Repeats the process until all of the unreported TODOs are reported.\n\nAfter that you are supposed to push the new reported TODOs yourself.\n\n## TODO Format\n\n### Unreported TODO\n\n#### Example\n\n```\n// TODO: rewrite this in Rust\n```\n\n#### Parsing\n\nRegular expression: `^(.*)TODO(O*): (.*)$` [Play](https://regex101.com/r/u5lkxf/2)\n\nCapture Groups:\n- Group 1: **Prefix**. Used only to precisly recover the text of the line where the TODO is originally located.\n- Group 2: **Urgency Suffix**. Used to indicate the urgency of the TODO. The higher the amount of `O`-s, the more urgent the TODO is. (See [Urgency](#Urgency) for more info)\n- Group 3: **Suffix**. Used as the title of the issue.\n\n### Reported TODO\n\n#### Example\n\n```\n// TODO(#42): rewrite this in Rust\n```\n\n#### Parsing\n\nRegular expression: `^(.*)TODO(O*)\\((.*)\\): (.*)$` [Play](https://regex101.com/r/5U6rjS/1)\n\nCapture Groups:\n- Group 1: **Prefix**. Used only to precisly recover the text of the line where the TODO is originally located.\n- Group 2: **Urgency Suffix**. Used to indicate the urgency of the TODO. The higher the amount of `O`-s, the more urgent the TODO is. (See [Urgency](#Urgency) for more info)\n- Group 3: **ID**. The number of the Issue.\n- Group 4: **Suffix**. Used as the title of the issue.\n\n### TODO Body\n\n#### Example\n\n```\n// TODO: rewrite this in Rust\n//   I honestly think Rust is going to be around forever,\n//   I really do. I think this is like, this is the formation\n//   of Ancient Greek.\n//   © https://www.reddit.com/r/programmingcirclejerk/comments/ahmnwa/i_honestly_think_rust_is_going_to_be_around/\n```\n\n#### Parsing\n\n- Snitch remembers the TODO's prefix.\n- Snitch parses all of the consecutive lines with the same prefix as the body.\n- The body is reported as the Issue Description.\n\n### Urgency\n\nThe urgency system was stolen from [fixmee](https://github.com/rolandwalker/fixmee#explanation) Emacs extension. The urgency of TODOs is indicated by repetitions of the final character of the keyword. For example, one might write TODOOOOOOOOO for an important issue. The `list` subcommand will sort the TODOs in the descending order by their urgency.\n\n## Remote specification\n\nBy default Snitch will automatically reference the `origin` remote as the defacto standard for most projects.\n\nHowever, you can specify which remote Snitch uses on a per repo basis.\n\n### .snitch.yaml\n\nRemotes are defined in `.snitch.yaml` under **remote**.\n\n#### Example\n\u003cpre\u003e\ntitle:\n  transforms:\n    - match: (.*) \\*/\n      replace: $1\n    - match: (.*) \\*\\}\n      replace: $1\nkeywords:\n  - FIXME\n\u003cb\u003eremote: \u0026ltremote\u0026gt\u003c/b\u003e\n\u003c/pre\u003e\n\n### Commandline\nRemotes can be dynamically specified when Snitch is called.\n\nThis will overide a previously defined remote in `.snitch.yaml`\n\n#### Example\n```\n$ ./snitch report --remote \u003cremote\u003e\n```\n\n## Installation\n\n```console\n$ go get github.com/tsoding/snitch\n```\n\n## Credentials\n\n### GitHub Credentials\nSnitch obtains GitHub credentials from two places:  (default) environment variable or file.\n\n#### Environment Variable\n`export GITHUB_PERSONAL_TOKEN = \u003cpersonal-token\u003e` which can be added to `.bashrc`\n\n#### File\n\nConfig file can be stored in one of the following directories:\n- `$HOME/.config/snitch/github.ini`\n- `$HOME/.snitch/github.ini`\n\nFormat:\n```ini\n[github]\npersonal_token = \u003cpersonal-token\u003e\n```\n\nCheckout [GitHub Help][personal-token] on how to get the Personal Access Token.\n\nMake sure to enable full access to private repos. For some reason it's required to post issues.\n\n### GitLab Credentials\n\nGitLab credentials configuration is similar to GitHub with an exception that you also have to provide the host of the GitLab instance.\n\n#### Environment Variable\n\n`export GITLAB_PERSONAL_TOKEN = \u003cpersonal-token\u003e` which can be added to `.bashrc`.\n\nEach of the credentials are to be separated by `,` and in format: `\u003chost\u003e:\u003cpersonal-token\u003e`. Credentials without host part, e.g. `\u003cpersonal-token\u003e` are interpreted as `gitlab.com` tokens to maintain backward compatibility and invalid tokens are ignored (prints an error message).\n\n#### File\n\nConfig file can be stored in one of the following directories:\n- `$HOME/.config/snitch/gitlab.ini`\n- `$HOME/.snitch/gitlab.ini`\n\nFormat:\n\n```ini\n[gitlab.com]\npersonal_token = \u003cpersonal-token\u003e\n\n[gitlab.local]\npersonal_token = \u003cpersonal-token\u003e\n```\n\nCheckout [GitLab Help][personal-token-gitlab] on how to get the Personal Access Token. Make sure to enable `api` scope for the token.\n\n## Usage\n\nFor usage help just run `snitch` without any arguments:\n\n```console\n$ ./snitch\n```\n\n## .snitch.yaml\n\n### Custom keywords\n\nYou don't have to use `TODO` as the keyword of a todo you want to\n\"snitch up\". The keyword is customizable through `.snitch.yaml`\nconfig:\n\n```yaml\nkeywords:\n  - TODO\n  - FIXME\n  - XXX\n  - \"@todo\"\n```\n\n### Issue Title Transformation\n\nYou can apply project local issue title transformations. Create\n`.snitch.yaml` file in the root of the project with the following\ncontent:\n\n```yaml\ntitle:\n  transforms:\n    - match: (.*) \\*/\n      replace: $1\n```\n\nThis feature is very useful for removing garbage from the Issue\nTitles. Like `*/` at the end of C comments.\n\n## Development\n\n```console\n$ export GOPATH=$PWD\n$ go get .\n$ go build .\n```\n\n### Run tests\n\n```console\n$ go test ./...\n```\n\nFor a more detailed output:\n\n```console\n$ go test -v -cover ./...\n```\n\n## Support\n\nYou can support my work via\n\n- Twitch channel: https://www.twitch.tv/subs/tsoding\n- Patreon: https://www.patreon.com/tsoding\n\n[personal-token]: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/\n[personal-token-gitlab]: https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsoding%2Fsnitch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsoding%2Fsnitch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsoding%2Fsnitch/lists"}