From e2bff59d610538725e33119815e1ac8244751aa0 Mon Sep 17 00:00:00 2001 From: Jeffrey Lau Date: Thu, 9 Nov 2023 18:07:45 +0800 Subject: [PATCH] rubocop: Add more Lint/* checks See: https://github.com/riboseinc/oss-guides/issues/42 --- ci/rubocop.rails.yml | 14 ++++++++++++++ ci/rubocop.yml | 14 ++++++++++++++ src/rubocop/rubocop.ribose.yml | 27 +++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/ci/rubocop.rails.yml b/ci/rubocop.rails.yml index cd867e5..88c2202 100644 --- a/ci/rubocop.rails.yml +++ b/ci/rubocop.rails.yml @@ -489,9 +489,23 @@ 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. diff --git a/ci/rubocop.yml b/ci/rubocop.yml index 3145e9b..bd9eeae 100644 --- a/ci/rubocop.yml +++ b/ci/rubocop.yml @@ -486,9 +486,23 @@ 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. diff --git a/src/rubocop/rubocop.ribose.yml b/src/rubocop/rubocop.ribose.yml index e4f3805..0ffabc8 100644 --- a/src/rubocop/rubocop.ribose.yml +++ b/src/rubocop/rubocop.ribose.yml @@ -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.