Skip to content

Commit f431150

Browse files
authored
Merge pull request #9055 from joshcooper/puppet8_frozen_string
(PUP-11841) Freeze all the strings
2 parents b54ce02 + ebb59c4 commit f431150

File tree

1,004 files changed

+1265
-271
lines changed

Some content is hidden

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

1,004 files changed

+1265
-271
lines changed

.rubocop_todo.yml

-6
Original file line numberDiff line numberDiff line change
@@ -1217,12 +1217,6 @@ Style/FormatString:
12171217
Style/FormatStringToken:
12181218
Enabled: false
12191219

1220-
# This cop supports safe auto-correction (--auto-correct).
1221-
# Configuration parameters: EnforcedStyle.
1222-
# SupportedStyles: always, always_true, never
1223-
Style/FrozenStringLiteralComment:
1224-
Enabled: false
1225-
12261220
# This cop supports safe auto-correction (--auto-correct).
12271221
Style/GlobalStdStream:
12281222
Exclude:

bin/puppet

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
23

34
begin
45
require 'puppet/util/command_line'

ext/windows/service/daemon.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
23

34
require 'fileutils'
45
require 'puppet/util/windows/daemon'

lib/hiera/puppet_function.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require 'hiera_puppet'
23

34
# Provides the base class for the puppet functions hiera, hiera_array, hiera_hash, and hiera_include.

lib/hiera/scope.rb

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1+
# frozen_string_literal: true
12
require 'forwardable'
23
class Hiera
34
class Scope
45
extend Forwardable
56

6-
CALLING_CLASS = 'calling_class'.freeze
7-
CALLING_CLASS_PATH = 'calling_class_path'.freeze
8-
CALLING_MODULE = 'calling_module'.freeze
9-
MODULE_NAME = 'module_name'.freeze
7+
CALLING_CLASS = 'calling_class'
8+
CALLING_CLASS_PATH = 'calling_class_path'
9+
CALLING_MODULE = 'calling_module'
10+
MODULE_NAME = 'module_name'
1011

1112
CALLING_KEYS = [CALLING_CLASS, CALLING_CLASS_PATH, CALLING_MODULE].freeze
12-
EMPTY_STRING = ''.freeze
13+
EMPTY_STRING = ''
1314

1415
attr_reader :real
1516

lib/hiera_puppet.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
Puppet.features.hiera?
23
require 'hiera/scope'
34
require_relative 'puppet'

lib/puppet.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative 'puppet/version'
23
require_relative 'puppet/concurrent/synchronized'
34

lib/puppet/agent.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../puppet/application'
23
require_relative '../puppet/error'
34
require_relative '../puppet/util/at_fork'

lib/puppet/agent/disabler.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/util/json_lockfile'
23

34
# This module is responsible for encapsulating the logic for

lib/puppet/agent/locker.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/util/pidlock'
23
require_relative '../../puppet/error'
34

lib/puppet/application.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require 'optparse'
23
require_relative '../puppet/util/command_line'
34
require_relative '../puppet/util/constant_inflector'

lib/puppet/application/agent.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application'
23
require_relative '../../puppet/daemon'
34
require_relative '../../puppet/util/pidlock'

lib/puppet/application/apply.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application'
23
require_relative '../../puppet/configurer'
34
require_relative '../../puppet/util/profiler/aggregate'

lib/puppet/application/catalog.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application/indirection_base'
23

34
class Puppet::Application::Catalog < Puppet::Application::IndirectionBase

lib/puppet/application/config.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application/face_base'
23

34
class Puppet::Application::Config < Puppet::Application::FaceBase

lib/puppet/application/describe.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application'
23

34
class Formatter

lib/puppet/application/device.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application'
23
require_relative '../../puppet/configurer'
34
require_relative '../../puppet/util/network_device'

lib/puppet/application/doc.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application'
23

