Added Rails/Delegate Rubucop Cop
This commit is contained in:
parent
fa56ff7f6d
commit
4824537aeb
3 changed files with 5 additions and 9 deletions
|
|
@ -188,6 +188,10 @@ Rails:
|
||||||
Rails/Validation:
|
Rails/Validation:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
# Looks for delegations, that could have been created automatically with delegate method
|
||||||
|
Rails/Delegate:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
#################### Performance ###############################
|
#################### Performance ###############################
|
||||||
|
|
||||||
# Identifies places where gsub can be replaced by tr or delete.
|
# Identifies places where gsub can be replaced by tr or delete.
|
||||||
|
|
|
||||||
|
|
@ -124,12 +124,6 @@ Rails/Blank:
|
||||||
Rails/Date:
|
Rails/Date:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Rails/Delegate:
|
|
||||||
Exclude:
|
|
||||||
- 'app/serializers/speaker_serializer.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: Whitelist.
|
# Configuration parameters: Whitelist.
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,5 @@ class SpeakerSerializer < ActiveModel::Serializer
|
||||||
|
|
||||||
attributes :name, :affiliation, :biography
|
attributes :name, :affiliation, :biography
|
||||||
|
|
||||||
def name
|
delegate :name, to: :object
|
||||||
object.name
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue