rrrene / credo-proposals

Proposals for Credo, the Elixir code analysis tool with a focus on code consistency and teaching
MIT License
9 stars 0 forks source link

Proposal: Add support for regex-excluding comments from the TODO checker #36

Open nyaray opened 5 years ago

nyaray commented 5 years ago

Environment

What were you trying to do?

Keeping TODOs out is good, but sometimes you find things and want to reference an issue, for that it would be nice to be able to pre-approve lines using a regex.

For example, I'm working on issue 23 and see something that would be great to change when dealing with issue 54, so I write: # (#54) TODO: adjust the flux capacitor properly

Expected outcome

No warning for the described TODO comment.

Actual outcome

I get a warning for the described TODO comment.

rrrene commented 5 years ago

@nyaray I played around with this idea on a branch: 0c30d9c

Is this what you had in mind?

nyaray commented 5 years ago

So, I wrote my example comment incorrectly 🤦‍♂ ... It was supposed to be # TODO: (#54) adjust the flux capacitor properly.

As the TODO above gives me credo issues I guess the proposal remains, but I should probably clarify my request as it seems the logic got inverted somewhere after I had the idea and spilled my word soup of a description.

When I prefix the description of the TODO (# TODO: <PREFIX HERE> description bla bla bla), I'd like to be able to make the TODO check skip lines where the description prefix is present. Those TODOs are plans/observations for a later task, which I want credo to ignore.

I think what I am requesting is an exclusion pattern, but that might already be possible, no?