diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ea44b40b..6b6740b6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 diff --git a/.github/workflows/unit.yml b/.github/workflows/unit.yml index 698cbe9b..ba865f76 100644 --- a/.github/workflows/unit.yml +++ b/.github/workflows/unit.yml @@ -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 diff --git a/cookstyle.gemspec b/cookstyle.gemspec index 50b78217..c53a1f9d 100644 --- a/cookstyle.gemspec +++ b/cookstyle.gemspec @@ -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}/**/*') diff --git a/lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb b/lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb index 4d396ed7..e2c82ff4 100644 --- a/lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb +++ b/lib/rubocop/cop/chef/modernize/cron_d_file_or_template.rb @@ -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 @@ -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