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

Enable more rubocop checks #70

Merged
merged 3 commits into from
Mar 23, 2025
Merged
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
54 changes: 53 additions & 1 deletion ci/rubocop.rails.yml
Original file line number Diff line number Diff line change
@@ -490,20 +490,72 @@ Performance/StringReplacement:
characters. Use `delete` instead of `gsub` when you are deleting characters.
Reference: https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code
Enabled: false
Lint/DuplicateBranch:
Enabled: true
Lint/EmptyBlock:
Enabled: true
Lint/EmptyClass:
Enabled: true
Lint/NoReturnInBeginEndBlocks:
Enabled: true
Lint/ShadowedArgument:
Enabled: true
IgnoreImplicitReferences: true
Lint/ToEnumArguments:
Enabled: true
Lint/UnexpectedBlockArity:
Enabled: true
Lint/UnmodifiedReduceAccumulator:
Enabled: true
Metrics/PerceivedComplexity:
Description: A complexity metric geared towards measuring complexity for a human
reader.
Enabled: true
Max: 7
Performance/AncestorsInclude:
Enabled: true
Performance/BigDecimalWithNumericArgument:
Enabled: true
Performance/BlockGivenWithExplicitBlock:
Enabled: true
Performance/CollectionLiteralInLoop:
Enabled: true
Performance/MethodObjectAsBlock:
Enabled: true
Performance/RedundantEqualityComparisonBlock:
Enabled: true
Performance/RedundantSortBlock:
Enabled: true
Performance/RedundantSplitRegexpArgument:
Enabled: true
Performance/RedundantStringChars:
Enabled: true
Performance/ReverseFirst:
Enabled: true
Performance/SortReverse:
Enabled: true
Performance/Squeeze:
Enabled: true
Performance/StringInclude:
Enabled: true
Performance/Sum:
Enabled: true
Style/ArgumentsForwarding:
Enabled: true
Style/CollectionCompact:
Description: Checks for places where custom logic on rejection nils from arrays
and hashes can be replaced with {Array,Hash}#{compact,compact!}.
StyleGuide: https://docs.rubocop.org/rubocop/cops_style.html#stylecollectioncompact
Enabled: true
Style/ArgumentsForwarding:
Style/DocumentDynamicEvalDefinition:
Enabled: true
Style/NegatedIfElseCondition:
Enabled: true
Style/NilLambda:
Enabled: true
Style/RedundantArgument:
Enabled: true
Style/SwapValues:
Enabled: true
Gemspec/RequireMFA:
Enabled: false
82 changes: 81 additions & 1 deletion ci/rubocop.yml
Original file line number Diff line number Diff line change
@@ -455,18 +455,98 @@ Lint/Void:
Performance/ConstantRegexp:
Description: Finds regular expressions with dynamic components that are all constants.
Enabled: true
Performance/Count:
Description: Use `count` instead of `select...size`, `reject...size`, `select...count`,
`reject...count`, `select...length`, and `reject...length`.
Enabled: false
Performance/Detect:
Description: Use `detect` instead of `select.first`, `find_all.first`, `select.last`,
and `find_all.last`.
Reference: https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code
Enabled: false
Performance/FlatMap:
Description: Use `Enumerable#flat_map` instead of `Enumerable#map...Array#flatten(1)`
or `Enumberable#collect..Array#flatten(1)`
Reference: https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code
Enabled: false
Performance/ReverseEach:
Description: Use `reverse_each` instead of `reverse.each`.
Reference: https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code
Enabled: false
Performance/Size:
Description: Use `size` instead of `count` for counting the number of elements in
`Array` and `Hash`.
Reference: https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code
Enabled: false
Performance/StringReplacement:
Description: Use `tr` instead of `gsub` when you are replacing the same number of
characters. Use `delete` instead of `gsub` when you are deleting characters.
Reference: https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code
Enabled: false
Lint/DuplicateBranch:
Enabled: true
Lint/EmptyBlock:
Enabled: true
Lint/EmptyClass:
Enabled: true
Lint/NoReturnInBeginEndBlocks:
Enabled: true
Lint/ShadowedArgument:
Enabled: true
IgnoreImplicitReferences: true
Lint/ToEnumArguments:
Enabled: true
Lint/UnexpectedBlockArity:
Enabled: true
Lint/UnmodifiedReduceAccumulator:
Enabled: true
Metrics/PerceivedComplexity:
Description: A complexity metric geared towards measuring complexity for a human
reader.
Enabled: true
Max: 7
Performance/AncestorsInclude:
Enabled: true
Performance/BigDecimalWithNumericArgument:
Enabled: true
Performance/BlockGivenWithExplicitBlock:
Enabled: true
Performance/CollectionLiteralInLoop:
Enabled: true
Performance/MethodObjectAsBlock:
Enabled: true
Performance/RedundantEqualityComparisonBlock:
Enabled: true
Performance/RedundantSortBlock:
Enabled: true
Performance/RedundantSplitRegexpArgument:
Enabled: true
Performance/RedundantStringChars:
Enabled: true
Performance/ReverseFirst:
Enabled: true
Performance/SortReverse:
Enabled: true
Performance/Squeeze:
Enabled: true
Performance/StringInclude:
Enabled: true
Performance/Sum:
Enabled: true
Style/ArgumentsForwarding:
Enabled: true
Style/CollectionCompact:
Description: Checks for places where custom logic on rejection nils from arrays
and hashes can be replaced with {Array,Hash}#{compact,compact!}.
StyleGuide: https://docs.rubocop.org/rubocop/cops_style.html#stylecollectioncompact
Enabled: true
Style/ArgumentsForwarding:
Style/DocumentDynamicEvalDefinition:
Enabled: true
Style/NegatedIfElseCondition:
Enabled: true
Style/NilLambda:
Enabled: true
Style/RedundantArgument:
Enabled: true
Style/SwapValues:
Enabled: true
93 changes: 92 additions & 1 deletion src/rubocop/rubocop.ribose.yml
Original file line number Diff line number Diff line change
@@ -6,6 +6,19 @@ AllCops:
DisplayCopNames: false
StyleGuideCopsOnly: false
TargetRubyVersion: 3.1

