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 for rubocop ≥ 0.7x #49

Merged
merged 1 commit into from
Oct 1, 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
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@

This repository provides recommended RuboCop configuration and additional Cops for use on GitHub open source and internal Ruby projects.

## Installation
## Usage

Rubocop 0.68 removed performance cops and 0.72 removed Rails cops. However, upgrading `rubocop-github` without modification will almost definitely create very many new offenses. The current version of this gem exposes the "legacy" configuration under `config/default.yml` and `config/rails.yml` which should be used *if and only if* the version of rubocop is locked to `< 0.68` in your project (which it should be unless you `bundle update rubocop`). It also exposes an "edge" configuration under `config/default_edge.yml` and `config/rails_edge.yml` so that the changes can be tested without introducing breaking changes.

### Legacy usage

**Gemfile**

``` ruby
gem "rubocop", "< 0.68"
gem "rubocop-github"
```

Expand All @@ -19,6 +24,25 @@ inherit_gem:
- config/rails.yml
```

### Edge usage

**Gemfile**

``` ruby
gem "rubocop-github"
gem "rubocop-performance", require: false
gem "rubocop-rails", require: false
```

**.rubocop.yml**

``` yaml
inherit_gem:
rubocop-github:
- config/default_edge.yml
- config/rails_edge.yml
```

## Testing

`bundle install`
Expand Down
325 changes: 325 additions & 0 deletions config/_default_shared.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,325 @@
require: rubocop/cop/github

# These cops are compatible across supported versions of rubocop

Bundler/DuplicatedGem:
Enabled: true

Bundler/OrderedGems:
Enabled: true

Layout/BlockAlignment:
Enabled: true

Layout/BlockEndNewline:
Enabled: true

Layout/ConditionPosition:
Enabled: true

Layout/DefEndAlignment:
Enabled: true

Layout/EndAlignment:
Enabled: false

Layout/EndOfLine:
Enabled: true

Layout/InitialIndentation:
Enabled: true

Layout/SpaceAfterColon:
Enabled: true

Layout/SpaceAfterComma:
Enabled: true

Layout/SpaceAfterMethodName:
Enabled: true

Layout/SpaceAfterNot:
Enabled: true

Layout/SpaceAfterSemicolon:
Enabled: true

Layout/SpaceAroundBlockParameters:
Enabled: true

Layout/SpaceAroundEqualsInParameterDefault:
Enabled: true

Layout/SpaceBeforeBlockBraces:
Enabled: true

Layout/SpaceInsideArrayLiteralBrackets:
Enabled: true
EnforcedStyle: no_space

Layout/SpaceInsideArrayPercentLiteral:
Enabled: true

Layout/SpaceInsideBlockBraces:
Enabled: true

Layout/SpaceInsideParens:
Enabled: true

Layout/SpaceInsideRangeLiteral:
Enabled: true

Layout/SpaceInsideReferenceBrackets:
Enabled: true

Layout/Tab:
Enabled: true

Layout/TrailingBlankLines:
Enabled: true

Layout/TrailingWhitespace:
Enabled: true

Lint/CircularArgumentReference:
Enabled: true

Lint/Debugger:
Enabled: true

Lint/DeprecatedClassMethods:
Enabled: true

Lint/DuplicateMethods:
Enabled: true

Lint/DuplicatedKey:
Enabled: true

Lint/EachWithObjectArgument:
Enabled: true

Lint/ElseLayout:
Enabled: true

Lint/EmptyEnsure:
Enabled: true

Lint/EmptyInterpolation:
Enabled: true

Lint/EndInMethod:
Enabled: true

Lint/EnsureReturn:
Enabled: true

Lint/FlipFlop:
Enabled: true

Lint/FloatOutOfRange:
Enabled: true

Lint/FormatParameterMismatch:
Enabled: true

Lint/LiteralAsCondition:
Enabled: true

Lint/LiteralInInterpolation:
Enabled: true

Lint/Loop:
Enabled: true

Lint/NextWithoutAccumulator:
Enabled: true

Lint/RandOne:
Enabled: true

Lint/RequireParentheses:
Enabled: true

Lint/RescueException:
Enabled: true

Lint/StringConversionInInterpolation:
Enabled: true

Lint/UnderscorePrefixedVariableName:
Enabled: true

Lint/UnneededCopDisableDirective:
Enabled: true

Lint/UnneededSplatExpansion:
Enabled: true

Lint/UnreachableCode:
Enabled: true

Lint/UselessComparison:
Enabled: true

Lint/UselessSetterCall:
Enabled: true

Lint/Void:
Enabled: true

Metrics/AbcSize:
Enabled: false

Metrics/BlockLength:
Enabled: false

Metrics/BlockNesting:
Enabled: false

Metrics/ClassLength:
Enabled: false

Metrics/CyclomaticComplexity:
Enabled: false

Metrics/LineLength:
Enabled: false

Metrics/MethodLength:
Enabled: false

Metrics/ModuleLength:
Enabled: false

Metrics/ParameterLists:
Enabled: false

Metrics/PerceivedComplexity:
Enabled: false

Naming/AsciiIdentifiers:
Enabled: true

Naming/ClassAndModuleCamelCase:
Enabled: true

Naming/FileName:
Enabled: true

Naming/MethodName:
Enabled: true

Performance/CaseWhenSplat:
Enabled: false

Performance/Count:
Enabled: true

Performance/Detect:
Enabled: true

Performance/DoubleStartEndWith:
Enabled: true

Performance/EndWith:
Enabled: true

Performance/FlatMap:
Enabled: true

Performance/RangeInclude:
Enabled: false

Performance/RedundantMatch:
Enabled: false

Performance/RedundantMerge:
Enabled: true
MaxKeyValuePairs: 1

Performance/ReverseEach:
Enabled: true

Performance/Size:
Enabled: true

Performance/StartWith:
Enabled: true

Security/Eval:
Enabled: true

Style/ArrayJoin:
Enabled: true

Style/BeginBlock:
Enabled: true

Style/BlockComments:
Enabled: true

Style/CaseEquality:
Enabled: true

Style/CharacterLiteral:
Enabled: true

Style/ClassMethods:
Enabled: true

Style/Copyright:
Enabled: false

Style/DefWithParentheses:
Enabled: true

Style/EndBlock:
Enabled: true

Style/For:
Enabled: true

Style/FrozenStringLiteralComment:
Enabled: true

Style/HashSyntax:
Enabled: true
EnforcedStyle: ruby19_no_mixed_keys

Style/LambdaCall:
Enabled: true

Style/MethodCallWithoutArgsParentheses:
Enabled: true

Style/MethodDefParentheses:
Enabled: true

Style/MultilineIfThen:
Enabled: true

Style/NilComparison:
Enabled: true

Style/Not:
Enabled: true

Style/OneLineConditional:
Enabled: true

Style/RedundantSortBy:
Enabled: true

Style/Sample:
Enabled: true

Style/StabbyLambdaParentheses:
Enabled: true

Style/Strip:
Enabled: true

Style/StringLiterals:
Enabled: true
EnforcedStyle: double_quotes
Loading