-
Notifications
You must be signed in to change notification settings - Fork 153
Provide a comprehensive list of tags
somewhere on the docs
#63
Comments
Thanks Mike. The tags are available in the YAML Front Matter against each rule so in theory (aside from Liquid limitations) this shouldn't be too hard to add to the docs. I think there's a separate feature to be able to see from the command line the effective set of rules that would be applied given tag expressions and included rules. |
Challenge accepted. Here's the same, in ruby. require 'open-uri'
require 'yaml'
input = YAML.load(open('https://raw.github.com/acrmp/foodcritic/gh-pages/index.html') {|f| f.read })
tags = Array.new
input['rules'].each do |rule|
tags << rule['tags']
end
puts tags.flatten.uniq.sort Output is the same list. |
Hi Mike, Thanks. My response probably should have included some more detail though. The foodcritic docs are hosted on GitHub pages and use Jekyll. The rule data expressed in the YAML Front Matter is rendered by Liquid templates. Here's an example of the template that renders the rules section of the docs. Using Liquid if we can would be the first preference, in order to make use of the same data and templating mechanism. Cheers, Andrew. |
Hey Andrew, I took a stab at it, and now hate Liquid. :) It's not the best documented thing int he world, and accessing data from it is somewhat restricted, and the data returned very String-y. Here's a snippet I tried, and since there's no
Sorting an array exists, but getting the data from the YAML, back to an array vs a string format, and then sorting it, the whole thing seems very unwieldy. I experimented briefly with the plugin system, and could not figure out how to: a) use the tagging system with a "non-array" structure like this tag list. Even if a tag works, there's still the issue of Anyways, I hope you have more luck than I, and I'd be curious to see how this gets solved. |
Hi Mike, I'm currently refreshing the docs and have added a list of rules by tag here: The new docs are in the foodcritic-site repository. Cheers, Andrew. |
Hi Andrew, Looks awesome, thanks for following up! I looked at the code, and I think this helper method isn't explicity always going to work. I'll open a ticket on that repo, and I think this one is good to close out. Thanks! |
There's a bunch of potential tags, and when looking at a given rule, once can see the tags for a given rule.
There's no 'listing' of what tags there are, so here's a wonderful one-liner that does this.
Add a
-c
touniq
to see that there are 17 correctness rules and 14 style rules.The text was updated successfully, but these errors were encountered: