From 395f668b086a524f51bbdfcd5a334209e22f5f07 Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Sat, 26 Sep 2026 09:19:12 -0700 Subject: [PATCH] Enable Style/FrozenStringLiteralComment Remove the .rubocop.yml entry that disabled Style/FrozenStringLiteralComment so the cop runs with its default EnforcedStyle (always). Add "# frozen_string_literal: true" to the 8 files the cop flagged: Gemfile, Rakefile, packs-specification.gemspec, lib/packs-specification.rb, lib/packs/pack.rb, lib/packs/rspec/support.rb, lib/packs/specification.rb and lib/packs/specification/configuration.rb. In files with a Sorbet sigil the pragma goes on the line after "# typed:", matching lib/packs/rspec/fixture_helper.rb. Drop the now-redundant .freeze on Packs::PACKAGE_FILE (Style/RedundantFreeze). The constant is still frozen via the pragma. No mutation fixes were needed. Specs pass on Ruby 3.3, 3.4 and 4.0 with -W:deprecated and produce no chilled-string warnings. A static sweep of lib/, bin/, spec/, the Gemfile, the Rakefile and the gemspec found no in-place mutation of string literals. --- .rubocop.yml | 4 ---- Gemfile | 2 ++ Rakefile | 1 + lib/packs-specification.rb | 3 ++- lib/packs/pack.rb | 1 + lib/packs/rspec/support.rb | 2 ++ lib/packs/specification.rb | 1 + lib/packs/specification/configuration.rb | 1 + packs-specification.gemspec | 2 ++ 9 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index f95aee0..6739379 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -36,10 +36,6 @@ Lint/DuplicateBranch: Style/NegatedIf: Enabled: false -# Disabling for now until it's clearer why we want this -Style/FrozenStringLiteralComment: - Enabled: false - # It's nice to be able to read the condition first before reading the code within the condition Style/GuardClause: Enabled: false diff --git a/Gemfile b/Gemfile index 13605c8..e3cc818 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' # Specify your gem's dependencies in packs.gemspec diff --git a/Rakefile b/Rakefile index 806deab..088722c 100644 --- a/Rakefile +++ b/Rakefile @@ -1,4 +1,5 @@ # typed: ignore +# frozen_string_literal: true require 'bundler/gem_tasks' require 'rspec/core/rake_task' diff --git a/lib/packs-specification.rb b/lib/packs-specification.rb index 31669ef..21d6464 100644 --- a/lib/packs-specification.rb +++ b/lib/packs-specification.rb @@ -1,4 +1,5 @@ # typed: strict +# frozen_string_literal: true require 'yaml' require 'pathname' @@ -10,7 +11,7 @@ # because this allows a production environment to require `packs-specification` only and get some simple functionality, without # needing to load all of `packs`. module Packs - PACKAGE_FILE = T.let('package.yml'.freeze, String) + PACKAGE_FILE = T.let('package.yml', String) class << self extend T::Sig diff --git a/lib/packs/pack.rb b/lib/packs/pack.rb index d0d45ee..995737f 100644 --- a/lib/packs/pack.rb +++ b/lib/packs/pack.rb @@ -1,4 +1,5 @@ # typed: strict +# frozen_string_literal: true module Packs class Pack diff --git a/lib/packs/rspec/support.rb b/lib/packs/rspec/support.rb index 4675f06..32e7810 100644 --- a/lib/packs/rspec/support.rb +++ b/lib/packs/rspec/support.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'fileutils' require 'tmpdir' require_relative 'fixture_helper' diff --git a/lib/packs/specification.rb b/lib/packs/specification.rb index 6daa4ec..e3ba664 100644 --- a/lib/packs/specification.rb +++ b/lib/packs/specification.rb @@ -1,4 +1,5 @@ # typed: strict +# frozen_string_literal: true require 'packs/specification/configuration' diff --git a/lib/packs/specification/configuration.rb b/lib/packs/specification/configuration.rb index 046d9fe..2d65c08 100644 --- a/lib/packs/specification/configuration.rb +++ b/lib/packs/specification/configuration.rb @@ -1,4 +1,5 @@ # typed: strict +# frozen_string_literal: true module Packs module Specification diff --git a/packs-specification.gemspec b/packs-specification.gemspec index b1d280c..f9cb02d 100644 --- a/packs-specification.gemspec +++ b/packs-specification.gemspec @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Gem::Specification.new do |spec| spec.name = 'packs-specification' spec.version = '0.0.11'