Lint/DuplicateBranch: # (new in 1.3)
Enabled: true

Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
Enabled: true

Lint/EmptyBlock: # (new in 1.1)
Enabled: true

Lint/EmptyClass: # (new in 1.3)
Enabled: true

Layout/LineLength:
Description: Limit lines to 80 characters.
StyleGuide: https://github.com/bbatsov/ruby-style-guide#80-character-limits
@@ -15,9 +28,23 @@ Layout/LineLength:
URISchemes:
- http
- https

Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
Enabled: true

Lint/ShadowedArgument:
Enabled: true
IgnoreImplicitReferences: true

Lint/ToEnumArguments: # (new in 1.1)
Enabled: true

Lint/UnexpectedBlockArity: # (new in 1.5)
Enabled: true

Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
Enabled: true

Metrics/AbcSize:
Description: A calculated magnitude based on number of assignments, branches, and
conditions.
@@ -63,13 +90,77 @@ Metrics/PerceivedComplexity:
Enabled: true
Max: 7

Style/CollectionCompact:
Performance/AncestorsInclude: # (new in 1.7)
Enabled: true

Performance/BigDecimalWithNumericArgument: # (new in 1.7)
Enabled: true

Performance/BlockGivenWithExplicitBlock: # (new in 1.9)
Enabled: true

Performance/CollectionLiteralInLoop: # (new in 1.8)
Enabled: true

Performance/ConstantRegexp: # (new in 1.9)
Enabled: true

Performance/MethodObjectAsBlock: # (new in 1.9)
Enabled: true

Performance/RedundantEqualityComparisonBlock: # (new in 1.10)
Enabled: true

Performance/RedundantSortBlock: # (new in 1.7)
Enabled: true

Performance/RedundantSplitRegexpArgument: # (new in 1.10)
Enabled: true

Performance/RedundantStringChars: # (new in 1.7)
Enabled: true

Performance/ReverseFirst: # (new in 1.7)
Enabled: true

Performance/SortReverse: # (new in 1.7)
Enabled: true

Performance/Squeeze: # (new in 1.7)
Enabled: true

Performance/StringInclude: # (new in 1.7)
Enabled: true

Performance/Sum: # (new in 1.8)
Enabled: true

Style/ArgumentsForwarding: # (new in 1.1)
Enabled: true

Style/CollectionCompact: # (new in 1.2)
Description: Checks for places where custom logic on rejection nils from arrays and hashes can be replaced with {Array,Hash}#{compact,compact!}.
StyleGuide: https://docs.rubocop.org/rubocop/cops_style.html#stylecollectioncompact
Enabled: true

Style/DocumentDynamicEvalDefinition: # (new in 1.1)
Enabled: true

Style/NegatedIfElseCondition: # (new in 1.2)
Enabled: true

Style/NilLambda: # (new in 1.3)
Enabled: true

Style/RedundantArgument: # (new in 1.4)
Enabled: true

Style/SwapValues: # (new in 1.1)
Enabled: true

Style/CollectionMethods:
Enabled: false

Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: comma