34
class Puppet::Application::Doc < Puppet::Application
@@ -151,7 +152,7 @@ def rdoc
151152
end
152153

153154
def other
154-
text = ""
155+
text = String.new
155156
with_contents = options[:references].length <= 1
156157
exit_code = 0
157158
require_relative '../../puppet/util/reference'

lib/puppet/application/epp.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application/face_base'
23
require_relative '../../puppet/face'
34

lib/puppet/application/face_base.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application'
23
require_relative '../../puppet/face'
34
require 'optparse'

lib/puppet/application/facts.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application/indirection_base'
23

34
class Puppet::Application::Facts < Puppet::Application::IndirectionBase

lib/puppet/application/filebucket.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application'
23

34
class Puppet::Application::Filebucket < Puppet::Application

lib/puppet/application/generate.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application/face_base'
23

34
# The Generate application.

lib/puppet/application/help.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application/face_base'
23

34
class Puppet::Application::Help < Puppet::Application::FaceBase

lib/puppet/application/indirection_base.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application/face_base'
23

34
class Puppet::Application::IndirectionBase < Puppet::Application::FaceBase

lib/puppet/application/lookup.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application'
23
require_relative '../../puppet/pops'
34
require_relative '../../puppet/node'
@@ -6,7 +7,7 @@
67
class Puppet::Application::Lookup < Puppet::Application
78

89
RUN_HELP = _("Run 'puppet lookup --help' for more details").freeze
9-
DEEP_MERGE_OPTIONS = '--knock-out-prefix, --sort-merged-arrays, and --merge-hash-arrays'.freeze
10+
DEEP_MERGE_OPTIONS = '--knock-out-prefix, --sort-merged-arrays, and --merge-hash-arrays'
1011
TRUSTED_INFORMATION_FACTS = ["hostname", "domain", "fqdn", "clientcert"].freeze
1112

1213
run_mode :server

lib/puppet/application/module.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application/face_base'
23

34
class Puppet::Application::Module < Puppet::Application::FaceBase

lib/puppet/application/node.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application/indirection_base'
23

34
class Puppet::Application::Node < Puppet::Application::IndirectionBase

lib/puppet/application/parser.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application/face_base'
23
require_relative '../../puppet/face'
34

lib/puppet/application/plugin.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application/face_base'
23
class Puppet::Application::Plugin < Puppet::Application::FaceBase
34
environment_mode :not_required

lib/puppet/application/report.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application/indirection_base'
23

34
class Puppet::Application::Report < Puppet::Application::IndirectionBase

lib/puppet/application/resource.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application'
23

34
class Puppet::Application::Resource < Puppet::Application

lib/puppet/application/script.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application'
23
require_relative '../../puppet/configurer'
34
require_relative '../../puppet/util/profiler/aggregate'

lib/puppet/application/ssl.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/application'
23
require_relative '../../puppet/ssl/oids'
34

lib/puppet/application_support.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require 'yaml'
23

34
require_relative '../puppet'

lib/puppet/coercion.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
# Various methods used to coerce values into a canonical form.
23
#
34
# @api private

lib/puppet/compilable_resource_type.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../puppet'
23
# The CompilableResourceType module should be either included in a class or used as a class extension
34
# to mark that the instance used as the 'resource type' of a resource instance

lib/puppet/concurrent.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
# frozen_string_literal: true
12
module Puppet::Concurrent
23
end

lib/puppet/concurrent/lock.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/concurrent/synchronized'
23

34
module Puppet

lib/puppet/concurrent/synchronized.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
module Puppet
23
module Concurrent
34

lib/puppet/configurer.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
# The client for interacting with the puppetmaster config server.
23
require 'timeout'
34
require_relative '../puppet/util'

lib/puppet/configurer/downloader.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/configurer'
23
require_relative '../../puppet/resource/catalog'
34

lib/puppet/configurer/fact_handler.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/indirector/facts/facter'
23

