Skip to content

Commit

Permalink
[Fix rubocop#107] Fix style guide URLs
Browse files Browse the repository at this point in the history
Fixes rubocop#107.

This PR fixes style guide URLs when specifying
`rubocop --display-style-guide` option.

The following is an execution using RuboCop Rails.

```console
% bundle exec rubocop --display-style-guide --only Style/StringLiterals
Inspecting 2 files
C.

Offenses:

Gemfile:3:8: C: Style/StringLiterals: Prefer single-quoted strings when
you don't need string interpolation or special
symbols. (https://rails.rubystyle.guide#consistent-string-literals)
source "https://rubygems.org"
       ^^^^^^^^^^^^^^^^^^^^^^

2 files inspected, 1 offense detected
```

The correct URL is `https://rubystyle.guide#consistent-string-literals`
instead of `https://rails.rubystyle.guide#consistent-string-literals`.
  • Loading branch information
koic committed Aug 16, 2019
1 parent 3f5dc44 commit 9b802df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## master (unreleased)

### Bug fixes

* [#107](https://github.com/rubocop-hq/rubocop-rails/issues/107): Fix style guide URLs when specifying `rubocop --display-style-guide` option. ([@koic][])

## 2.3.0 (2019-08-13)

### New features
Expand Down
25 changes: 11 additions & 14 deletions config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ 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 @@ -140,15 +137,15 @@ Rails/DelegateAllowBlank:

Rails/DynamicFindBy:
Description: 'Use `find_by` instead of dynamic `find_by_*`.'
StyleGuide: '#find_by'
StyleGuide: 'https://rails.rubystyle.guide#find_by'
Enabled: true
VersionAdded: '0.44'
Whitelist:
- find_by_sql

Rails/EnumHash:
Description: 'Prefer hash syntax over array syntax when defining enums.'
StyleGuide: '#enums'
StyleGuide: 'https://rails.rubystyle.guide#enums'
Enabled: true
VersionAdded: '2.3'
Include:
Expand Down Expand Up @@ -192,31 +189,31 @@ Rails/FilePath:

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

Rails/FindEach:
Description: 'Prefer all.find_each over all.find.'
StyleGuide: '#find-each'
StyleGuide: 'https://rails.rubystyle.guide#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: '#has-many-through'
StyleGuide: 'https://rails.rubystyle.guide#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: '#has_many-has_one-dependent-option'
StyleGuide: 'https://rails.rubystyle.guide#has_many-has_one-dependent-option'
Enabled: true
VersionAdded: '0.50'
Include:
Expand Down Expand Up @@ -263,7 +260,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: '#lexically-scoped-action-filter'
StyleGuide: 'https://rails.rubystyle.guide#lexically-scoped-action-filter'
Enabled: true
Safe: false
VersionAdded: '0.52'
Expand Down Expand Up @@ -328,7 +325,7 @@ Rails/ReadWriteAttribute:
Description: >-
Checks for read_attribute(:attr) and
write_attribute(:attr, val).
StyleGuide: '#read-attribute'
StyleGuide: 'https://rails.rubystyle.guide#read-attribute'
Enabled: true
VersionAdded: '0.20'
VersionChanged: '0.29'
Expand Down Expand Up @@ -379,7 +376,7 @@ Rails/RequestReferer:

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

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

Rails/TimeZone:
Description: 'Checks the correct usage of time zone aware methods.'
StyleGuide: '#time'
StyleGuide: 'https://rails.rubystyle.guide#time'
Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
Enabled: true
Safe: false
Expand Down

0 comments on commit 9b802df

Please sign in to comment.