From c2c6ae59a7d50bfccb43adc3cc49840f3ec0e6f5 Mon Sep 17 00:00:00 2001 From: Jeffrey Lau Date: Thu, 9 Nov 2023 18:02:08 +0800 Subject: [PATCH] rubocop: Enable Style/CollectionCompact for consistent nil checks --- ci/rubocop.rails.yml | 5 +++++ ci/rubocop.yml | 5 +++++ src/rubocop/rubocop.ribose.yml | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/ci/rubocop.rails.yml b/ci/rubocop.rails.yml index e859085..cd867e5 100644 --- a/ci/rubocop.rails.yml +++ b/ci/rubocop.rails.yml @@ -497,6 +497,11 @@ Metrics/PerceivedComplexity: reader. Enabled: true Max: 7 +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: Enabled: true Gemspec/RequireMFA: diff --git a/ci/rubocop.yml b/ci/rubocop.yml index 81b58d5..3145e9b 100644 --- a/ci/rubocop.yml +++ b/ci/rubocop.yml @@ -494,6 +494,11 @@ Metrics/PerceivedComplexity: reader. Enabled: true Max: 7 +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: Enabled: true Gemspec/RequireMFA: diff --git a/src/rubocop/rubocop.ribose.yml b/src/rubocop/rubocop.ribose.yml index 7e10ea9..e4f3805 100644 --- a/src/rubocop/rubocop.ribose.yml +++ b/src/rubocop/rubocop.ribose.yml @@ -61,6 +61,12 @@ Metrics/PerceivedComplexity: reader. Enabled: true Max: 7 + +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/CollectionMethods: Enabled: false Style/TrailingCommaInArguments: