-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update RuboCop config to source from pdobb-style gem
The new pdobb-style gem is an attempt to commonize my style guide across all of my gems and/or future projects. After updating to the new common base I had to fix a few issues in the existing code as well, coming from inclusion of the rubocop-performance gem that's now being included. Also, rename the `scripts` folder to `script` to follow along with what is expected by the new style guide (gem).
- Loading branch information
Paul DobbinSchmaltz
committed
Nov 21, 2023
1 parent
9a4d7d9
commit 4d322fa
Showing
6 changed files
with
19 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,244 +1,2 @@ | ||
require: | ||
- rubocop-rake | ||
- rubocop-minitest | ||
|
||
AllCops: | ||
NewCops: enable | ||
TargetRubyVersion: 2.7 | ||
UseCache: true | ||
DisplayCopNames: true | ||
DisplayStyleGuide: true | ||
ExtraDetails: true | ||
|
||
Gemspec/DevelopmentDependencies: | ||
EnforcedStyle: gemspec # See: https://bundler.io/guides/creating_gem.html#testing-our-gem | ||
|
||
Layout/ClassStructure: | ||
Enabled: true | ||
Categories: | ||
module_inclusion: | ||
- extend | ||
- include | ||
- prepend | ||
attributes: | ||
- attr_accessor | ||
- attr_reader | ||
- attr_writer | ||
ExpectedOrder: | ||
- constants | ||
- module_inclusion | ||
- attributes | ||
- public_class_methods | ||
- initializer | ||
- public_methods | ||
- predicates | ||
- protected_methods | ||
- private_methods | ||
|
||
Layout/DotPosition: | ||
EnforcedStyle: trailing | ||
|
||
Layout/EmptyLineAfterGuardClause: | ||
Enabled: true | ||
|
||
Layout/EndOfLine: | ||
EnforcedStyle: lf | ||
|
||
Layout/FirstArgumentIndentation: | ||
EnforcedStyle: consistent_relative_to_receiver | ||
|
||
Layout/FirstArrayElementIndentation: | ||
EnforcedStyle: consistent | ||
|
||
Layout/FirstHashElementIndentation: | ||
EnforcedStyle: consistent | ||
|
||
Layout/FirstParameterIndentation: | ||
Enabled: false # Revisit if more settings become available. | ||
|
||
Layout/LineContinuationSpacing: | ||
EnforcedStyle: no_space | ||
|
||
Layout/LineEndStringConcatenationIndentation: | ||
EnforcedStyle: aligned | ||
|
||
Layout/LineLength: | ||
Max: 80 | ||
Exclude: | ||
- "object_identifier.gemspec" | ||
- "scripts/benchmarking/**/*" | ||
AllowedPatterns: | ||
# YARD doc `@example` output. | ||
- !ruby/regexp /\A *# \# => / | ||
- !ruby/regexp /\A *# =/ | ||
|
||
Layout/MultilineAssignmentLayout: | ||
Enabled: true | ||
SupportedTypes: | ||
- block | ||
- case | ||
- class | ||
- if | ||
# - kwbegin | ||
- module | ||
|
||
Layout/MultilineMethodCallBraceLayout: | ||
EnforcedStyle: same_line | ||
|
||
Layout/MultilineMethodCallIndentation: | ||
EnforcedStyle: indented_relative_to_receiver | ||
|
||
Layout/MultilineMethodDefinitionBraceLayout: | ||
EnforcedStyle: same_line | ||
|
||
Layout/MultilineOperationIndentation: | ||
Enabled: false # Waiting for e.g. `indented_relative_to_receiver`. | ||
|
||
# Lint/AmbiguousOperator: | ||
# Enabled: false # Conflicts with other rules. | ||
|
||
# Lint/AmbiguousRegexpLiteral: | ||
# Enabled: false # Conflicts with other rules. | ||
|
||
Lint/OrAssignmentToConstant: | ||
Exclude: | ||
- "scripts/**/*" | ||
|
||
Lint/Void: | ||
CheckForMethodsWithNoSideEffects: true | ||
|
||
Metrics/BlockLength: | ||
AllowedMethods: | ||
- new | ||
- describe # Tests | ||
- context # Tests | ||
- ips # Benchmarking | ||
|
||
Metrics/ClassLength: | ||
CountAsOne: | ||
- array | ||
- heredoc | ||
- method_call | ||
Exclude: | ||
- "test/**/*" | ||
|
||
Metrics/MethodLength: | ||
CountAsOne: | ||
- array | ||
- hash | ||
- heredoc | ||
- method_call | ||
|
||
Naming/MethodParameterName: | ||
AllowedNames: | ||
- a | ||
- b | ||
|
||
Naming/RescuedExceptionsVariableName: | ||
PreferredName: ex | ||
|
||
Style/Alias: | ||
EnforcedStyle: prefer_alias_method | ||
|
||
Style/BlockDelimiters: | ||
EnforcedStyle: semantic | ||
AllowBracesOnProceduralOneLiners: true | ||
FunctionalMethods: | ||
# Minitest Spec DSL. (Rubocop defaults.) | ||
- let | ||
- let! | ||
- subject | ||
- watch | ||
# Overrides (Defaulted to Procedural by Rubocop.) | ||
- tap | ||
# MuchStub | ||
- call | ||
- on_call | ||
- spy | ||
# - tap (Already listed above.) | ||
- tap_on_call | ||
- with | ||
ProceduralMethods: # Defining this just to remove `tap` from the list. | ||
- benchmark | ||
- bm | ||
- bmbm | ||
- create | ||
- each_with_object | ||
- measure | ||
- new | ||
- realtime | ||
# - tap (Remove from Rubocop defaults.) | ||
- with_object | ||
|
||
Style/ClassAndModuleChildren: | ||
AutoCorrect: true | ||
EnforcedStyle: compact | ||
Exclude: | ||
- "test/**/*" | ||
|
||
Style/CollectionMethods: | ||
Enabled: true | ||
PreferredMethods: | ||
collect: map | ||
collect!: map! | ||
find_all: select | ||
detect: detect | ||
inject: inject | ||
|
||
Style/Documentation: | ||
Exclude: | ||
- "test/**/*" | ||
|
||
Style/EmptyElse: | ||
Enabled: false # Including a comment in an empty else block shows intent. | ||
|
||
Style/EmptyMethod: | ||
EnforcedStyle: expanded | ||
|
||
Style/ExpandPathArguments: | ||
Exclude: | ||
- "object_identifier.gemspec" | ||
|
||
Style/FormatString: | ||
Enabled: false # % notation with an Array just reads better sometimes. | ||
|
||
Style/Lambda: | ||
EnforcedStyle: literal | ||
|
||
Style/LambdaCall: | ||
Enabled: false # Allow ServiceObject.(*). Only use on classes, not instances. | ||
|
||
Style/NumericPredicate: | ||
AutoCorrect: true | ||
|
||
Style/OpenStructUse: | ||
Exclude: | ||
- "test/**/*" | ||
|
||
Style/RegexpLiteral: | ||
EnforcedStyle: mixed | ||
|
||
Style/RescueStandardError: | ||
EnforcedStyle: implicit | ||
|
||
Style/ReturnNil: | ||
Enabled: true | ||
|
||
Style/StringMethods: | ||
Enabled: true | ||
|
||
Style/SingleLineMethods: | ||
Exclude: | ||
- "test/**/*_test.rb" | ||
|
||
Style/StringLiterals: | ||
EnforcedStyle: double_quotes | ||
|
||
Style/StringLiteralsInInterpolation: | ||
EnforcedStyle: double_quotes | ||
|
||
Style/TrailingCommaInArrayLiteral: | ||
EnforcedStyleForMultiline: comma | ||
|
||
Style/TrailingCommaInHashLiteral: | ||
EnforcedStyleForMultiline: comma | ||
inherit_gem: | ||
pdobb-style: .rubocop.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
scripts/benchmarking/formatters.rb → script/benchmarking/formatters.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters