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

Rails/RakeEnvironment false positive when calling .clear #184

Closed
andyw8 opened this issue Jan 3, 2020 · 1 comment · Fixed by #185
Closed

Rails/RakeEnvironment false positive when calling .clear #184

andyw8 opened this issue Jan 3, 2020 · 1 comment · Fixed by #185
Labels
bug Something isn't working

Comments

@andyw8
Copy link
Contributor

andyw8 commented Jan 3, 2020

I have the following in my Rakefile:

if defined?(RSpec)
  task(:spec).clear
  RSpec::Core::RakeTask.new(:spec) do |t|
    t.verbose = false
  end
end

which causes:

Rakefile:19:3: C: Rails/RakeEnvironment: Include :environment task as a dependency for all Rake tasks.
  task(:spec).clear
  ^^^^^^^^^^^

Since this is clearing a task, rather than defining it, it doesn't make sense to include :environment.

(rubocop-rails 2.4.1)

cc @pocke

@pocke pocke added the bug Something isn't working label Jan 4, 2020
@koic koic closed this as completed in #185 Jan 5, 2020
koic added a commit that referenced this issue Jan 5, 2020
[Fix #184] Fix Rake/Environment to allow task with no block
@andyw8
Copy link
Contributor Author

andyw8 commented Jan 5, 2020

@hanachin thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants