News for hackers. Stuff that matters.
Re:Show HN: Summarise all code annotation like TODO or FIXME by jacquesm on Sunday February 26, 2017 @02:35PM (#13739279)
Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Sunday February 26, 2017 @02:43PM (#13739341)
actually 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
Re:Show HN: Summarise all code annotation like TODO or FIXME by cursive on Sunday February 26, 2017 @03:32PM (#13739661)
I 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.

Re:Show HN: Summarise all code annotation like TODO or FIXME by jmiserez on Sunday February 26, 2017 @05:02PM (#13740219)
While 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-d...

Re:Show HN: Summarise all code annotation like TODO or FIXME by jacquesm on Sunday February 26, 2017 @05:48PM (#13740467)
The name on the license was changed I think that totally justifies the remarks made and they were made extremely courteous given the situation.

Forking is fine, merging two packages is fine, removing the authors name from the license (while leaving his name all over the rest of the package, which shows that there is no malicious intent, merely some confusion) is not.

Re:Show HN: Summarise all code annotation like TODO or FIXME by LeFever on Sunday February 26, 2017 @05:41PM (#13740444)
Except 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.

Re:Show HN: Summarise all code annotation like TODO or FIXME by jmiserez on Sunday February 26, 2017 @04:39PM (#13740064)
Just in case you didn't know: If you used portions of Johns code, you agreed to the terms of his license. As such, you're required to include Johns name in the copyright notice, as the license specifies that thte copyright notice should be reproduced in full. You can add your own name above that, but you still have to keep the complete original copyright notice with Johns name in there [1].

Not doing that is not nice, and in the worst case could get you in legal trouble.

Original license: https://github.com/JohnPostlethwait/fixme/blob/master/LICENS... Your license: https://github.com/ahmadassaf/code-notes/blob/master/LICENSE...

[1] http://softwareengineering.stackexchange.com/questions/17823...

Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Sunday February 26, 2017 @05:10PM (#13740277)
thanks a lot for the pointers. I have just updated the license (actually copied Johns license and just added my name next to his)

I missed that with no intention of ignoring the great work of John

Re:Show HN: Summarise all code annotation like TODO or FIXME by Ruud-v-A on Sunday February 26, 2017 @01:34PM (#13738795)
Or you could just run `git grep --line-number TODO`.
Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Sunday February 26, 2017 @01:39PM (#13738832)
this 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 :)

Re:Show HN: Summarise all code annotation like TODO or FIXME by onion2k on Sunday February 26, 2017 @04:59PM (#13740194)
Wouldn'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?
Re:Show HN: Summarise all code annotation like TODO or FIXME by cryptarch on Sunday February 26, 2017 @06:16PM (#13740582)
I 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.

Re:Show HN: Summarise all code annotation like TODO or FIXME by StavrosK on Sunday February 26, 2017 @06:29PM (#13740660)
I'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.
Re:Show HN: Summarise all code annotation like TODO or FIXME by cryptarch on Monday February 27, 2017 @07:22AM (#13743684)
You can easily get the colors and fancy UTF chars with an xargs | printf so a Bash/sh script should do fine.
Re:Show HN: Summarise all code annotation like TODO or FIXME by seanp2k2 on Monday February 27, 2017 @05:46AM (#13743306)
Ack is also great for stuff like this, and easy to run as a hook or NPM thing https://beyondgrep.com
Re:Show HN: Summarise all code annotation like TODO or FIXME by thedjinn on Sunday February 26, 2017 @02:42PM (#13739335)
For 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/17c68d1e62b5594581625c016b0...

Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Sunday February 26, 2017 @02:45PM (#13739356)
nice ! would be nice as well if you can pass exclusion rules for files, extensions and directories
Re:Show HN: Summarise all code annotation like TODO or FIXME by tedmiston on Sunday February 26, 2017 @04:54PM (#13740155)
Would 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')
Re:Show HN: Summarise all code annotation like TODO or FIXME by buckhx on Sunday February 26, 2017 @02:42PM (#13739330)
Anyone know of a vim plugin that has similar functionality?
Re:Show HN: Summarise all code annotation like TODO or FIXME by glabsounet on Sunday February 26, 2017 @05:34PM (#13740415)
Isn't a script and the :cexpr command enough?
Re:Show HN: Summarise all code annotation like TODO or FIXME by kevincox on Sunday February 26, 2017 @09:46PM (#13741455)
Or just :grep?
Re:Show HN: Summarise all code annotation like TODO or FIXME by Nition on Sunday February 26, 2017 @04:09PM (#13739878)
Visual Studio also has this. View -> Task List.
Re:Show HN: Summarise all code annotation like TODO or FIXME by seanp2k2 on Monday February 27, 2017 @05:48AM (#13743312)
Pycharm and IIRC all of the IntelliJ-based IDEs also have this built in https://blog.jetbrains.com/pycharm/2013/06/working-with-todo...
Re:Show HN: Summarise all code annotation like TODO or FIXME by smarx007 on Sunday February 26, 2017 @02:11PM (#13739101)
How can I report issues? The tool tries to scan PNG files in the repo as well the .git folder of the repo as well.
Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Sunday February 26, 2017 @02:13PM (#13739121)
you 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
Re:Show HN: Summarise all code annotation like TODO or FIXME by StreakyCobra on Sunday February 26, 2017 @02:48PM (#13739372)
It 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.

Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Sunday February 26, 2017 @03:16PM (#13739560)
i actually ignore a bunch of file extensions

   const BAD_EXTENSIONS = ["!*.jpg", "!*.jpeg", "!*.mov", "!*.mp3", "!*.gif", "!*.png", "!*.log", "!*.bin", "!*.psd", "!*.swf", "!*.fla", "!*.ico"];
I was wondering why `.png` was scanned. However, your comment makes so much sense and it will be wise to add default folders like .git as well

Thanks a lot for that, ill be looking forward to what defaults people also want to have :)

Re:Show HN: Summarise all code annotation like TODO or FIXME by StreakyCobra on Sunday February 26, 2017 @04:15PM (#13739910)
Glad to hear my comment inspired you :-) Good luck with this!

PS: Another idea: Instead of selecting manually what extensions should be used or not, you may want to try being more general, like enabling by default all text-like files, and disabling all data-like files. Maybe with `file --mime` then looking at charset value:

    test.jpg: image/jpeg; charset=binary
    manage.py: text/x-python; charset=us-ascii
Re:Show HN: Summarise all code annotation like TODO or FIXME by wjdp on Sunday February 26, 2017 @03:24PM (#13739611)
There should be the option for an include pattern. I wanted to only check *.py files, this is very cumbersome to do with only excludes.
Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Sunday February 26, 2017 @05:04PM (#13740238)
just realised a fix where you can now:

   notes -i *.py
I hope this helps :)
Re:Show HN: Summarise all code annotation like TODO or FIXME by wjdp on Sunday February 26, 2017 @05:14PM (#13740304)
Fab, cheers
Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Sunday February 26, 2017 @03:37PM (#13739701)
interesting .. will try and fix that.

Thanks for the pointer

Re:Show HN: Summarise all code annotation like TODO or FIXME by kirubakaran on Sunday February 26, 2017 @02:55PM (#13739422)
If you prefix those lines with 4 spaces, it will be interpreted as code, instead of the asterisk being interpreted as <strong>

Example:

   rm -rf *
Re:Show HN: Summarise all code annotation like TODO or FIXME by smarx007 on Sunday February 26, 2017 @05:58PM (#13740508)
Well, you've disabled issues on the repo, that's why I ask.
Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Monday February 27, 2017 @07:41AM (#13743768)
my bad .. did not know they were disabled
Re:Show HN: Summarise all code annotation like TODO or FIXME by Retr0spectrum on Sunday February 26, 2017 @02:34PM (#13739270)
Type \* to get *.
Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Sunday February 26, 2017 @02:41PM (#13739327)
ah sweet ! thanks will update now
Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Sunday February 26, 2017 @02:44PM (#13739346)
still not luck with me .. weird
Re:Show HN: Summarise all code annotation like TODO or FIXME by maaaats on Sunday February 26, 2017 @02:33PM (#13739254)
Would having a git push hook that checks for remaining/added todos with this be a good idea?
Re:Show HN: Summarise all code annotation like TODO or FIXME by pimterry on Monday February 27, 2017 @12:28PM (#13745932)
See 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.
Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Sunday February 26, 2017 @02:40PM (#13739319)
that was the whole idea behind building this :) automate code audit and checks via git hooks
Re:Show HN: Summarise all code annotation like TODO or FIXME by pryelluw on Sunday February 26, 2017 @02:36PM (#13739290)
Build it! Ill test it. :)
Re:Show HN: Summarise all code annotation like TODO or FIXME by willemmali on Monday February 27, 2017 @10:13AM (#13744778)
I just built one, would you mind having a look at it?

https://gitlab.com/willemmali-sh/todo

PR's/issues welcome!

Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Sunday February 26, 2017 @02:40PM (#13739321)
cool ! let me know what you think
Re:Show HN: Summarise all code annotation like TODO or FIXME by pryelluw on Sunday February 26, 2017 @02:56PM (#13739428)
Email in my profile
Re:Show HN: Summarise all code annotation like TODO or FIXME by midgetjones on Monday February 27, 2017 @07:34AM (#13743740)
If you're using Rails, you can do `rake notes`
Re:Show HN: Summarise all code annotation like TODO or FIXME by willemmali on Monday February 27, 2017 @10:14AM (#13744792)
sh-based alternative and shameless plug:

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?

Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Monday February 27, 2017 @01:02PM (#13746274)
great stuff .. will try it out now and let you know
Re:Show HN: Summarise all code annotation like TODO or FIXME by willemmali on Monday February 27, 2017 @06:49PM (#13749740)
Cool, hope it's useful to you :)
Re:Show HN: Summarise all code annotation like TODO or FIXME by andrepd on Sunday February 26, 2017 @05:03PM (#13740227)
Great. A 100-line python or perl (or even bash) script instead requires the whole machinery of node.js to work. Brave new world.
Re:Show HN: Summarise all code annotation like TODO or FIXME by ahmadassaf on Monday February 27, 2017 @07:51AM (#13743807)
there is a coffee script implementation that is a bit more than 100 lines https://github.com/awebdev/node-notes/blob/master/src/notes..... I don't see why the number of lines something is written in would affect people's choice of using it
Re:Show HN: Summarise all code annotation like TODO or FIXME by cryptarch on Sunday February 26, 2017 @06:18PM (#13740600)
I'm writing an `sh`-based version, should take about 20 minutes minus the fluff.
Re:Show HN: Summarise all code annotation like TODO or FIXME by cryptarch on Monday February 27, 2017 @10:12AM (#13744771)
Re:Show HN: Summarise all code annotation like TODO or FIXME by kaushalmodi on Monday February 27, 2017 @01:58AM (#13742407)
Please share when done.
Re:Show HN: Summarise all code annotation like TODO or FIXME by cryptarch on Monday February 27, 2017 @07:23AM (#13743690)
I'm starting writing now, was already too late to start last night.
Re:Show HN: Summarise all code annotation like TODO or FIXME by cryptarch on Monday February 27, 2017 @10:12AM (#13744764)
I'll just leave this here:

https://gitlab.com/willemmali-sh/todo

Re:Show HN: Summarise all code annotation like TODO or FIXME by kaushalmodi on Monday February 27, 2017 @12:51PM (#13746185)
Thanks! Will give it a shot.
Re:Show HN: Summarise all code annotation like TODO or FIXME by cryptarch on Monday February 27, 2017 @06:51PM (#13749750)
Cool, 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.