Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
strategy:
matrix:
include:
- os: ubuntu-latest
ruby: "3.0"
- os: ubuntu-latest
ruby: "3.1"
- os: ubuntu-latest
ruby: "3.2"
- os: ubuntu-latest
ruby: "3.3"
- os: ubuntu-latest
ruby: "3.4"
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand Down
4 changes: 2 additions & 2 deletions google-style.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Gem::Specification.new do |gem|
"README.md", "google-style.yml",
"lib/google/style/version.rb"]

gem.required_ruby_version = ">= 3.0.0"
gem.required_ruby_version = ">= 3.1.0"

gem.add_dependency "rubocop", "~> 1.63"
gem.add_dependency "rubocop", "~> 1.75"
end
72 changes: 71 additions & 1 deletion google-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
AllCops:
NewCops: disable
SuggestExtensions: false
TargetRubyVersion: 3.0
TargetRubyVersion: 3.1

Gemspec/AddRuntimeDependency: # new in 1.65
Enabled: true

# Added in Rubocop 1.30
Gemspec/DeprecatedAttributeAssignment:
Expand Down Expand Up @@ -62,6 +65,9 @@ Layout/LineLength:
Layout/SpaceBeforeBrackets:
Enabled: true

Lint/ArrayLiteralInRegexp: # new in 1.71
Enabled: true

# Added in Rubocop 1.7
Lint/AmbiguousAssignment:
Enabled: true
Expand All @@ -78,6 +84,12 @@ Lint/AmbiguousRange:
Lint/ConstantOverwrittenInRescue:
Enabled: true

Lint/ConstantReassignment: # new in 1.70
Enabled: true

Lint/CopDirectiveSyntax: # new in 1.72
Enabled: true

# Samples often use Kernel#p which Lint/Debugger doesn't like.
Lint/Debugger:
Exclude:
Expand All @@ -104,6 +116,9 @@ Lint/DuplicateMatchPattern:
Lint/DuplicateRegexpCharacterClassElement:
Enabled: true

Lint/DuplicateSetElement: # new in 1.67
Enabled: true

# Added in Rubocop 1.1
Lint/EmptyBlock:
Enabled: true
Expand All @@ -116,6 +131,9 @@ Lint/EmptyClass:
Lint/EmptyInPattern:
Enabled: true

Lint/HashNewWithKeywordArgumentsAsDefault: # new in 1.69
Enabled: true

# Added in Rubocop 1.21
Lint/IncompatibleIoSelectWithFiberScheduler:
Enabled: true
Expand Down Expand Up @@ -148,6 +166,10 @@ Lint/NonAtomicFileOperation:
Lint/NumberedParameterAssignment:
Enabled: true

# Can easily appear in the generated code
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do run a pass of rubocop -a in the generator. Is this insufficient to remove cases of this and some of the others below?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see the benefit of doing this as I barely agree that having += 0 in the codebase is problematic.

Lint/NumericOperationWithConstantResult: # new in 1.69
Enabled: false

# Added in Rubocop 1.9
Lint/OrAssignmentToConstant:
Enabled: true
Expand All @@ -160,6 +182,10 @@ Lint/RedundantDirGlobSort:
Lint/RedundantRegexpQuantifiers:
Enabled: true

# Can easily appear in the generated code
Lint/RedundantTypeConversion: # new in 1.72
Enabled: false

# Added in Rubocop 1.27
Lint/RefinementImportMethods:
Enabled: true
Expand All @@ -176,6 +202,12 @@ Lint/RequireRelativeSelfPath:
Lint/SafeNavigationConsistency:
Enabled: false

Lint/SharedMutableDefault: # new in 1.70
Enabled: true

Lint/SuppressedExceptionInNumberConversion: # new in 1.72
Enabled: true

# Added in Rubocop 1.9
Lint/SymbolConversion:
Enabled: true
Expand All @@ -192,10 +224,23 @@ Lint/TripleQuotes:
Lint/UnexpectedBlockArity:
Enabled: true

Lint/UnescapedBracketInRegexp: # new in 1.68
Enabled: true

# Added in Rubocop 1.1
Lint/UnmodifiedReduceAccumulator:
Enabled: true

Lint/UselessConstantScoping: # new in 1.72
Enabled: true

Lint/UselessDefined: # new in 1.69
Enabled: true

# Can easily appear in the generated code
Lint/UselessNumericOperation: # new in 1.66
Enabled: false

# Added in Rubocop 1.43
Lint/UselessRescue:
Enabled: true
Expand Down Expand Up @@ -251,6 +296,9 @@ Security/IoMethods:
Style/AccessorGrouping:
EnforcedStyle: separated

Style/AmbiguousEndlessMethodDefinition: # new in 1.68
Enabled: true

# Added in Rubocop 1.1
Style/ArgumentsForwarding:
Enabled: true
Expand All @@ -259,6 +307,9 @@ Style/ArgumentsForwarding:
RedundantRestArgumentNames: [] # To support Ruby < 3.2
UseAnonymousForwarding: false # To support Ruby < 3.2

Style/ArrayIntersect: # new in 1.40
Enabled: true

# Problematic for generated code which might include unicode in comments.
Style/AsciiComments:
Enabled: false
Expand All @@ -272,6 +323,9 @@ Style/CaseEquality:
Style/CollectionCompact:
Enabled: true

Style/CombinableDefined: # new in 1.68
Enabled: true

# Added in Rubocop 1.44
Style/ComparableClamp:
Enabled: true
Expand All @@ -280,6 +334,9 @@ Style/ComparableClamp:
Style/ConcatArrayLiterals:
Enabled: true

Style/DigChain: # new in 1.69
Enabled: true

# Added in Rubocop 1.48
Style/DirEmpty:
Enabled: true
Expand Down Expand Up @@ -336,6 +393,9 @@ Style/HashConversion:
Style/HashExcept:
Enabled: true

Style/HashFetchChain: # new in 1.75
Enabled: true

# It is sometimes preferable to use the non-modifier form even for single-line
# expressions, for readability.
Style/IfUnlessModifier:
Expand All @@ -349,6 +409,12 @@ Style/IfWithBooleanLiteralBranches:
Style/InPatternThen:
Enabled: true

Style/ItAssignment: # new in 1.70
Enabled: true

Style/ItBlockParameter: # new in 1.75
Enabled: true

# Added in Rubocop 1.35
Style/MagicCommentFormat:
Enabled: true
Expand Down Expand Up @@ -516,6 +582,10 @@ Style/RescueModifier:
Style/ReturnNilInPredicateMethodDefinition:
Enabled: true

# Disabled since length of navigation chain is not a problem.
Style/SafeNavigationChainLength: # new in 1.68
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide a short note explaining why we want to disable this one?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Enabled: false

# We disagree with this one. Grep is more specialized than select/reject.
Style/SelectByRegexp:
Enabled: false
Expand Down