Skip to content
This repository has been archived by the owner on Sep 19, 2020. It is now read-only.

Foodcritic silently marks the run as successful when error is found in .foodcritic or in inline rule. #656

Open
timurb opened this issue Jul 18, 2017 · 4 comments
Labels

Comments

@timurb
Copy link

timurb commented Jul 18, 2017

Foodcritic silently marks the run as successful when error is found in .foodcritic or in inline rule.

Example:

$ cat .foodcritic
~license
~supermarket
$ foodcritic .
Checking 2 files
.x
FC009: Resource attribute not recognised: ./recipes/default.rb:43
FC009: Resource attribute not recognised: ./recipes/default.rb:59
$

Now add something to .foodcritic:

$ cat .foodcritic
~license
~supermarket
asdasd
timurb@MBP-777:chef-sdstunnel (master *)$ foodcritic .
Checking 2 files
..
$

I'm running Foodcritic 11.2.0:

$ foodcritic --version
foodcritic 11.2.0

The same behaviour is seen in inline rules disabling but just spans for the duration of the rule.

Another issue here (not sure if it is just shadowed by this one) — how to create comments in .foodcritic? If I put the # anywhere my whole run is just marked as passed no matter what is really in my cookbooks.

@timurb timurb changed the title Comments in rule Comments in disable rule lines Jul 18, 2017
@timurb timurb changed the title Comments in disable rule lines Foodcritic silently marks the run as successful when error is found in .foodcritic or in inline rule. Jul 18, 2017
@coderanger
Copy link
Contributor

When you specify a non ~ tag, you're requesting to only run rules matching that tag. There are no rules with the asdasd tag so there were no errors found.

@timurb
Copy link
Author

timurb commented Jul 19, 2017

I'd expect foodcritic to produce error then if that's unknown tag, or at least a warning.
Otherwise you may make a typo and never know about that.

(That might be the explanation of comments marking check as successful — they are treated as tags to select).

@gmeneze
Copy link

gmeneze commented Aug 14, 2017

If there are multiple non ~ tags, which are all valid foodcritic tags, it unexpectedly marks everything as successful.
Example : -

bash-3.2$ cat .foodcritic
FC071

Now, on running foodcritic i get : -

bash-3.2$ foodcritic .
Checking 7 files
x......
FC071: Missing LICENSE file: ./LICENSE:1`

Which is as expected. But suppose I list 2 tags in there, like this : -

bash-3.2$ cat .foodcritic
FC071
FC066

Now, on running foodcritic i get : -

bash-3.2$ foodcritic .
Checking 7 files
.......

@tas50
Copy link
Contributor

tas50 commented Nov 13, 2017

We should probably add some logic to do a bit of validation on the tags. It would be useful to specify what tags we were running with as well.

@tas50 tas50 added the Bug label Nov 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants