Skip to content

Commit

Permalink
Fixed the false positive issue with CronDFileOrTemplate
Browse files Browse the repository at this point in the history
Signed-off-by: Ashique P S <Ashique.saidalavi@progress.com>
  • Loading branch information
ashiqueps committed Mar 13, 2023
1 parent e7244d1 commit 6a1830e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class CronDFileOrTemplate < Base

def on_block(node)
file_or_template?(node) do |file_name|
break unless file_name.start_with?('/etc/cron.d')
break unless file_name.match?(%r{/etc/cron\.d\b}i)
add_offense(node, severity: :refactor)
end

Expand All @@ -110,7 +110,7 @@ def on_block(node)
# and check if their value contains '/etc/cron.d'
# covers the case where the argument to the path property is provided via a method like File.join
code_property.each_descendant do |d|
add_offense(node, severity: :refactor) if d.respond_to?(:value) && d.value.match?(%r{/etc/cron\.d}i)
add_offense(node, severity: :refactor) if d.respond_to?(:value) && d.value.match?(%r{/etc/cron\.d\b}i)
end
end
end
Expand Down

0 comments on commit 6a1830e

Please sign in to comment.