mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Merge pull request #1490 from divyanshumehta/issue_1488
Added Rubocop Cop:Rails/Delegate
This commit is contained in:
commit
374903def1
4 changed files with 6 additions and 10 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -3,7 +3,5 @@ class SpeakerSerializer < ActiveModel::Serializer
|
|||
|
||||
attributes :name, :affiliation, :biography
|
||||
|
||||
def name
|
||||
object.name
|
||||
end
|
||||
delegate :name, to: :object
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue