Cache the lookups per cookbook so we don't have to go looking for a .foodcritic file for every file we find in the cookbook. In our chef-cookbooks org this reduces the number of times we check disk for the .foodcritic file and then parse its contents from 1379 (1 per file) to 120 (1 per cookbook). This reduces the Foodcritic runtime by 2.83% on my system with a nice fast SSD. That percent is only going to go up as disk gets slower.
The PR also improves failure behaviors with bad/missing rule files:
Fail if the user specifies a rule file on the CLI and it's not there. Previously we just silently continued, which is awful
Fail if we can't read or parse the rule file, which resolves another complaint about how we handle failures in these files
Cache the lookups per cookbook so we don't have to go looking for a .foodcritic file for every file we find in the cookbook. In our chef-cookbooks org this reduces the number of times we check disk for the .foodcritic file and then parse its contents from 1379 (1 per file) to 120 (1 per cookbook). This reduces the Foodcritic runtime by 2.83% on my system with a nice fast SSD. That percent is only going to go up as disk gets slower.
The PR also improves failure behaviors with bad/missing rule files:
Signed-off-by: Tim Smith tsmith@chef.io