Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update The Rails Style Guide URL #88

Merged
merged 1 commit into from
Jul 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ AllCops:
# application. If neither of those files exist, RuboCop will use Rails 5.0
# as the default.
TargetRailsVersion: ~
# When specifying style guide URLs, any paths and/or fragments will be
# evaluated relative to the base URL.
StyleGuideBaseURL: https://rails.rubystyle.guide

Rails/ActionFilter:
Description: 'Enforces consistent use of action filter methods.'
Expand Down Expand Up @@ -136,7 +139,7 @@ Rails/DelegateAllowBlank:

Rails/DynamicFindBy:
Description: 'Use `find_by` instead of dynamic `find_by_*`.'
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
StyleGuide: '#find_by'
Enabled: true
VersionAdded: '0.44'
Whitelist:
Expand Down Expand Up @@ -180,31 +183,31 @@ Rails/FilePath:

Rails/FindBy:
Description: 'Prefer find_by over where.first.'
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find_by'
StyleGuide: '#find_by'
Enabled: true
VersionAdded: '0.30'
Include:
- app/models/**/*.rb

Rails/FindEach:
Description: 'Prefer all.find_each over all.find.'
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#find-each'
StyleGuide: '#find-each'
Enabled: true
VersionAdded: '0.30'
Include:
- app/models/**/*.rb

Rails/HasAndBelongsToMany:
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has-many-through'
StyleGuide: '#has-many-through'
Enabled: true
VersionAdded: '0.12'
Include:
- app/models/**/*.rb

Rails/HasManyOrHasOneDependent:
Description: 'Define the dependent option to the has_many and has_one associations.'
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option'
StyleGuide: '#has_many-has_one-dependent-option'
Enabled: true
VersionAdded: '0.50'
Include:
Expand Down Expand Up @@ -251,7 +254,7 @@ Rails/InverseOf:

Rails/LexicallyScopedActionFilter:
Description: "Checks that methods specified in the filter's `only` or `except` options are explicitly defined in the controller."
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter'
StyleGuide: '#lexically-scoped-action-filter'
Enabled: true
Safe: false
VersionAdded: '0.52'
Expand Down Expand Up @@ -316,7 +319,7 @@ Rails/ReadWriteAttribute:
Description: >-
Checks for read_attribute(:attr) and
write_attribute(:attr, val).
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#read-attribute'
StyleGuide: '#read-attribute'
Enabled: true
VersionAdded: '0.20'
VersionChanged: '0.29'
Expand Down Expand Up @@ -367,7 +370,7 @@ Rails/RequestReferer:

Rails/ReversibleMigration:
Description: 'Checks whether the change method of the migration file is reversible.'
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#reversible-migration'
StyleGuide: '#reversible-migration'
Reference: 'https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html'
Enabled: true
VersionAdded: '0.47'
Expand All @@ -386,7 +389,7 @@ Rails/SafeNavigation:

Rails/SaveBang:
Description: 'Identifies possible cases where Active Record save! or related should be used.'
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#save-bang'
StyleGuide: '#save-bang'
Enabled: false
VersionAdded: '0.42'
VersionChanged: '0.59'
Expand Down Expand Up @@ -424,7 +427,7 @@ Rails/SkipsModelValidations:

Rails/TimeZone:
Description: 'Checks the correct usage of time zone aware methods.'
StyleGuide: 'https://github.com/rubocop-hq/rails-style-guide#time'
StyleGuide: '#time'
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
Enabled: true
Safe: false
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rails/dynamic_find_by.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Cop
module Rails
# This cop checks dynamic `find_by_*` methods.
# Use `find_by` instead of dynamic method.
# See. https://github.com/rubocop-hq/rails-style-guide#find_by
# See. https://rails.rubystyle.guide#find_by
#
# @example
# # bad
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rails/time_zone.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Cop
module Rails
# This cop checks for the use of Time methods without zone.
#
# Built on top of Ruby on Rails style guide (https://github.com/rubocop-hq/rails-style-guide#time)
# Built on top of Ruby on Rails style guide (https://rails.rubystyle.guide#time)
# and the article http://danilenko.org/2012/7/6/rails_timezones/
#
# Two styles are supported for this cop. When EnforcedStyle is 'strict'
Expand Down
24 changes: 12 additions & 12 deletions manual/cops_rails.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ Enabled | Yes | Yes | 0.44 | -

This cop checks dynamic `find_by_*` methods.
Use `find_by` instead of dynamic method.
See. https://github.com/rubocop-hq/rails-style-guide#find_by
See. https://rails.rubystyle.guide#find_by

### Examples

Expand Down Expand Up @@ -640,7 +640,7 @@ Whitelist | `find_by_sql` | Array

### References

