Description
Be clear, concise and precise in your description of the problem.
Open an issue with a descriptive title and a summary in grammatically correct,
complete sentences.
Use the template below when reporting bugs. Please, make sure that
you're running the latest stable RuboCop and that the problem you're reporting
hasn't been reported (and potentially fixed) already.
Before filing the ticket you should replace all text above the horizontal
rule with your own words.
Expected behavior
Given a rake task that looks like this:
task :foobar, [:username, :password] do |task, args|
The auto-corrected line should read
task :foobar, [:username, :password] => [:environment] do |task, args|
This is the correct syntax as seen in http://docs.seattlerb.org/rake/doc/rakefile_rdoc.html#label-Tasks+that+Expect+Parameters
Actual behavior
The auto-corrected line looks like this:
task foobar: :environment, [:username, :password] do |task, args|
The auto-correct line results in a syntax error.
Steps to reproduce the problem
- Add the rubocop-rails plugin to a rubocop config in a project.
- Add a rake task file to that project where the task definition includes parameters, as seen above.
- Run
rubocop -A path/to/rake_task_file.rb
. - Observe the auto-corrected code.
RuboCop version
❯ bundle exec rubocop -V
1.52.1 (using Parser 3.2.2.3, rubocop-ast 1.29.0, running on ruby 2.7.8) [arm64-darwin22]
- rubocop-rails 2.20.2
Activity