7 ms·
Show HN: Summarise all code annotation like TODO or FIXME
- Ruud-v-A 10y agoOr you could just run `git grep --line-number TODO`.
- ahmadassaf 10y agothis will give you any line that has `TODO` in them, whether that was a TODO comment or just an occurrence of that word. An example: README.md:149: * Must have one of the words: NOTE, OPTIMIZE, TODO, HACK, XXX, FIXME, or BUG which brought this from the readme file but it was not a "real" to do. you can then start thinking of passing regex to the grep, and trying to catch all the other annotations like FIXME, NOTE, etc. and then again you need a way to start ignoring certain files, maybe you do not want to check all the files in your node_modules, etc. All in all, this module is just a little helper that tries to solve all these little issues. Thanks for the pointer :)
- onion2k 10y agoWouldn't 'git grep --line-number ^TODO' fix that (only match TODO at the start of a line)? Maybe with some whitespace matching if you indent your TODOs?
- cryptarch 10y agoI don't put my TODO's at the start of lines? Usually only in single-line comments after some code. I think a script with a few grep invocations for all code files with lines containing TODO/FIXME etc. is about right, takes minutes to set up and will work for all but the most obscure cases. It'll easily deal with your README.md case.
- StavrosK 10y agoI'm not convinced that "^\s(//|#|--)\s(TODO|FIXME|XXX)\s*:" (i.e. a fairly simple regex) isn't a plausible way to do what's required of this. All the colors and everything are nice, but a simple bash script sounds eminently doable.
- cryptarch 10y agoYou can easily get the colors and fancy UTF chars with an xargs | printf so a Bash/sh script should do fine.
- seanp2k2 10y agoAck is also great for stuff like this, and easy to run as a hook or NPM thing https://beyondgrep.com https://beyondgrep.com
- smarx007 10y agoHow can I report issues? The tool tries to scan PNG files in the repo as well the .git folder of the repo as well.
- ahmadassaf 10y agoyou can report issues in the github repo. However, if you want to ignore files and folders you need to pass those patterns to the function. For example, you want to exclude .git and .png then you need to run the command: notes -x *.git/ -x *.png in general if you want to exclude hidden files and folders you need to run it with -h true which excludes hidden dirs and files, so you can run notes -h true -x *.png
- Retr0spectrum 10y agoType \* to get *.
- ahmadassaf 10y agoah sweet ! thanks will update now
- ahmadassaf 10y agostill not luck with me .. weird
- deleted 10y ago[deleted]
- StreakyCobra 10y agoIt would be so much nicer to define better defaults. Like what… 99.99% of the users are never, ever, wanting to see notes that are in the `.git` repository, nor in PNG or any other images. Even hidden dirs and files should not be searched by default I think. All this will cause nightmares to users before they start using it, like the first-poster of this thread had. Provide better defaults, make it vcs-aware (ignored files, etc…) and you will have a much more appreciated product! It is for the same reason that `rg`/`ag`/`pt` are used nowadays instead of `grep`. 99.99% of the time, you don't want to search files that are ignored by your VCS, and you want to search recursively, and also probably in a case-insensitive way. For `grep` you have to fight with tons of options to filter out files, to enable recursivity and to ignore case. With `ag`? just `ag whatever`. Defaults make the difference.
- maaaats 10y agoWould having a git push hook that checks for remaining/added todos with this be a good idea?
- pryelluw 10y agoBuild it! Ill test it. :)
- ahmadassaf 10y agocool ! let me know what you think
- pryelluw 10y agoEmail in my profile
- willemmali 10y agoI just built one, would you mind having a look at it? https://gitlab.com/willemmali-sh/todo https://gitlab.com/willemmali-sh/todo PR's/issues welcome!
- ahmadassaf 10y agothat was the whole idea behind building this :) automate code audit and checks via git hooks
- pimterry 10y agoSee https://github.com/pimterry/git-confirm https://github.com/pimterry/git-confirm, which does exactly this for TODOs, or for anything else you can spot with a regex (ignored tests, git conflict markers, etc etc). All in a single bash script you can curl directly into place, so it's independent of Node/Ruby/etc.
- jacquesm 10y agoThere was this too: https://github.com/JohnPostlethwait/fixme https://github.com/JohnPostlethwait/fixme
- ahmadassaf 10y agoactually the tool is mainly based on this tool .. but the guy is not maintaining it and i decided to fill in some of the gaps. Thanks for the pointer though
- cursive 10y agoI am John Postlethwait. You could have submitted a PR. That's when/how open source works. I even state that I am happy to look at incoming changes, I'm just not actively maintaining it. This is a very minor, nigh silly, project but this sort of wanton bifurcation hurts open source's reputation and is already a huge problem in the Node community.
- jmiserez 10y agoWhile I agree in general that PRs are better than forks, I don't think what you're saying is totally fair. Your choice of licensing explicitely allows forks (and almost anything else) to happen. There have been many discussions on the topic [1], and there is no easy solution. Then, your choice of words is not ideal: >NOTE: I no longer actively maintain this package. I'd love to get PRs to keep it going though! If it's not maintained anymore then I as a developer don't really gain anything (bugfixes, features) by submitting a PR vs. just forking myself. So the choice to fork is understandable, even if it's not what you intended to happen. [1] https://arstechnica.com/information-technology/2014/10/how-do-you-avoid-being-forked-into-oblivion/ https://arstechnica.com/information-technology/2014/10/how-d...
- LeFever 10y agoExcept it isn't a fork. It's basically two projects merged into a new one and a small blurb in the readme to that effect. Why not fork and contact John about taking the original one over? If he doesn't respond within a reasonable time, run with the fork. I don't get the sense that happened here. I think the issue is less about license and more about what is good form and helps to keep the ecosystem a bit less cluttered.
- buckhx 10y agoAnyone know of a vim plugin that has similar functionality?
- glabsounet 10y agoIsn't a script and the :cexpr command enough?
- kevincox 10y agoOr just :grep?
- thedjinn 10y agoFor those not working with JavaScript here's the same thing made with 40 lines of Ruby and no external dependencies. https://gist.github.com/thedjinn/17c68d1e62b5594581625c016b00e42a https://gist.github.com/thedjinn/17c68d1e62b5594581625c016b0...
- ahmadassaf 10y agonice ! would be nice as well if you can pass exclusion rules for files, extensions and directories
- Nition 10y agoVisual Studio also has this. View -> Task List.
- seanp2k2 10y agoPycharm and IIRC all of the IntelliJ-based IDEs also have this built in https://blog.jetbrains.com/pycharm/2013/06/working-with-todo-in-pycharm/ https://blog.jetbrains.com/pycharm/2013/06/working-with-todo...
- deleted 10y ago[deleted]
- tedmiston 10y agoWould be awesome if you could hit return on an issue in the list and navigate to it in your editor. This would be pretty trivial with the Sublime CLI, for example in Python: import os os.system('subl foo.py:10')
- andrepd 10y agoGreat. A 100-line python or perl (or even bash) script instead requires the whole machinery of node.js to work. Brave new world.
- cryptarch 10y agoI'm writing an `sh`-based version, should take about 20 minutes minus the fluff.
- kaushalmodi 10y agoPlease share when done.
- cryptarch 10y agoI'm starting writing now, was already too late to start last night.
- cryptarch 10y agoI'll just leave this here: https://gitlab.com/willemmali-sh/todo https://gitlab.com/willemmali-sh/todo
- kaushalmodi 10y agoThanks! Will give it a shot.
- cryptarch 10y agoCool, hope it works well for you :) If not, I'd greatly appreciate some feedback, I'm newish to sh programming and CLI design in general.
- cryptarch 10y agoPada: https://gitlab.com/willemmali-sh/todo https://gitlab.com/willemmali-sh/todo
- midgetjones 10y agoIf you're using Rails, you can do `rake notes`
- willemmali 10y agosh-based alternative and shameless plug: https://gitlab.com/willemmali-sh/todo https://gitlab.com/willemmali-sh/todo Fresh off the press, please let me know if you have feature requests or find bugs. Edit: is my tone off-putting or did I break some social norm here?
- ahmadassaf 10y agogreat stuff .. will try it out now and let you know
- willemmali 10y agoCool, hope it's useful to you :)