I'm using up-to-date versions
.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-6.0.3.3/lib/rails.rb
if you run rails notes -a [" "]
you receive a clean list with NO typos. However if you run rails notes -a ["literally_any_single_letter"]
every line that gets printed out is missing the first letter of their description. Very odd to me.
I understand I may not be using 'notes' correctly but I was diving around trying to learn and this is what I observed.
The notes matcher is relativelysimple-minded. It searches for any comment that starts with one of the specified annotations. The default annotations are TODO
, FIXME
, and OPTIMIZE
, but, you can specify any annotations you want with -a
or --annotations=tag1 tag2 ...
. If multiple annotations are specified, they are preserved in the output for clarity:
% rails notes -a TODO FOO
app/models/foo.rb:
* [2] [TODO] Add stuff
* [3] [TODO] even more missing stuff
* [4] [FOO] this is foo
If you only specify one annotation, it 'eats' the annotation to clean up the output:
rails notes -a TODO
app/models/foo.rb:
* [2] Add stuff
* [3] colon is optional
So, if you define a single-letter annotation, you will a) get every comment that starts with the letter, and b) it will helpfully 'eat' the letter in the output.
% rails notes -a T
app/javascript/packs/application.js:
* [ 1] his file is automatically compiled by Webpack, along with any other files
app/models/foo.rb:
* [ 2] ODO: Add stuff
* [ 3] ODO colon is optional
Since your example included wrapping the annotation in brackets ([]), I should note that you might be surprised at the results doing that. The notes
command allows you to use regular expressions at least in a limited way when specifying annotations. In Ruby regex, [abc]
means 'match any one of a, b, or c'. So:
% rails notes -a [TD]ODO
app/models/foo.rb:
* [2] [TODO] Add stuff
* [3] [TODO] even more missing stuff
* [4] [DODO] some dodo