Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update RuboCop task in Rakefile #928

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix RuboCop task in Rakefile
If the RuboCop version is 1.31 or later then use
`rubocop:autocorrect` task instead of deprecated `rubocop:auto_correct`
in the `Rakefile`.
Otherwise use the conventional `rubocop:auto_correct` task.

Note that the older RuboCop doesn't have
`RuboCop::Version` module, so the condition
`RuboCop.const_defined?(:Version)` is necessary.
  • Loading branch information
gemmaro committed Oct 4, 2022
commit be29be73b81ece165aa95fba59269741f8834898
4 changes: 3 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,7 @@ else
RuboCop::RakeTask.new(:rubocop) do |t|
t.options = [*parsed_files]
end
task :build => [:generate, "rubocop:auto_correct"]
is_newer_rubocop = RuboCop.const_defined?(:Version) && Gem::Version.new(RuboCop::Version::STRING) >= '1.31.0'
rubocop_task = is_newer_rubocop ? "rubocop:autocorrect" : "rubocop:auto_correct"
task :build => [:generate, rubocop_task]
end