Upgrading to cookstyle #316
Closed
nikhil2611 wants to merge 5 commits into
Closed
Conversation
sanjain-progress
approved these changes
Jan 27, 2026
Stromweld
reviewed
Jan 27, 2026
- Updated Gemfile to remove chefstyle gem - Updated .rubocop.yml to require cookstyle instead of chefstyle - Updated Rakefile to use cookstyle with --chefstyle flag for backwards compatibility - Fixed cookstyle offenses (indentation, alignment, heredoc formatting) - Reduced from 124 files to 18 files by using --chefstyle flag Signed-off-by: nikhil2611 <ngupta@progress.com>
ee63389 to
c7cbb9d
Compare
Signed-off-by: nikhil2611 <ngupta@progress.com>
Signed-off-by: nikhil2611 <ngupta@progress.com>
Simplecov Report
|
Stromweld
reviewed
Jan 27, 2026
Comment on lines
+35
to
+49
| @@ -45,13 +43,12 @@ namespace :style do | |||
| }) | |||
|
|
|||
| desc "Run Chef Ruby style checks" | |||
| RuboCop::RakeTask.new(:chefstyle) do |t| | |||
| t.requires = ["chefstyle"] | |||
| t.patterns = `rubocop --list-target-files`.split("\n").reject { |f| f =~ ignore_dirs } | |||
| t.options = ["--display-cop-names"] | |||
| task :chefstyle do | |||
| require "rubocop" | |||
| patterns = `rubocop --list-target-files`.split("\n").reject { |f| f =~ ignore_dirs } | |||
| sh "cookstyle --chefstyle --display-cop-names #{patterns.join(" ")}" | |||
Contributor
There was a problem hiding this comment.
instead of needing all this complexity with the ignore_dirs move it to .rubocop.yml file exclude section.
AllCops:
Include:
- "**/*.rb"
Exclude:
- "lib/chef-cli/skeletons/code_generator"
- "spec/unit/fixtures/chef-runner-cookbooks"
- " spec/unit/fixtures/cookbook_cache"
- " spec/unit/fixtures/example_cookbook"
- " spec/unit/fixtures/example_cookbook_metadata_json_only"
- " spec/unit/fixtures/example_cookbook_no_metadata"
- " spec/unit/fixtures/local_path_cookbooks"
- Moved all ignore patterns from Rakefile to .rubocop.yml Exclude section - Simplified chefstyle task to use direct cookstyle command with --chefstyle flag - Removed ignore_dirs complexity as suggested by @Stromweld - Both style:cookstyle and style:chefstyle tasks working correctly Signed-off-by: nikhil2611 <ngupta@progress.com>
This auto-generated file should not be tracked (already in .gitignore). The stale 78.39% value was causing confusion - actual coverage is 98.44%. Signed-off-by: nikhil2611 <ngupta@progress.com>
|
Contributor
Author
|
Closing this PR as we have added the changes in separate PR - #318 |
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.



Description
Moving away from chefstyle to cookstyle
Related Issue
Types of changes
Checklist:
Gemfile.lockhas changed, I have used--conservativeto do it and included the full output in the Description above.