Skip to content

Upgrading to cookstyle #316

Closed
nikhil2611 wants to merge 5 commits into
mainfrom
nikhil/chefstyle-to-cookstyle
Closed

Upgrading to cookstyle #316
nikhil2611 wants to merge 5 commits into
mainfrom
nikhil/chefstyle-to-cookstyle

Conversation

@nikhil2611

Copy link
Copy Markdown
Contributor

Description

Moving away from chefstyle to cookstyle

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

@nikhil2611 nikhil2611 requested review from a team as code owners January 27, 2026 07:56
@nikhil2611 nikhil2611 mentioned this pull request Jan 27, 2026
11 tasks
Comment thread Rakefile Outdated
- 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>
@nikhil2611 nikhil2611 force-pushed the nikhil/chefstyle-to-cookstyle branch from ee63389 to c7cbb9d Compare January 27, 2026 18:15
Signed-off-by: nikhil2611 <ngupta@progress.com>
Signed-off-by: nikhil2611 <ngupta@progress.com>
@github-actions

Copy link
Copy Markdown

Simplecov Report

Covered Threshold
78.39% 90%

Comment thread Rakefile Outdated
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(" ")}"

@Stromweld Stromweld Jan 27, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@nikhil2611 nikhil2611 marked this pull request as draft January 28, 2026 07:24
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>
@sonarqubecloud

Copy link
Copy Markdown

@nikhil2611

Copy link
Copy Markdown
Contributor Author

Closing this PR as we have added the changes in separate PR - #318

@nikhil2611 nikhil2611 closed this Jan 29, 2026
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.

3 participants