Skip to content

Commit

Permalink
Merge pull request #959 from ashiqueps/CHEF-1116-false-positive-with-…
Browse files Browse the repository at this point in the history
…cron

[CHEF-1116] - Fixed the false positive issue with CronDFileOrTemplate and Updated the required Ruby version to 2.7
  • Loading branch information
ashiqueps committed Mar 21, 2023
2 parents e7244d1 + 7db63a3 commit cf18af8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5
ruby-version: 2.7
bundler-cache: true
- uses: r7kamura/rubocop-problem-matchers-action@v1 # this shows the failures in the PR
- run: bundle exec cookstyle
4 changes: 2 additions & 2 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
fail-fast: false
matrix:
os: [windows-2019, ubuntu-latest]
ruby: ['2.5', '2.6', '2.7', '3.0', '3.1']
ruby: ['2.7', '3.0', '3.1']
runs-on: ${{ matrix.os }}
env:
BUNDLE_WITHOUT: profiling,debug,docs
BUNDLE_WITHOUT: profiling debug docs
name: Unit test on ${{ matrix.os }} with Ruby ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion cookstyle.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
spec.summary = 'Cookstyle is a code linting tool that helps you to write better Chef Infra cookbooks by detecting and automatically correcting style, syntax, and logic mistakes in your code.'
spec.license = 'Apache-2.0'
spec.homepage = 'https://docs.chef.io/workstation/cookstyle/'
spec.required_ruby_version = '>= 2.5'
spec.required_ruby_version = '>= 2.7'

# the gemspec and Gemfile are necessary for appbundling of the gem
spec.files = %w(LICENSE cookstyle.gemspec Gemfile) + Dir.glob('{lib,bin,config}/**/*')
Expand Down
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.start_with?(%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 cf18af8

Please sign in to comment.