-
Notifications
You must be signed in to change notification settings - Fork 153
Roles rules #19
Comments
Hi Phil, Sounds useful. To flesh this out a bit more:
Rules that could be added using this:
For now I'd leave out:
Thanks, Andrew. |
Yeah. I'd need to be able to call it without a cookbook - we run FC as a svn pre-commit, so if no cookbook was changed in the precommit, there's nothing to check. Which begs the question, perhaps FC should take -C and -R, and, optionally, at some point in the future perhaps drop the "arguments are cookbook paths" behavior? Both of those checks sound awesome to me. I agree there's no reason to support JSON roles since those are deprecated anyway... and yeah, we shouldn't infer paths. |
We could take a type flag and keep the same These would be equivalent:
These would be equivalent:
This would mean that you couldn't check both cookbooks and roles in one command. |
how about I don't like the type option... that makes me sad. |
Can you elaborate on why? I prefer type to mixed case which would annoy me because I'd expect the option case to be consistent and guess incorrectly. Type means we could also extend linting to environments or other stuff without an exploding list of cmd options. |
Because (1) My primary use-case is a precomit where I want to be able to lint everything in one pass and (2) I don't want to have to run FC twice for myself or make other people do it either. If you want consistent cases then -R for roles and -B for cookbooks? |
I think you're right that the ability to lint everything in one go trumps misgivings about the number of arguments. So just to summarise for clarity: These would be equivalent:
These would be equivalent:
Leaving us open for:
Ok? |
And these would all be valid:
|
Perfect! |
Awesome. I'll look to implement this soon. Thank you for contributing your ideas and making foodcritic better - keep 'em coming! |
Is the filename already available to rules? If not, I think it'll be particularly useful for roles and environments... |
The filename is passed as the second argument to the block: recipe do |ast,filename|
# ...
end In the case of the |
Sorry for the delay - I haven't forgotten about this. |
Any updates? |
Ping? |
- FC049: Role name does not match containing file name - FC050: Name includes invalid characters Currently we only understand roles in Ruby format. Roles must be in a role path (specified with --role-path or -R) to be checked. Cookbook paths may now alternatively be specified with --cookbook-path / -B. This commit introduces breaking changes to the FoodCritic::Linter interface.
Hi Phil, This was released in foodcritic 3.0.0. Thanks, Andrew. |
How do you feel about implementing roles rules?
I'm about to write an SVN pre-commit that enforces the name of the role file is also the name of the role, which is easy to do outside of FC, but since you can define attributes and stuff in roles, it may be cool to have the FC framework for them.
The text was updated successfully, but these errors were encountered: