Merge pull request #1490 from divyanshumehta/issue_1488

Added Rubocop Cop:Rails/Delegate
This commit is contained in:
Ana María Martínez Gómez 2017-05-23 14:24:44 +02:00 committed by GitHub
commit 374903def1
4 changed files with 6 additions and 10 deletions

View file

@ -188,6 +188,10 @@ Rails:
Rails/Validation:
Enabled: true
# Looks for delegations, that could have been created automatically with delegate method
Rails/Delegate:
Enabled: true
#################### Performance ###############################
# Identifies places where gsub can be replaced by tr or delete.

View file

@ -124,12 +124,6 @@ Rails/Blank:
Rails/Date:
Enabled: false
# Offense count: 1
# Cop supports --auto-correct.
Rails/Delegate:
Exclude:
- 'app/serializers/speaker_serializer.rb'
# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: Whitelist.

View file

@ -131,7 +131,7 @@ We are using [rubocop](https://github.com/bbatsov/rubocop) as a style checker. I
vagrant exec bundle exec rubocop
```
You can read through current enabled rules in `.rubocop.yml` file. Explanations of the defined [rules](http://rubydoc.info/github/bbatsov/rubocop/master/frames) can be found in modules [Cop::Lint](http://rubydoc.info/github/bbatsov/rubocop/master/Rubocop/Cop/Lint) and [Cop::Style](http://rubydoc.info/github/bbatsov/rubocop/master/Rubocop/Cop/Style).
You can read through current enabled rules in `.rubocop.yml` file. Explanations of the defined [rules](http://rubydoc.info/github/bbatsov/rubocop/master/frames) can be found in modules [Cop::Lint](http://rubydoc.info/github/bbatsov/rubocop/master/Rubocop/Cop/Lint) and [Cop::Style](http://rubydoc.info/github/bbatsov/rubocop/master/Rubocop/Cop/Style) and [Cop:Rails](https://rubocop.readthedocs.io/en/latest/cops_rails/).
Additionally you can read through the [ruby style-guide](https://github.com/bbatsov/ruby-style-guide) to better understand core principles.
### Test Suite

View file

@ -3,7 +3,5 @@ class SpeakerSerializer < ActiveModel::Serializer
attributes :name, :affiliation, :biography
def name
object.name
end
delegate :name, to: :object
end