• Stars
    star
    416
  • Rank 104,068 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Language agnostic tool that collects TODOs in the source code and reports them as Issues

Tsoding Build Status Build Status

Snitch

A simple tool that collects TODOs in the source code and reports them as GitHub issues.

How it works

  1. Snitch finds an unreported TODO,
  2. Reports it to the GitHub as an issue,
  3. Assigns the Issue number to the TODO marking it a reported,
  4. Commits the reported TODO to the git repo,
  5. Repeats the process until all of the unreported TODOs are reported.

After that you are supposed to push the new reported TODOs yourself.

TODO Format

Unreported TODO

Example

// TODO: rewrite this in Rust

Parsing

Regular expression: ^(.*)TODO(O*): (.*)$ Play

Capture Groups:

  • Group 1: Prefix. Used only to precisly recover the text of the line where the TODO is originally located.
  • 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 for more info)
  • Group 3: Suffix. Used as the title of the issue.

Reported TODO

Example

// TODO(#42): rewrite this in Rust

Parsing

Regular expression: ^(.*)TODO(O*)\((.*)\): (.*)$ Play

Capture Groups:

  • Group 1: Prefix. Used only to precisly recover the text of the line where the TODO is originally located.
  • 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 for more info)
  • Group 3: ID. The number of the Issue.
  • Group 4: Suffix. Used as the title of the issue.

TODO Body

Example

// TODO: rewrite this in Rust
//   I honestly think Rust is going to be around forever,
//   I really do. I think this is like, this is the formation
//   of Ancient Greek.
//   © https://www.reddit.com/r/programmingcirclejerk/comments/ahmnwa/i_honestly_think_rust_is_going_to_be_around/

Parsing

  • Snitch remembers the TODO's prefix.
  • Snitch parses all of the consecutive lines with the same prefix as the body.
  • The body is reported as the Issue Description.

Urgency

The urgency system was stolen from fixmee 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.

Remote specification

By default Snitch will automatically reference the origin remote as the defacto standard for most projects.

However, you can specify which remote Snitch uses on a per repo basis.

.snitch.yaml

Remotes are defined in .snitch.yaml under remote.

Example

title:
  transforms:
    - match: (.*) \*/
      replace: $1
    - match: (.*) \*\}
      replace: $1
keywords:
  - FIXME
remote: <remote>

Commandline

Remotes can be dynamically specified when Snitch is called.

This will overide a previously defined remote in .snitch.yaml

Example

$ ./snitch report --remote <remote>

Installation

$ go get github.com/tsoding/snitch

Credentials

GitHub Credentials

Snitch obtains GitHub credentials from two places: (default) environment variable or file.

Environment Variable

export GITHUB_PERSONAL_TOKEN = <personal-token> which can be added to .bashrc

File

Config file can be stored in one of the following directories:

  • $HOME/.config/snitch/github.ini
  • $HOME/.snitch/github.ini

Format:

[github]
personal_token = <personal-token>

Checkout GitHub Help on how to get the Personal Access Token.

Make sure to enable full access to private repos. For some reason it's required to post issues.

GitLab Credentials

GitLab credentials configuration is similar to GitHub with an exception that you also have to provide the host of the GitLab instance.

Environment Variable

export GITLAB_PERSONAL_TOKEN = <personal-token> which can be added to .bashrc.

Each of the credentials are to be separated by , and in format: <host>:<personal-token>. Credentials without host part, e.g. <personal-token> are interpreted as gitlab.com tokens to maintain backward compatibility and invalid tokens are ignored (prints an error message).

File

Config file can be stored in one of the following directories:

  • $HOME/.config/snitch/gitlab.ini
  • $HOME/.snitch/gitlab.ini

Format:

[gitlab.com]
personal_token = <personal-token>

[gitlab.local]
personal_token = <personal-token>

Checkout GitLab Help on how to get the Personal Access Token. Make sure to enable api scope for the token.

Usage

For usage help just run snitch without any arguments:

$ ./snitch

.snitch.yaml

Custom keywords

You don't have to use TODO as the keyword of a todo you want to "snitch up". The keyword is customizable through .snitch.yaml config:

keywords:
  - TODO
  - FIXME
  - XXX
  - "@todo"

Issue Title Transformation

You can apply project local issue title transformations. Create .snitch.yaml file in the root of the project with the following content:

