Skip to content

Commit

Permalink
Add Frozen String Literal to all files (#302)
Browse files Browse the repository at this point in the history
* Add fronze_string_literal

* Remove Style/RedundantFreeze

Rubocop message:
Style/RedundantFreeze: Do not freeze immutable objects, as freezing them has no effect.
  • Loading branch information
tedt10e committed Jul 20, 2021
1 parent 03d374d commit f6aa754
Show file tree
Hide file tree
Showing 79 changed files with 84 additions and 9 deletions.
1 change: 1 addition & 0 deletions .mdstyle.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md
all
rule 'MD007', indent: 4 # Unordered list indentation
Expand Down
3 changes: 0 additions & 3 deletions .rubocop.yml
Expand Up @@ -99,9 +99,6 @@ Style/EmptyMethod:
Style/FormatStringToken:
EnforcedStyle: template

Style/FrozenStringLiteralComment:
Enabled: false

Style/MultilineBlockChain:
Enabled: false

Expand Down
1 change: 1 addition & 0 deletions .yard_support.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'kramdown'
require 'kramdown-parser-gfm'

Expand Down
1 change: 1 addition & 0 deletions Appraisals
@@ -1,3 +1,4 @@
# frozen_string_literal: true
ruby_2 = Gem::Version.new(RUBY_VERSION) < Gem::Version.new('3')
ruby_27_or_higher = Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.7')
jruby = RUBY_PLATFORM.include?('java')
Expand Down
1 change: 1 addition & 0 deletions Gemfile
@@ -1,3 +1,4 @@
# frozen_string_literal: true
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

Expand Down
1 change: 1 addition & 0 deletions Rakefile
@@ -1,3 +1,4 @@
# frozen_string_literal: true
begin
require 'bundler/setup'
rescue LoadError
Expand Down
1 change: 1 addition & 0 deletions engine/app/controllers/good_job/active_jobs_controller.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
class ActiveJobsController < GoodJob::BaseController
def show
Expand Down
1 change: 1 addition & 0 deletions engine/app/controllers/good_job/assets_controller.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
class AssetsController < ActionController::Base # rubocop:disable Rails/ApplicationController
skip_before_action :verify_authenticity_token, raise: false
Expand Down
1 change: 1 addition & 0 deletions engine/app/controllers/good_job/base_controller.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
class BaseController < ActionController::Base # rubocop:disable Rails/ApplicationController
protect_from_forgery with: :exception
Expand Down
1 change: 1 addition & 0 deletions engine/app/controllers/good_job/dashboards_controller.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
class DashboardsController < GoodJob::BaseController
class JobFilter
Expand Down
1 change: 1 addition & 0 deletions engine/app/controllers/good_job/jobs_controller.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
class JobsController < GoodJob::BaseController
def destroy
Expand Down
1 change: 1 addition & 0 deletions engine/app/helpers/good_job/application_helper.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
module ApplicationHelper
end
Expand Down
1 change: 1 addition & 0 deletions engine/config/routes.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
GoodJob::Engine.routes.draw do
root to: 'dashboards#index'
resources :active_jobs, only: %i[show]
Expand Down
1 change: 1 addition & 0 deletions engine/lib/good_job/engine.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
class Engine < ::Rails::Engine
isolate_namespace GoodJob
Expand Down
1 change: 1 addition & 0 deletions exe/good_job
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'good_job/cli'

GoodJob::CLI.within_exe = true
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_5.2.gemfile
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# This file was generated by Appraisal

source "https://rubygems.org"
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_6.0.gemfile
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# This file was generated by Appraisal

source "https://rubygems.org"
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_6.1.gemfile
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# This file was generated by Appraisal

source "https://rubygems.org"
Expand Down
1 change: 1 addition & 0 deletions gemfiles/rails_head.gemfile
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# This file was generated by Appraisal

source "https://rubygems.org"
Expand Down
1 change: 1 addition & 0 deletions good_job.gemspec
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require_paths = ["lib", "engine/lib"]
require_paths.each do |require_path|
$LOAD_PATH.push File.expand_path(require_path, __dir__)
Expand Down
1 change: 1 addition & 0 deletions lib/active_job/queue_adapters/good_job_adapter.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module ActiveJob # :nodoc:
module QueueAdapters # :nodoc:
# See {GoodJob::Adapter} for details.
Expand Down
1 change: 1 addition & 0 deletions lib/generators/good_job/install_generator.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/active_record'
module GoodJob
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class CreateGoodJobs < ActiveRecord::Migration[5.2]
def change
enable_extension 'pgcrypto'
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class AddActiveJobIdConcurrencyKeyCronKeyToGoodJobs < ActiveRecord::Migration[5.2]
def change
reversible do |dir|
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class AddActiveJobIdIndexAndConcurrencyKeyIndexToGoodJobs < ActiveRecord::Migration[5.2]
disable_ddl_transaction!

Expand Down
1 change: 1 addition & 0 deletions lib/generators/good_job/update_generator.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails/generators'
require 'rails/generators/active_record'

Expand Down
1 change: 1 addition & 0 deletions lib/good_job.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rails"
require "active_job"
require "active_job/queue_adapters"
Expand Down
1 change: 1 addition & 0 deletions lib/good_job/active_job_extensions.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
module ActiveJobExtensions
end
Expand Down
1 change: 1 addition & 0 deletions lib/good_job/active_job_extensions/concurrency.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
module ActiveJobExtensions
module Concurrency
Expand Down
1 change: 1 addition & 0 deletions lib/good_job/adapter.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
#
# ActiveJob Adapter.
Expand Down
1 change: 1 addition & 0 deletions lib/good_job/cli.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'thor'

module GoodJob
Expand Down
1 change: 1 addition & 0 deletions lib/good_job/configuration.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
#
# +GoodJob::Configuration+ provides normalized configuration information to
Expand Down
1 change: 1 addition & 0 deletions lib/good_job/current_execution.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'active_support/core_ext/module/attribute_accessors_per_thread'

module GoodJob
Expand Down
1 change: 1 addition & 0 deletions lib/good_job/daemon.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
#
# Manages daemonization of the current process.
Expand Down
1 change: 1 addition & 0 deletions lib/good_job/execution_result.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
# Stores the results of job execution
class ExecutionResult
Expand Down
7 changes: 4 additions & 3 deletions lib/good_job/job.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
# ActiveRecord model that represents an +ActiveJob+ job.
# Parent class can be configured with +GoodJob.active_record_parent_class+.
Expand All @@ -10,12 +11,12 @@ class Job < Object.const_get(GoodJob.active_record_parent_class)
PreviouslyPerformedError = Class.new(StandardError)

# ActiveJob jobs without a +queue_name+ attribute are placed on this queue.
DEFAULT_QUEUE_NAME = 'default'.freeze
DEFAULT_QUEUE_NAME = 'default'
# ActiveJob jobs without a +priority+ attribute are given this priority.
DEFAULT_PRIORITY = 0

self.table_name = 'good_jobs'.freeze
self.advisory_lockable_column = 'id'.freeze
self.table_name = 'good_jobs'
self.advisory_lockable_column = 'id'

attr_readonly :serialized_params

Expand Down
1 change: 1 addition & 0 deletions lib/good_job/job_performer.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'concurrent/delay'

module GoodJob
Expand Down
1 change: 1 addition & 0 deletions lib/good_job/lockable.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
#
# Adds Postgres advisory locking capabilities to an ActiveRecord record.
Expand Down
1 change: 1 addition & 0 deletions lib/good_job/log_subscriber.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
#
# Listens to GoodJob notifications and logs them.
Expand Down
1 change: 1 addition & 0 deletions lib/good_job/multi_scheduler.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
# Delegates the interface of a single {Scheduler} to multiple Schedulers.
class MultiScheduler
Expand Down
3 changes: 2 additions & 1 deletion lib/good_job/notifier.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'concurrent/atomic/atomic_boolean'

module GoodJob # :nodoc:
Expand All @@ -13,7 +14,7 @@ class Notifier
AdapterCannotListenError = Class.new(StandardError)

# Default Postgres channel for LISTEN/NOTIFY
CHANNEL = 'good_job'.freeze
CHANNEL = 'good_job'
# Defaults for instance of Concurrent::ThreadPoolExecutor
EXECUTOR_OPTIONS = {
name: name,
Expand Down
1 change: 1 addition & 0 deletions lib/good_job/poller.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'concurrent/atomic/atomic_boolean'

module GoodJob # :nodoc:
Expand Down
1 change: 1 addition & 0 deletions lib/good_job/railtie.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module GoodJob
# Ruby on Rails integration.
class Railtie < ::Rails::Railtie
Expand Down
1 change: 1 addition & 0 deletions lib/good_job/scheduler.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "concurrent/executor/thread_pool_executor"
require "concurrent/executor/timer_set"
require "concurrent/scheduled_task"
Expand Down
3 changes: 2 additions & 1 deletion lib/good_job/version.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
module GoodJob
# GoodJob gem version.
VERSION = '1.11.2'.freeze
VERSION = '1.11.2'
end
1 change: 1 addition & 0 deletions spec/generators/good_job/install_generator_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'
require 'generators/good_job/install_generator'

Expand Down
1 change: 1 addition & 0 deletions spec/generators/good_job/update_generator_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'
require 'generators/good_job/update_generator'

Expand Down
1 change: 1 addition & 0 deletions spec/integration/scheduler_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe 'Schedule Integration' do
Expand Down
1 change: 1 addition & 0 deletions spec/integration/server_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe 'Server modes', skip_if_java: true do
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

describe ActiveJob::QueueAdapters::GoodJobAdapter do
Expand Down
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe GoodJob::ActiveJobExtensions::Concurrency do
Expand Down
1 change: 1 addition & 0 deletions spec/lib/good_job/current_execution_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe GoodJob::CurrentExecution do
Expand Down
1 change: 1 addition & 0 deletions spec/lib/good_job/daemon_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe GoodJob::Daemon, skip_if_java: true do
Expand Down
1 change: 1 addition & 0 deletions spec/lib/good_job/job_performer_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe GoodJob::JobPerformer do
Expand Down
1 change: 1 addition & 0 deletions spec/lib/good_job/job_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe GoodJob::Job do
Expand Down
1 change: 1 addition & 0 deletions spec/lib/good_job/lockable_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe GoodJob::Lockable do
Expand Down
1 change: 1 addition & 0 deletions spec/lib/good_job/multi_scheduler_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe GoodJob::MultiScheduler do
Expand Down
1 change: 1 addition & 0 deletions spec/lib/good_job/notifier_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe GoodJob::Notifier do
Expand Down
1 change: 1 addition & 0 deletions spec/lib/good_job/poller_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe GoodJob::Poller do
Expand Down
1 change: 1 addition & 0 deletions spec/lib/good_job/railtie_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe GoodJob::Railtie do
Expand Down
1 change: 1 addition & 0 deletions spec/lib/good_job/scheduler_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

RSpec.describe GoodJob::Scheduler do
Expand Down
1 change: 1 addition & 0 deletions spec/lib/good_job_spec.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'rails_helper'

describe GoodJob do
Expand Down
1 change: 1 addition & 0 deletions spec/rails_helper.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
Expand Down
1 change: 1 addition & 0 deletions spec/support/database_cleaner.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
RSpec.configure do |config|
# Disabled because this causes the same database connection to be reused across threads
# which causes Advisory Locks to not be effective because they are locked per-connection/per-thread.
Expand Down
1 change: 1 addition & 0 deletions spec/support/example_app_helper.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require 'fileutils'

module ExampleAppHelper
Expand Down
1 change: 1 addition & 0 deletions spec/support/jruby.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
RSpec.configure do |c|
if RUBY_PLATFORM.include?('java')
puts "Excluding System Tests in JRuby"
Expand Down
1 change: 1 addition & 0 deletions spec/support/output_helper.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module OutputHelper
def quiet(&block)
if ENV['LOUD'].present?
Expand Down
1 change: 1 addition & 0 deletions spec/support/postgres_notices.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
#
# Raise an exception when Postgres writes a notice to $stderr
#
Expand Down
1 change: 1 addition & 0 deletions spec/support/pre_documentation_formatter.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
RSpec::Support.require_rspec_core "formatters/base_text_formatter"
RSpec::Support.require_rspec_core "formatters/console_codes"

Expand Down
1 change: 1 addition & 0 deletions spec/support/rails_versions.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
RSpec.configure do |c|
less_than_rails_6 = Gem::Version.new(Rails.version) < Gem::Version.new('6')
c.filter_run_excluding(:skip_rails_5) if less_than_rails_6
Expand Down
1 change: 1 addition & 0 deletions spec/support/reset_good_job.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
THREAD_ERRORS = Concurrent::Array.new

RSpec.configure do |config|
Expand Down
1 change: 1 addition & 0 deletions spec/support/reset_rails_queue_adapter.rb
@@ -1,3 +1,4 @@
# frozen_string_literal: true
RSpec.configure do |config|
config.around do |example|
original_adapter = ActiveJob::Base.queue_adapter
Expand Down

0 comments on commit f6aa754

Please sign in to comment.