rubocop-rake
rubocop-rake copied to clipboard
A RuboCop plugin for Rake
The good code is bad, and the bad code is good. # Methods should be defined inside tasks (only) (but _not_ namespaces), as it is the only way they will...
In Rake task, I prefer `sh` to `system` to execute external commands. Because `sh` raises an error when the command exits with non-zero. It is safer. ```ruby task :foo do...
```ruby namespace :foo do task :bar do end end # or task :'foo:bar' do end ```
I guess we can use https://github.com/rubocop-hq/rubocop/tree/12f07bb2736b32acf4e3c471adc44792cb83e0a3/.github, but we need to tweak.
Althrough `MethodDefinitionInTask` cop does a good job ignoring method definitions in classes/modules, it does not detect `Data` methods: ```ruby # some rake task Data.define(:data) do def some_helper_method # Rake/MethodDefinitionInTask complains...
Fixes https://github.com/rubocop/rubocop-rake/issues/42 Fixes `ClassDefinitionInTask`, and `MethodDefinitionInTask` to allow classes, modules and methods to defined inside tasks
I thought it would be easier to maintain if I switched to a CI similar to other rubocop repositories, so I changed the CI to Github Actions.
## Actual behavior ```ruby task lint: %i[rubocop] ``` terminal: ``` ydakuka@yauhenid:~/Work/project$ bin/rails_docker rubocop Rakefile Inspecting 1 file . 1 file inspected, no offenses detected ``` ## Rubocop ``` ydakuka@yauhenid:~/Work/main_app$ bin/rails_docker...
1. Move the [Rails/RakeEnvironment cop](https://github.com/rubocop/rubocop-rails/pull/130) to `rubocop-rake` as the `Rake/Rails/RakeEnvironment` cop. 2. The cop accepts two valid styles. I think one should be the preferred choice. a) ```ruby desc 'delete...
There are no cops about on how many rake tasks can be in a namespace.