title:
  transforms:
    - match: (.*) \*/
      replace: $1

This feature is very useful for removing garbage from the Issue Titles. Like */ at the end of C comments.

Development

$ export GOPATH=$PWD
$ go get .
$ go build .

Run tests

$ go test ./...

For a more detailed output:

$ go test -v -cover ./...

Support

You can support my work via

More Repositories

1

olive.c

Simple 2D Graphics Library for C
C
1,747
star
2

musializer

Music Visualizer
C
857
star
3

porth

It's like Forth but in Python
630
star
4

pinpog

Ping-Pong-like game in Assembly that works without OS
Assembly
568
star
5

ded

Dramatic EDitor
C
565
star
6

nobuild

Header only library for writing build recipes in C.
C
528
star
7

todo.asm

Todo Web Application in flat assembler
Assembly
444
star
8

boomer

Zoomer application for Linux
Nim
441
star
9

good_training_language

Хороший Учебный Язык
Rust
381
star
10

nn.h

Simple stb-style header-only library for Neural Networks
C
332
star
11

eepers

Simple Turn-based Game
Ada
319
star
12

c.php

C to Python compiler in PHP
PHP
289
star
13

nothing

A simple platformer about nothing
C
273
star
14

Noq

Simple expression transformer that is not Coq.
Rust
253
star
15

seroost

Local Search Engine
Rust
228
star
16

arena

Arena Allocator implementation in pure C as an stb-style single-file library.
C
201
star
17

raycasting

My take on Raycasting inspired by Lode's Computer Graphics Tutorial
TypeScript
173
star
18

grecha.js

Simple Front-End JavaScript Framework
JavaScript
171
star
19

4at

Simple Multi-User Chat
Rust
162
star
20

bm

Simple compiler ecosystem
C
161
star
21

tula

Turing Language
Rust
159
star
22

emoteJAM

Simple website that generates animated BTTV emotes from static images.
JavaScript
152
star
23

JelloVM

JVM in Python that can only run "Hello, World"
Python
148
star
24

zozlib.js

Unofficial Implementation of Subset of Raylib API in JavaScript
C
146
star
25

sowon

Starting Soon Timer for Tsoding Streams
C
144
star
26

memalloc

Artifacts of that Memory Management Tsoding Session
C
143
star
27

snake-c-wasm

Snake written in Pure C and compilable to WebAssembly
C
141
star
28

haskell-json

Source Code for JSON Parser Video
Haskell
136
star
29

bfjit

JIT Compiler for Brainfuck
C
134
star
30

haskell-music

Source Code from "Making Music with Haskell" video
Haskell
130
star
31

wassm

Web framework for x86_64 nasm
Assembly
126
star
32

HyperNerd

Total Surveillance Automatic Ban Machine for Twitch and Discord
Haskell
124
star
33

sv

Simple String_View implementation for C programming language.
C
120
star
34

aoc-2020

Advent of Code 2020 in 25 Different Languages
Julia
109
star
35

todo-rs

Simple Interactive Terminal Todo App in Rust
Rust
105
star
36

la

Linear Algebra in C
C
97
star
37

ml-notes

Notes from Machine Learning in C session
C
89
star
38

fasm-raylib-simd

A simple demo of using SIMD instructions and Raylib in fasm
C
88
star
39

jaibreak

JavaScript
86
star
40

cm

Emacs' compilation-mode-like TUI application
Rust
86
star
41

perceptron

Simple Perceptron Implementation inspired by Veritasium Video
C
85
star
42

HTMLang

HTML as a Programming Language. Finally all of your dreams came true.
JavaScript
84
star
43

img2term

Print an image in the terminal using the term 256 colors
C
84
star
44

dimooper

Digital Music Looper
Rust
82
star
45

opengl-template

Just a simple OpenGL template that I use on my streams.
C
82
star
46

profun

Procedural vs Functional
C
79
star
47

binviz

Binary Visualization based on Christopher Domas talk: https://www.youtube.com/watch?v=4bM3Gut1hIk
C
76
star
48

articles

Here I keep some thoughts that I always wanted to write down somewhere, but never knew where.
TeX
74
star
49

noed

Not ed(1) text editor
C
68
star
50

SmoothLife

SmoothLife Implementation in C
C
68
star
51

bada

Simple Programming Language that compiles to BEAM bytecode
Rust
67
star
52

faq

FAQ
66
star
53

kdtree-in-python

Source Code for K-d tree in Python series
Python
66
star
54

jai-wasm

Jai WebAssembly Proof-of-Concept
JavaScript
64
star
55

rendering-video-in-c-with-ffmpeg

Rendering Video in C with FFMpeg
C
63
star
56

multiplayer-game-prototype

Proof-of-concept of a Simple Multiplayer Game
TypeScript
61
star
57

tic-tac-toe-fortran-raylib

Tic-Tac-Toe in Fortran with Raylib
Fortran
57
star
58

flag.h

Command-line flag parsing in C
C
56
star
59

jim

Immediate Mode JSON Serialization Library in C
C
54
star
60

seam-carving

Seam Carving implementation
C++
54
star
61

minicel

Simple Excel engine without any UI
C
53
star
62

piff

Simple File Diff Tool in Python
Python
53
star
63

glob.h

Simple Header-Only Implementation of Glob Matching
C
51
star
64

mine

Minesweeper in Terminal
Pascal
51
star
65

bi-format

Structured Human-Readable Binary Format
50
star
66

ebisp

Embedded Lisp
C
49
star
67

zigout

An attempt to implement breakout in Zig
Zig
49
star
68

something-rewrite

Rewrite of Something from scratch
C
48
star
69

autocell

Cellular Automata Experiment
TypeScript
46
star
70

wang-tiles

Wang Tiles Grid generator
C
46
star
71

rere.py

Universal Behavior Testing Tool in Python.
Python
45
star
72

conway

Conway's Game of Life implementation in C formatted as Glider
C
45
star
73

something

Finally something
C
44
star
74

imhui

Immediate Human User Interface
C
42
star
75

vodus

Twitch VOD chat renderer
C
41
star
76

markut

Autocut the Twitch VODs based on a Marker file
Go
40
star
77

subframes

Simple Experiment with Subframe rendering
C
40
star
78

elf.js

An on going project to learn ELF format.
TypeScript
39
star
79

rcui

Simple TUI framework in Rust
Rust
37
star
80

voidf

V̳͙̥̹̟͗̀̎̓͌͐́O̘̞͇̞̣͇͕͂͠I͙̋͐̍͂̀D̶͕̩̦̲͙F̟̖̮ͩ̏ͥ̂ͨ͠ ͍̰̫̯͙̯ͨ̉ͤ̈̿ͭI̤͍̲̯ͤ̎̀͝S̴̻͇̳̗̩ͧ̆ ̭̘̦ͭ͒Ĉ̸̰̼̤̖̲O̹̭̞̺̻͚̣̒M̪͓̗̤͋͢Ĩ͔̗̣̻̄̏̏̏̚N̳̦̂ͯ̅͂̓̈́G͈̣
C
36
star
81

stb_image_js

stb_image.h wrapper for a Web Browser
C
36
star
82

data-mining-in-c

Notes and Source Code from the Data Mining in C series.
C
36
star
83

rust-browser-game

Bloat-Free Browser Game in Rust (rustc-only challenge)
Rust
35
star
84

simple-ocaml-raylib-template

Intentionally Simple Raylib OCaml Template
OCaml
35
star
85

voronoi-opengl

Voronoi with OpenGL using Depth Buffer
C
34
star
86

parcoom

Parser Combinators of Monad
OCaml
31
star
87

wacket

Racket to WebAssembly "compiler".
Racket
30
star
88

deque.py

Deque-based Programming Language
Python
30
star
89

zzzwe

zzzwe
JavaScript
29
star
90

command-pattern

Command Pattern (an Imperative one)
Rust
29
star
91

schedule

Schedule for Tsoding Streams
TypeScript
28
star
92

dedup

Duplicate Files Searcher
C++
28
star
93

turd

Turing Machine in D
D
28
star
94

skedudle

Simple Event Schedule Web Application in C
C
27
star
95

bezier

Just a fun little project to learn how to render Bézier Curves.
C
27
star
96

wisp

Wisp is a set of simple scripts for setting up small QEMU-based Virtual Machines
Shell
27
star
97

ht

This is the notes from a Hash Table in C stream.
C
26
star
98

turj

Turing Machine in Jai
C
26
star
99

atomato

A collection of different Cellular Automata implementations for recreational purposes
C
25
star
100

rope-jai

Rope simulation in Jai
24
star