Skip to content

Run cookstyle via Bundler in CI and fix rubocop target Ruby#34

Open
tas50 wants to merge 1 commit into
chef:mainfrom
tas50:ci/lint-use-bundler
Open

Run cookstyle via Bundler in CI and fix rubocop target Ruby#34
tas50 wants to merge 1 commit into
chef:mainfrom
tas50:ci/lint-use-bundler

Conversation

@tas50

@tas50 tas50 commented Jun 28, 2026

Copy link
Copy Markdown

Summary

Two small CI/config fixes:

  1. Use the gemspec-pinned cookstyle in the lint workflow. The lint job ran gem install cookstyle (with bundler-cache: false), which floats to whatever the latest cookstyle release happens to be and can drift from the version the project develops against. Switch to bundler-cache: true + bundle exec cookstyle, so CI uses the cookstyle ~> 8.4 pinned in chefspec.gemspec — the same version bundle exec rake style uses locally. This keeps CI and local linting in lockstep and removes a source of "passes locally, fails in CI" surprises.
  2. Fix the rubocop target Ruby version. .rubocop.yml set TargetRubyVersion: 2.5, but the gemspec requires >= 3.1 (and CI tests 3.1/3.4). The stale 2.5 target silently disabled cops for the Ruby versions the project actually supports. Bumped to 3.1.

Testing

  • cookstyle --chefstyle -c .rubocop.yml with the new 3.1 target: 106 files inspected, no offenses detected.
  • lint.yml validated as well-formed YAML.

The lint workflow installed cookstyle ad hoc with `gem install cookstyle`,
which floats to the latest release and can diverge from the version the
project actually develops against. Use the gemspec-pinned cookstyle
(`~> 8.4`) by enabling bundler-cache and running `bundle exec cookstyle`
so CI and local `rake style` stay in lockstep.

Also bump `.rubocop.yml` TargetRubyVersion from 2.5 to 3.1 to match the
gemspec's `required_ruby_version >= 3.1`; 2.5 silently disabled cops for
the Ruby versions the project supports.

Signed-off-by: Tim Smith <tsmith84@proton.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant