From 40ba8e49f4cf5e48f8bdf3396505bb15d814027a Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Sat, 26 Sep 2026 09:18:11 -0700 Subject: [PATCH] Enable Style/FrozenStringLiteralComment Remove the .rubocop.yml entry that disabled the cop, so it runs with its default EnforcedStyle (always). Add "# frozen_string_literal: true" to the 13 files the cop flagged: Gemfile, Rakefile, code_teams.gemspec, lib/code_teams/plugin.rb, lib/code_teams/plugins/identity.rb, and every spec file. Where the pragma sits above a Sorbet "# typed:" sigil it comes first, matching the lib files that already had it. Blank lines after the magic comments satisfy Layout/EmptyLineAfterMagicComment. No mutation fixes were needed. The newly frozen literals are only used as hash keys, gemspec/Gemfile values, and read-only spec inputs. Strings the library hands back to callers (validation errors, missing_key_error_message) are interpolated, so they stay mutable on the supported Rubies (>= 3.3). --- .rubocop.yml | 4 ---- Gemfile | 2 ++ Rakefile | 1 + code_teams.gemspec | 2 ++ lib/code_teams/plugin.rb | 1 + lib/code_teams/plugins/identity.rb | 1 + spec/code_teams/plugin_helper_integration_spec.rb | 2 ++ spec/lib/code_teams/plugin_spec.rb | 2 ++ .../lib/code_teams/testing/r_spec_helpers_integration_spec.rb | 2 ++ spec/lib/code_teams/testing_spec.rb | 2 ++ spec/lib/code_teams/utils_spec.rb | 2 ++ spec/lib/code_teams_spec.rb | 2 ++ spec/spec_helper.rb | 2 ++ spec/support/io_helpers.rb | 2 ++ 14 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index d891c64..d0e91f0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -45,10 +45,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 703a2e7..b494ee2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,3 +1,5 @@ +# frozen_string_literal: true + source 'https://rubygems.org' # Specify your gem's dependencies in code_teams.gemspec diff --git a/Rakefile b/Rakefile index 806deab..e8ba183 100644 --- a/Rakefile +++ b/Rakefile @@ -1,3 +1,4 @@ +# frozen_string_literal: true # typed: ignore require 'bundler/gem_tasks' diff --git a/code_teams.gemspec b/code_teams.gemspec index 93df983..33a9462 100644 --- a/code_teams.gemspec +++ b/code_teams.gemspec @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Gem::Specification.new do |spec| spec.name = 'code_teams' spec.version = '1.3.1' diff --git a/lib/code_teams/plugin.rb b/lib/code_teams/plugin.rb index a651f6f..9140388 100644 --- a/lib/code_teams/plugin.rb +++ b/lib/code_teams/plugin.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # typed: strict module CodeTeams diff --git a/lib/code_teams/plugins/identity.rb b/lib/code_teams/plugins/identity.rb index e0591a7..46ffed8 100644 --- a/lib/code_teams/plugins/identity.rb +++ b/lib/code_teams/plugins/identity.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # typed: true module CodeTeams diff --git a/spec/code_teams/plugin_helper_integration_spec.rb b/spec/code_teams/plugin_helper_integration_spec.rb index ca5b40d..5c268bf 100644 --- a/spec/code_teams/plugin_helper_integration_spec.rb +++ b/spec/code_teams/plugin_helper_integration_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe CodeTeams::Plugin do before do CodeTeams.bust_caches! diff --git a/spec/lib/code_teams/plugin_spec.rb b/spec/lib/code_teams/plugin_spec.rb index e2ba61f..e7e196d 100644 --- a/spec/lib/code_teams/plugin_spec.rb +++ b/spec/lib/code_teams/plugin_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module TestNamespace; end RSpec.describe CodeTeams::Plugin do diff --git a/spec/lib/code_teams/testing/r_spec_helpers_integration_spec.rb b/spec/lib/code_teams/testing/r_spec_helpers_integration_spec.rb index ab4c9b4..1bdbcd2 100644 --- a/spec/lib/code_teams/testing/r_spec_helpers_integration_spec.rb +++ b/spec/lib/code_teams/testing/r_spec_helpers_integration_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'code_teams/testing' CodeTeams::Testing.enable! diff --git a/spec/lib/code_teams/testing_spec.rb b/spec/lib/code_teams/testing_spec.rb index 4e8611d..d0743a3 100644 --- a/spec/lib/code_teams/testing_spec.rb +++ b/spec/lib/code_teams/testing_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'code_teams/testing' CodeTeams::Testing.enable! diff --git a/spec/lib/code_teams/utils_spec.rb b/spec/lib/code_teams/utils_spec.rb index 91c78cc..f0fa49b 100644 --- a/spec/lib/code_teams/utils_spec.rb +++ b/spec/lib/code_teams/utils_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe CodeTeams::Utils do describe '.underscore' do # These cases pin the exact behavior of the acronym-splitting step so that the diff --git a/spec/lib/code_teams_spec.rb b/spec/lib/code_teams_spec.rb index 14d7c87..aa2549d 100644 --- a/spec/lib/code_teams_spec.rb +++ b/spec/lib/code_teams_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe CodeTeams do let(:team_yml) do <<~YML.strip diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 087ba37..7825990 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'bundler/setup' require 'pry' require 'code_teams' diff --git a/spec/support/io_helpers.rb b/spec/support/io_helpers.rb index f9cb30c..f9f5e2c 100644 --- a/spec/support/io_helpers.rb +++ b/spec/support/io_helpers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module IOHelpers def write_team_yml(extra_data: false) write_file('config/teams/my_team.yml', YAML.dump({