Skip to content

Commit

Permalink
[Fix rubocop#546] Exclude app/models by default for Rails/ContentTag
Browse files Browse the repository at this point in the history
Fixes rubocop#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.
  • Loading branch information
koic committed Sep 14, 2021
1 parent 41245e0 commit 2512108
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#546](https://github.com/rubocop/rubocop-rails/issues/546): Exclude `app/models` by default for `Rails/ContentTag`. ([@koic][])
3 changes: 3 additions & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ Rails/ContentTag:
Enabled: true
VersionAdded: '2.6'
VersionChanged: '2.12'
# This `Exclude` config prevents false positives for `tag` calls to `has_one: tag`. No helpers are used in normal models.
Exclude:
- app/models/**/*.rb

Rails/CreateTableWithTimestamps:
Description: >-
Expand Down
10 changes: 10 additions & 0 deletions docs/modules/ROOT/pages/cops_rails.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,16 @@ tag.br(class: 'classname')
tag(name, class: 'classname')
----

=== Configurable attributes

|===
| Name | Default value | Configurable values

| Exclude
| `app/models/**/*.rb`
| Array
|===

=== References

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

0 comments on commit 2512108

Please sign in to comment.