Skip to content
Browse files

FC020: Don't warn for file paths, refs #30.

  • Loading branch information...
1 parent 254eeab commit e87dfa7b61ce533e33e166e7bbe71617b3fad69f @acrmp committed May 21, 2012
Showing with 3 additions and 0 deletions.
  1. +2 −0 features/020_check_for_conditional_ruby_string.feature
  2. +1 −0 lib/foodcritic/api.rb
View
2 features/020_check_for_conditional_ruby_string.feature
@@ -22,3 +22,5 @@ Feature: Check for conditional attributes that look like Ruby
| only_if "foo --bar" | not shown |
| not_if 'ls -1 \| grep foo' | not shown |
| not_if '::File.directory?(node[:foo])' | shown |
+ | only_if "/usr/bin/id #{user_to_delete} > /dev/null" | not shown |
+ | not_if "/usr/sbin/groupmod #{jetty_settings['group']}" | not shown |
View
1 lib/foodcritic/api.rb
@@ -187,6 +187,7 @@ def match(node)
def os_command?(str)
str.start_with?('grep ', 'which ') or # common commands
str.include?('|') or # a pipe, could be alternation
+ str.include?('/') or # file path delimiter
str.match(/^[\w]+$/) or # command name only
str.match(/ --?[a-z]/i) # command-line flag
end

0 comments on commit e87dfa7

Please sign in to comment.
Something went wrong with that request. Please try again.