Skip to content

Commit 4cb5cd5

Browse files
committed
[Fix #206] Fix a false positive for Rails/RakeEnvironment when using Capistrano
It excludes the directory where Capistrano tasks are located. Because these tasks don't need to invoke the `:environment` task, and the directory structure is the official way. ref: https://github.com/capistrano/capistrano/tree/v3.12.0#capify-your-project Fixes #206
1 parent 7506a31 commit 4cb5cd5

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
* [#180](https://github.com/rubocop-hq/rubocop-rails/issues/180): Fix a false positive for `HttpPositionalArguments` when using `get` method with `:to` option. ([@koic][])
1212
* [#193](https://github.com/rubocop-hq/rubocop-rails/issues/193): Make `Rails/EnvironmentComparison` aware of `Rails.env` is used in RHS or when `!=` is used for comparison. ([@koic][])
1313
* [#205](https://github.com/rubocop-hq/rubocop-rails/pull/205): Make `Rails/ReversibleMigration` aware of `:to_table` option of `remove_foreign_key`. ([@joshpencheon][])
14+
* [#207](https://github.com/rubocop-hq/rubocop-rails/pull/207): Fix a false positive for `Rails/RakeEnvironment` when using Capistrano. ([@sinsoku][])
1415

1516
## 2.4.2 (2020-01-26)
1617

config/default.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ Rails/RakeEnvironment:
346346
Include:
347347
- '**/Rakefile'
348348
- '**/*.rake'
349+
Exclude:
350+
- 'lib/capistrano/tasks/**/*.rake'
349351

350352
Rails/ReadWriteAttribute:
351353
Description: >-

manual/cops_rails.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,6 +1696,7 @@ end
16961696
Name | Default value | Configurable values
16971697
--- | --- | ---
16981698
Include | `**/Rakefile`, `**/*.rake` | Array
1699+
Exclude | `lib/capistrano/tasks/**/*.rake` | Array
16991700

17001701
## Rails/ReadWriteAttribute
17011702

0 commit comments

Comments
 (0)