* [https://github.com/rubocop-hq/rails-style-guide#find_by](https://github.com/rubocop-hq/rails-style-guide#find_by)
* [https://rails.rubystyle.guide#find_by](https://rails.rubystyle.guide#find_by)

## Rails/EnumUniqueness

Expand Down Expand Up @@ -800,7 +800,7 @@ Include | `app/models/**/*.rb` | Array

### References

* [https://github.com/rubocop-hq/rails-style-guide#find_by](https://github.com/rubocop-hq/rails-style-guide#find_by)
* [https://rails.rubystyle.guide#find_by](https://rails.rubystyle.guide#find_by)

## Rails/FindEach

Expand Down Expand Up @@ -829,7 +829,7 @@ Include | `app/models/**/*.rb` | Array

### References

* [https://github.com/rubocop-hq/rails-style-guide#find-each](https://github.com/rubocop-hq/rails-style-guide#find-each)
* [https://rails.rubystyle.guide#find-each](https://rails.rubystyle.guide#find-each)

## Rails/HasAndBelongsToMany

Expand Down Expand Up @@ -857,7 +857,7 @@ Include | `app/models/**/*.rb` | Array

### References

* [https://github.com/rubocop-hq/rails-style-guide#has-many-through](https://github.com/rubocop-hq/rails-style-guide#has-many-through)
* [https://rails.rubystyle.guide#has-many-through](https://rails.rubystyle.guide#has-many-through)

## Rails/HasManyOrHasOneDependent

Expand Down Expand Up @@ -894,7 +894,7 @@ Include | `app/models/**/*.rb` | Array

### References

* [https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option](https://github.com/rubocop-hq/rails-style-guide#has_many-has_one-dependent-option)
* [https://rails.rubystyle.guide#has_many-has_one-dependent-option](https://rails.rubystyle.guide#has_many-has_one-dependent-option)

## Rails/HelperInstanceVariable

Expand Down Expand Up @@ -1295,7 +1295,7 @@ Include | `app/controllers/**/*.rb` | Array

### References

* [https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter](https://github.com/rubocop-hq/rails-style-guide#lexically-scoped-action-filter)
* [https://rails.rubystyle.guide#lexically-scoped-action-filter](https://rails.rubystyle.guide#lexically-scoped-action-filter)

## Rails/LinkToBlank

Expand Down Expand Up @@ -1620,7 +1620,7 @@ Include | `app/models/**/*.rb` | Array

### References

* [https://github.com/rubocop-hq/rails-style-guide#read-attribute](https://github.com/rubocop-hq/rails-style-guide#read-attribute)
* [https://rails.rubystyle.guide#read-attribute](https://rails.rubystyle.guide#read-attribute)

## Rails/RedundantAllowNil

Expand Down Expand Up @@ -1974,7 +1974,7 @@ Include | `db/migrate/*.rb` | Array

### References

* [https://github.com/rubocop-hq/rails-style-guide#reversible-migration](https://github.com/rubocop-hq/rails-style-guide#reversible-migration)
* [https://rails.rubystyle.guide#reversible-migration](https://rails.rubystyle.guide#reversible-migration)
* [https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html](https://api.rubyonrails.org/classes/ActiveRecord/Migration/CommandRecorder.html)

## Rails/SafeNavigation
Expand Down Expand Up @@ -2140,7 +2140,7 @@ AllowedReceivers | `[]` | Array

### References

* [https://github.com/rubocop-hq/rails-style-guide#save-bang](https://github.com/rubocop-hq/rails-style-guide#save-bang)
* [https://rails.rubystyle.guide#save-bang](https://rails.rubystyle.guide#save-bang)

## Rails/ScopeArgs

Expand Down Expand Up @@ -2229,7 +2229,7 @@ Enabled | No | Yes | 0.30 | 0.68

This cop checks for the use of Time methods without zone.

Built on top of Ruby on Rails style guide (https://github.com/rubocop-hq/rails-style-guide#time)
Built on top of Ruby on Rails style guide (https://rails.rubystyle.guide#time)
and the article http://danilenko.org/2012/7/6/rails_timezones/

Two styles are supported for this cop. When EnforcedStyle is 'strict'
Expand Down Expand Up @@ -2283,7 +2283,7 @@ EnforcedStyle | `flexible` | `strict`, `flexible`

### References

* [https://github.com/rubocop-hq/rails-style-guide#time](https://github.com/rubocop-hq/rails-style-guide#time)
* [https://rails.rubystyle.guide#time](https://rails.rubystyle.guide#time)
* [http://danilenko.org/2012/7/6/rails_timezones](http://danilenko.org/2012/7/6/rails_timezones)

## Rails/UniqBeforePluck
Expand Down