From 0af91765801e2554f8de54eed5158b4e9e9e6a81 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Mon, 30 Nov 2026 13:01:48 -0800 Subject: [PATCH 1/2] Add rubocop-gusto Inherit the shared rubocop-gusto config, as packs, pack_stats and packwerk-extensions already do. - Add rubocop-gusto and rubocop-rubyfmt as development dependencies; rubocop-rubyfmt (as in pack_stats) turns off the cops that conflict with the rubyfmt check CI already runs - Inherit both configs and load their plugins - Exclude bin/ (generated binstubs) - Disable Sorbet cops, since the repo does not use Sorbet - Keep development dependencies in the gemspec - Disable Gemspec/RequireMFA so the gem's publish behaviour is unchanged - Enforce double-quoted strings - Apply safe autocorrections and record the remaining unsafe-only offenses in .rubocop_todo.yml --- .rubocop.yml | 40 +++++++++++++ .rubocop_todo.yml | 33 +++++++++++ Gemfile.lock | 91 +++++++++++++++++++++++++++++ code_manifest.gemspec | 4 +- lib/code_manifest.rb | 2 +- lib/code_manifest/manifest.rb | 6 +- spec/lib/code_manifest/rule_spec.rb | 1 - 7 files changed, 171 insertions(+), 6 deletions(-) create mode 100644 .rubocop.yml create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..86e13c5 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,40 @@ +inherit_from: .rubocop_todo.yml + +inherit_mode: + merge: + - Exclude + - Include + +inherit_gem: + rubocop-gusto: + - config/default.yml + rubocop-rubyfmt: + - config/default.yml + +plugins: + - rubocop-gusto + - rubocop-rubyfmt + +AllCops: + NewCops: enable + SuggestExtensions: false + TargetRubyVersion: 3.3 + Exclude: + - bin/**/* + - vendor/bundle/**/** + +# This repo does not use Sorbet. +Sorbet: + Enabled: false + +# Development dependencies are declared in the gemspec. +Gemspec/DevelopmentDependencies: + Enabled: true + EnforcedStyle: gemspec + +Gemspec/RequireMFA: + Enabled: false + +Style/StringLiterals: + Enabled: true + EnforcedStyle: double_quotes diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..d21d193 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,33 @@ +# This configuration was generated by +# `rubocop --auto-gen-config --exclude-limit 10000` +# on 2026-11-30 21:07:03 UTC using RuboCop version 1.93.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: PerExampleGroup, Cascade, LocalContextIncludes. +Gusto/UnreferencedLet: + Exclude: + - 'spec/lib/code_manifest/rule_spec.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Lint/DisjunctiveAssignmentInConstructor: + Exclude: + - 'lib/code_manifest/manifest.rb' + +# Offense count: 6 +# This cop supports unsafe autocorrection (--autocorrect-all). +RSpec/BeEq: + Exclude: + - 'spec/lib/code_manifest/rule_spec.rb' + +# Offense count: 1 +# Configuration parameters: Prefixes, AllowedPatterns. +# Prefixes: when, with, without +RSpec/ContextWording: + Exclude: + - 'spec/lib/code_manifest/manifest_spec.rb' diff --git a/Gemfile.lock b/Gemfile.lock index de46b92..0b235e3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,18 +6,30 @@ PATH GEM remote: https://rubygems.org/ specs: + ast (2.4.3) + code_teams (1.3.1) + sorbet-runtime date (3.5.1) debug (1.11.1) irb (~> 1.10) reline (>= 0.3.8) diff-lcs (1.6.2) erb (6.0.4) + erubi (1.13.1) io-console (0.8.2) irb (1.18.0) pp (>= 0.6.0) prism (>= 1.3.0) rdoc (>= 4.0.0) reline (>= 0.4.2) + json (3.2.0) + language_server-protocol (3.17.0.6) + lint_roller (1.1.0) + logger (1.7.0) + parallel (2.3.0) + parser (3.3.14.0) + ast (~> 2.4.1) + racc pp (0.6.4) prettyprint prettyprint (0.2.0) @@ -25,13 +37,24 @@ GEM psych (5.4.0) date stringio + racc (1.8.1) + rainbow (3.1.1) rake (13.4.2) + rbi (0.5.0) + prism (~> 1.0) + rbs (>= 4.0.1) + rbs (4.2.0) + logger + prism (>= 1.6.0) + tsort rdoc (7.2.0) erb psych (>= 4.0.0) tsort + regexp_parser (2.13.4) reline (0.6.3) io-console (~> 0.5) + rexml (3.4.4) rspec (3.13.2) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) @@ -45,8 +68,74 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-support (3.13.7) + rubocop (1.93.0) + json (>= 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) + parallel (>= 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.11.3, < 3.0) + rubocop-ast (>= 1.54.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.54.0) + ast (~> 2.4) + parser (>= 3.3.7.2) + prism (>= 1.7) + racc + rubocop-gusto (11.12.0) + code_teams + lint_roller + rubocop (>= 1.76) + rubocop-performance + rubocop-rake + rubocop-rspec + rubocop-sorbet (>= 0.13.0) + smart_todo + thor + rubocop-performance (1.27.0) + lint_roller (~> 1.1) + rubocop (>= 1.89.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) + rubocop-rake (0.7.1) + lint_roller (~> 1.1) + rubocop (>= 1.72.1) + rubocop-rspec (3.11.0) + lint_roller (~> 1.1) + rubocop (~> 1.92) + rubocop-rubyfmt (0.1.2) + lint_roller (~> 1.1) + rubocop (>= 1.72.2) + rubocop-sorbet (0.17.2) + rbi (~> 0.4, >= 0.4.3) + rbs (>= 4.1.1) + spoom (~> 1.8) + ruby-progressbar (1.13.0) + smart_todo (1.11.0) + prism (~> 1.0) + sorbet (0.6.13729) + sorbet-static (= 0.6.13729) + sorbet-runtime (0.6.13729) + sorbet-static (0.6.13729-universal-darwin) + sorbet-static (0.6.13729-x86_64-linux) + sorbet-static-and-runtime (0.6.13729) + sorbet (= 0.6.13729) + sorbet-runtime (= 0.6.13729) + spoom (1.8.14) + erubi (>= 1.10.0) + prism (>= 0.28.0) + rbi (>= 0.4.2) + rbs (>= 4.0.0.dev.5) + rexml (>= 3.2.6) + sorbet-static-and-runtime (>= 0.5.10187) + thor (>= 0.19.2) stringio (3.2.0) + thor (1.5.0) tsort (0.2.0) + unicode-display_width (3.3.0) + unicode-emoji (~> 4.3) + unicode-emoji (4.3.0) PLATFORMS arm64-darwin-21 @@ -59,6 +148,8 @@ DEPENDENCIES debug rake (~> 13.4) rspec + rubocop-gusto + rubocop-rubyfmt BUNDLED WITH 4.0.15 diff --git a/code_manifest.gemspec b/code_manifest.gemspec index 81e7c2f..cd4c386 100644 --- a/code_manifest.gemspec +++ b/code_manifest.gemspec @@ -20,6 +20,8 @@ Gem::Specification.new do |spec| spec.files = Dir["LICENSE", "README.md", "lib/**/*"] - spec.add_development_dependency("rspec") spec.add_development_dependency("debug") + spec.add_development_dependency("rspec") + spec.add_development_dependency("rubocop-gusto") + spec.add_development_dependency("rubocop-rubyfmt") end diff --git a/lib/code_manifest.rb b/lib/code_manifest.rb index 1c42ff4..a86603c 100644 --- a/lib/code_manifest.rb +++ b/lib/code_manifest.rb @@ -11,7 +11,7 @@ class Error < StandardError end MANIFEST_FILE = ".code_manifest.yml" - KEY_PATTERN = /[a-z_0-9]+/.freeze + KEY_PATTERN = /[a-z_0-9]+/ class << self def [](name) diff --git a/lib/code_manifest/manifest.rb b/lib/code_manifest/manifest.rb index 46fd8e7..37345cd 100644 --- a/lib/code_manifest/manifest.rb +++ b/lib/code_manifest/manifest.rb @@ -35,10 +35,10 @@ def digest def matches(paths) Array(paths) .select do |path| - cached_match = if @cache.key?(path) - @cache.fetch(path) + if @cache.key?(path) + cached_match = @cache.fetch(path) else - @cache[path] = [ + cached_match = @cache[path] = [ inclusion_rules.any? { |rule| rule.match?(path) }, exclusion_rules.any? { |rule| rule.match?(path) } ] diff --git a/spec/lib/code_manifest/rule_spec.rb b/spec/lib/code_manifest/rule_spec.rb index b4d1302..057a0ac 100644 --- a/spec/lib/code_manifest/rule_spec.rb +++ b/spec/lib/code_manifest/rule_spec.rb @@ -2,7 +2,6 @@ require "fileutils" require "pathname" -require "set" require "tmpdir" RSpec.describe CodeManifest::Rule do From dd565a98edc6acf46087c01bad7ccb5b3ee62455 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Mon, 30 Nov 2026 13:27:18 -0800 Subject: [PATCH 2/2] Enable RSpec/NotToNot and sort cop configurations - Enable RSpec/NotToNot, which rubocop-gusto leaves off by default - No existing spec uses `to_not`, so nothing needed correcting - Sort the cop configurations in .rubocop.yml alphabetically; a comment that introduced a group of cops is repeated on each cop in the group --- .rubocop.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 86e13c5..4a7f132 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -23,10 +23,6 @@ AllCops: - bin/**/* - vendor/bundle/**/** -# This repo does not use Sorbet. -Sorbet: - Enabled: false - # Development dependencies are declared in the gemspec. Gemspec/DevelopmentDependencies: Enabled: true @@ -35,6 +31,13 @@ Gemspec/DevelopmentDependencies: Gemspec/RequireMFA: Enabled: false +RSpec/NotToNot: + Enabled: true + +# This repo does not use Sorbet. +Sorbet: + Enabled: false + Style/StringLiterals: Enabled: true EnforcedStyle: double_quotes