34
require_relative '../../puppet/configurer'

lib/puppet/configurer/plugin_handler.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
# Break out the code related to plugins. This module is
23
# just included into the agent, but having it here makes it
34
# easier to test.

lib/puppet/confine.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
# The class that handles testing whether our providers
23
# actually work or not.
34
require_relative '../puppet/util'

lib/puppet/confine/any.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
class Puppet::Confine::Any < Puppet::Confine
23
def self.summarize(confines)
34
confines.inject(0) { |count, confine| count + confine.summary }

lib/puppet/confine/boolean.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/confine'
23

34
# Common module for the Boolean confines. It currently

lib/puppet/confine/exists.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/confine'
23

34
class Puppet::Confine::Exists < Puppet::Confine

lib/puppet/confine/false.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/confine/boolean'
23

34
class Puppet::Confine::False < Puppet::Confine

lib/puppet/confine/feature.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/confine'
23

34
class Puppet::Confine::Feature < Puppet::Confine

lib/puppet/confine/true.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/confine/boolean'
23

34
class Puppet::Confine::True < Puppet::Confine

lib/puppet/confine/variable.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/confine'
23

34
# Require a specific value for a variable, either a Puppet setting

lib/puppet/confine_collection.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
# Manage a collection of confines, returning a boolean or
23
# helpful information.
34
require_relative '../puppet/confine'

lib/puppet/confiner.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../puppet/confine_collection'
23

34
# The Confiner module contains methods for managing a Provider's confinement (suitability under given

lib/puppet/context.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../puppet/thread_local'
23

34
# Puppet::Context is a system for tracking services and contextual information

lib/puppet/context/trusted_information.rb

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../../puppet/trusted_external'
23

34
# @api private
@@ -109,12 +110,12 @@ def self.deep_freeze(object)
109110

110111
def to_h
111112
{
112-
'authenticated'.freeze => authenticated,
113-
'certname'.freeze => certname,
114-
'extensions'.freeze => extensions,
115-
'hostname'.freeze => hostname,
116-
'domain'.freeze => domain,
117-
'external'.freeze => external,
113+
'authenticated' => authenticated,
114+
'certname' => certname,
115+
'extensions' => extensions,
116+
'hostname' => hostname,
117+
'domain' => domain,
118+
'external' => external,
118119
}.freeze
119120
end
120121
end

lib/puppet/daemon.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../puppet/application'
23
require_relative '../puppet/scheduler'
34

lib/puppet/data_binding.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../puppet/indirector'
23

34
# A class for managing data lookups

lib/puppet/datatypes.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
# Data types in the Puppet Language can have implementations written in Ruby
23
# and distributed in puppet modules. A data type can be declared together with
34
# its implementation by creating a file in 'lib/puppet/functions/<modulename>'.

lib/puppet/datatypes/error.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
Puppet::DataTypes.create_type('Error') do
23
interface <<-PUPPET
34
type_parameters => {

lib/puppet/datatypes/impl/error.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
class Puppet::DataTypes::Error
23
attr_reader :msg, :kind, :issue_code, :details
34
alias message msg

lib/puppet/defaults.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../puppet/util/platform'
23

34
module Puppet

lib/puppet/environments.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../puppet/concurrent/synchronized'
23

34
# @api private

lib/puppet/error.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
module Puppet
23
# The base class for all Puppet errors. It can wrap another exception
34
class Error < RuntimeError

lib/puppet/etc.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
require_relative '../puppet/util/character_encoding'
23
# Wrapper around Ruby Etc module allowing us to manage encoding in a single
34
# place.

lib/puppet/external/dot.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
# rdot.rb
23
#
34
#

lib/puppet/face.rb

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# frozen_string_literal: true
12
# The public name of this feature is 'face', but we have hidden all the
23
# plumbing over in the 'interfaces' namespace to make clear the distinction
34
# between the two.

0 commit comments

Comments
 (0)