Run cookstyle via Bundler in CI and fix rubocop target Ruby#34
Open
tas50 wants to merge 1 commit into
Open
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two small CI/config fixes:
lintjob rangem install cookstyle(withbundler-cache: false), which floats to whatever the latest cookstyle release happens to be and can drift from the version the project develops against. Switch tobundler-cache: true+bundle exec cookstyle, so CI uses thecookstyle ~> 8.4pinned inchefspec.gemspec— the same versionbundle exec rake styleuses locally. This keeps CI and local linting in lockstep and removes a source of "passes locally, fails in CI" surprises..rubocop.ymlsetTargetRubyVersion: 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 to3.1.Testing
cookstyle --chefstyle -c .rubocop.ymlwith the new3.1target:106 files inspected, no offenses detected.lint.ymlvalidated as well-formed YAML.