Skip to content

Commit 2512108

Browse files
committed
[Fix #546] Exclude app/models by default for Rails/ContentTag
Fixes #546 This PR excludes `app/models` by default for `Rails/ContentTag`. Because it prevents false positives for `tag` calls to `has_one: tag`. No helpers are used in normal models.
1 parent 41245e0 commit 2512108

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* [#546](https://github.com/rubocop/rubocop-rails/issues/546): Exclude `app/models` by default for `Rails/ContentTag`. ([@koic][])

config/default.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ Rails/ContentTag:
189189
Enabled: true
190190
VersionAdded: '2.6'
191191
VersionChanged: '2.12'
192+
# This `Exclude` config prevents false positives for `tag` calls to `has_one: tag`. No helpers are used in normal models.
193+
Exclude:
194+
- app/models/**/*.rb
192195

193196
Rails/CreateTableWithTimestamps:
194197
Description: >-

docs/modules/ROOT/pages/cops_rails.adoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,6 +845,16 @@ tag.br(class: 'classname')
845845
tag(name, class: 'classname')
846846
----
847847

848+
=== Configurable attributes
849+
850+
|===
851+
| Name | Default value | Configurable values
852+
853+
| Exclude
854+
| `app/models/**/*.rb`
855+
| Array
856+
|===
857+
848858
=== References
849859

850860
* https://github.com/rubocop/rubocop-rails/issues/260

0 commit comments

Comments
 (0)