diff --git a/config/default.yml b/config/default.yml index 769a19dfc8..929d6dbfac 100644 --- a/config/default.yml +++ b/config/default.yml @@ -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.' @@ -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: @@ -180,7 +183,7 @@ 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: @@ -188,7 +191,7 @@ Rails/FindBy: 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: @@ -196,7 +199,7 @@ Rails/FindEach: 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: @@ -204,7 +207,7 @@ Rails/HasAndBelongsToMany: 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: @@ -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' @@ -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' @@ -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' @@ -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' @@ -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 diff --git a/lib/rubocop/cop/rails/dynamic_find_by.rb b/lib/rubocop/cop/rails/dynamic_find_by.rb index e81afe9614..d7d9292525 100644 --- a/lib/rubocop/cop/rails/dynamic_find_by.rb +++ b/lib/rubocop/cop/rails/dynamic_find_by.rb @@ -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 diff --git a/lib/rubocop/cop/rails/time_zone.rb b/lib/rubocop/cop/rails/time_zone.rb index 8b4815280a..3f7065d9e3 100644 --- a/lib/rubocop/cop/rails/time_zone.rb +++ b/lib/rubocop/cop/rails/time_zone.rb @@ -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' diff --git a/manual/cops_rails.md b/manual/cops_rails.md index 77307210da..5772e7a1a7 100644 --- a/manual/cops_rails.md +++ b/manual/cops_rails.md @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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' @@ -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