Skip to content

Commit 9b63f5a

Browse files
authored
Clean up some warnings (#1315)
This solves a few random warnings that have been floating around for a while. Not really a huge deal: - Add `pstore` to the bundle. TBH I think this warning would otherwise just go away when pstore stops being bundled with Ruby but yaml still is, but I'm tired of seeing this warning. - Opt-in to frozen string literals everywhere. This fixes a test that was triggering warnings about them, but is also just something that should have been done in general, since this will become the default at some point in Ruby's future. (Nothing about the specific test at issue is really changing, though. As far as I can tell, Rails test requests pass string values for POST bodies directly on to Rack's mock request, which then tries to set the string's encoding, which causes the warning. I guess it does not do so if the string is frozen.) * Opt into frozen string literals everywhere Should have done this long ago!
1 parent 306d210 commit 9b63f5a

File tree

179 files changed

+367
-16
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+367
-16
lines changed

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ Style/ExponentialNotation:
152152
Style/FormatStringToken:
153153
Enabled: false
154154

155+
Style/FrozenStringLiteralComment:
156+
EnforcedStyle: always_true
157+
155158
Style/GuardClause:
156159
Enabled: false
157160

.rubocop_todo.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ Style/OptionalBooleanParameter:
4949
- 'app/jobs/analyze_change_job.rb'
5050
- 'app/models/application_record.rb'
5151

52-
# Offense count: 67
53-
# Cop supports --auto-correct.
54-
# Configuration parameters: EnforcedStyle, SupportedStyles.
55-
# SupportedStyles: when_needed, always, never
56-
Style/FrozenStringLiteralComment:
57-
Enabled: false
58-
5952
# Offense count: 4
6053
# Cop supports --auto-correct.
6154
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.

Gemfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ gem 'hiredis'
3535
gem 'sentry-ruby', '~> 5.26.0'
3636
gem 'sentry-rails', '~> 5.26.0'
3737

38+
# We don't make direct use of this; it's really here to suppress a warning about upcoming changes to bundled gems.
39+
gem "pstore", "~> 0.2.0"
40+
3841
# See https://github.com/rails/execjs#readme for more supported runtimes
3942
# gem 'therubyracer', platforms: :ruby
4043
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder

Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ GEM
268268
method_source (~> 1.0)
269269
pry-rails (0.3.11)
270270
pry (>= 0.13.0)
271+
pstore (0.2.0)
271272
psych (5.2.6)
272273
date
273274
stringio
@@ -468,6 +469,7 @@ DEPENDENCIES
468469
pg (~> 1.6)
469470
postmark-rails
470471
pry-rails
472+
pstore (~> 0.2.0)
471473
puma (~> 7.1)
472474
pundit (~> 2.5.2)
473475
rack-brotli

Rakefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Add your own tasks in files placed in lib/tasks ending in .rake,
24
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
35

app/channels/application_cable/channel.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module ApplicationCable
24
class Channel < ActionCable::Channel::Base
35
end

app/channels/application_cable/connection.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module ApplicationCable
24
class Connection < ActionCable::Connection::Base
35
end

app/controllers/admin/users_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Admin
24
class UsersController < ApplicationController
35
before_action :authenticate_user!

app/controllers/admin_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class AdminController < ApplicationController
24
protect_from_forgery with: :exception
35

app/controllers/api/v0/annotations_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
class Api::V0::AnnotationsController < Api::V0::ApiController
24
include SortingConcern
35
include BlockedParamsConcern

0 commit comments

Comments
 (0)