From 88d605fe7a1cc279ec67f521b7bc48c2345e4294 Mon Sep 17 00:00:00 2001 From: Jeffrey Lau Date: Thu, 9 Nov 2023 15:50:06 +0800 Subject: [PATCH 1/5] rake: Make deep_merge() merge like Ruby's merge() ... and explicitly set extend_existing_arrays to true. --- Rakefile | 5 ++++- ci/rubocop.rails.yml | 6 +++--- ci/rubocop.yml | 6 +++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Rakefile b/Rakefile index 80c7163..8f97db8 100644 --- a/Rakefile +++ b/Rakefile @@ -61,7 +61,10 @@ namespace :build do aggregation = src.reduce({}) do |acc, file| full_path = path_in_project(file) y = YAML.safe_load(File.read(full_path)) - acc.deep_merge(y) + acc.deep_merge!( + y, + extend_existing_arrays: true, + ) end target_full_path = path_in_project(to) diff --git a/ci/rubocop.rails.yml b/ci/rubocop.rails.yml index 95194e7..2a447ef 100644 --- a/ci/rubocop.rails.yml +++ b/ci/rubocop.rails.yml @@ -78,7 +78,7 @@ Style/ClassVars: StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-class-vars Enabled: false Style/CollectionMethods: - Enabled: true + Enabled: false PreferredMethods: find: detect inject: reduce @@ -232,7 +232,7 @@ Naming/BinaryOperatorParameterName: StyleGuide: https://github.com/bbatsov/ruby-style-guide#other-arg Enabled: false Metrics/ParameterLists: - Description: Avoid parameter lists longer than three or four parameters. + Description: Avoid long parameter lists. StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params Enabled: true Max: 5 @@ -355,7 +355,7 @@ Layout/ConditionPosition: Layout/DotPosition: Description: Checks the position of the dot in multi-line method calls. StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains - EnforcedStyle: trailing + EnforcedStyle: leading Layout/ExtraSpacing: Description: Do not use unnecessary spacing. Enabled: true diff --git a/ci/rubocop.yml b/ci/rubocop.yml index 7929e40..39a13f7 100644 --- a/ci/rubocop.yml +++ b/ci/rubocop.yml @@ -75,7 +75,7 @@ Style/ClassVars: StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-class-vars Enabled: false Style/CollectionMethods: - Enabled: true + Enabled: false PreferredMethods: find: detect inject: reduce @@ -229,7 +229,7 @@ Naming/BinaryOperatorParameterName: StyleGuide: https://github.com/bbatsov/ruby-style-guide#other-arg Enabled: false Metrics/ParameterLists: - Description: Avoid parameter lists longer than three or four parameters. + Description: Avoid long parameter lists. StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params Enabled: true Max: 5 @@ -352,7 +352,7 @@ Layout/ConditionPosition: Layout/DotPosition: Description: Checks the position of the dot in multi-line method calls. StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains - EnforcedStyle: trailing + EnforcedStyle: leading Layout/ExtraSpacing: Description: Do not use unnecessary spacing. Enabled: true From f5b401e0f27fe428aad39c3a3e2cf3c36162a086 Mon Sep 17 00:00:00 2001 From: Jeffrey Lau Date: Thu, 9 Nov 2023 15:51:03 +0800 Subject: [PATCH 2/5] rake: Sort merged arrays --- Rakefile | 1 + ci/rubocop.rails.yml | 4 ++-- ci/rubocop.yml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 8f97db8..d1f0cbe 100644 --- a/Rakefile +++ b/Rakefile @@ -63,6 +63,7 @@ namespace :build do y = YAML.safe_load(File.read(full_path)) acc.deep_merge!( y, + sort_merged_arrays: true, extend_existing_arrays: true, ) end diff --git a/ci/rubocop.rails.yml b/ci/rubocop.rails.yml index 2a447ef..c12753e 100644 --- a/ci/rubocop.rails.yml +++ b/ci/rubocop.rails.yml @@ -15,10 +15,10 @@ --- AllCops: Exclude: - - vendor/**/* - db/**/* - - tmp/**/* - db/schema.rb + - tmp/**/* + - vendor/**/* DisplayCopNames: false StyleGuideCopsOnly: false TargetRubyVersion: 3.1 diff --git a/ci/rubocop.yml b/ci/rubocop.yml index 39a13f7..6c5b50e 100644 --- a/ci/rubocop.yml +++ b/ci/rubocop.yml @@ -14,9 +14,9 @@ --- AllCops: Exclude: - - vendor/**/* - db/**/* - tmp/**/* + - vendor/**/* DisplayCopNames: false StyleGuideCopsOnly: false TargetRubyVersion: 3.1 From 334a4b5d9832fd57647899989928e4a0b49ace53 Mon Sep 17 00:00:00 2001 From: Jeffrey Lau Date: Thu, 9 Nov 2023 16:52:22 +0800 Subject: [PATCH 3/5] Set Layout/DotPosition enforced style to the preferred `trailing` --- ci/rubocop.rails.yml | 2 +- ci/rubocop.yml | 2 +- src/rubocop/rubocop.ribose.yml | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ci/rubocop.rails.yml b/ci/rubocop.rails.yml index c12753e..e859085 100644 --- a/ci/rubocop.rails.yml +++ b/ci/rubocop.rails.yml @@ -355,7 +355,7 @@ Layout/ConditionPosition: Layout/DotPosition: Description: Checks the position of the dot in multi-line method calls. StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains - EnforcedStyle: leading + EnforcedStyle: trailing Layout/ExtraSpacing: Description: Do not use unnecessary spacing. Enabled: true diff --git a/ci/rubocop.yml b/ci/rubocop.yml index 6c5b50e..81b58d5 100644 --- a/ci/rubocop.yml +++ b/ci/rubocop.yml @@ -352,7 +352,7 @@ Layout/ConditionPosition: Layout/DotPosition: Description: Checks the position of the dot in multi-line method calls. StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains - EnforcedStyle: leading + EnforcedStyle: trailing Layout/ExtraSpacing: Description: Do not use unnecessary spacing. Enabled: true diff --git a/src/rubocop/rubocop.ribose.yml b/src/rubocop/rubocop.ribose.yml index 968440c..b78c82c 100644 --- a/src/rubocop/rubocop.ribose.yml +++ b/src/rubocop/rubocop.ribose.yml @@ -66,9 +66,11 @@ Style/CollectionMethods: Style/TrailingCommaInArguments: EnforcedStyleForMultiline: comma -# From 322cb2c179a721fed382a691124185a01811cf11 +# Contrary to what hound apparently prefers +# (see 322cb2c179a721fed382a691124185a01811cf11), +# we prefer trailing dots. Layout/DotPosition: - EnforcedStyle: leading + EnforcedStyle: trailing # Delete following lines after migrating to Rubocop 2.x, as these checks # will be enabled by default. From 27994763057a0c9f79ae188a2ed8885b799caa55 Mon Sep 17 00:00:00 2001 From: Jeffrey Lau Date: Thu, 9 Nov 2023 17:41:46 +0800 Subject: [PATCH 4/5] ci/hound: Bump version to 1.22.1 --- .hound.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.hound.yml b/.hound.yml index 2fe6c6d..1df2318 100644 --- a/.hound.yml +++ b/.hound.yml @@ -1,4 +1,4 @@ ruby: Enabled: true config_file: ci/rubocop.yml - version: 1.5.2 + version: 1.22.1 From db8b5079437517164f5b3bec7365809335db178a Mon Sep 17 00:00:00 2001 From: Jeffrey Lau Date: Thu, 9 Nov 2023 17:46:48 +0800 Subject: [PATCH 5/5] docs: Add comment regarding Hound CI's failure to recognize certain cops --- src/rubocop/rubocop.ribose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/rubocop/rubocop.ribose.yml b/src/rubocop/rubocop.ribose.yml index b78c82c..7e10ea9 100644 --- a/src/rubocop/rubocop.ribose.yml +++ b/src/rubocop/rubocop.ribose.yml @@ -77,5 +77,7 @@ Layout/DotPosition: Style/ArgumentsForwarding: Enabled: true +# Hound CI, being stuck on version 1.22.2 (as of 2023-11-09), +# does not recognize the following cop: Gemspec/RequireMFA: Enabled: false \ No newline at end of file