Skip to content

Commit

Permalink
Merge pull request #209 from ruby/frozen
Browse files Browse the repository at this point in the history
Specify frozen string literal is true
  • Loading branch information
hsbt authored Jun 20, 2017
2 parents 5d9bc4c + 23f779f commit 06381f6
Show file tree
Hide file tree
Showing 94 changed files with 99 additions and 6 deletions.
1 change: 1 addition & 0 deletions doc/jamis.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module RDoc
module Page

Expand Down
1 change: 1 addition & 0 deletions lib/rake.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
#--
# Copyright 2003-2010 by Jim Weirich ([email protected])
#
Expand Down
1 change: 1 addition & 0 deletions lib/rake/application.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "optparse"

require "rake/task_manager"
Expand Down
1 change: 1 addition & 0 deletions lib/rake/backtrace.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake
module Backtrace # :nodoc: all
SYS_KEYS = RbConfig::CONFIG.keys.grep(/(?:[a-z]prefix|libdir)\z/)
Expand Down
1 change: 1 addition & 0 deletions lib/rake/clean.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# The 'rake/clean' file defines two file lists (CLEAN and CLOBBER) and
# two rake tasks (:clean and :clobber).
#
Expand Down
1 change: 1 addition & 0 deletions lib/rake/cloneable.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake
##
# Mixin for creating easily cloned objects.
Expand Down
1 change: 1 addition & 0 deletions lib/rake/cpu_counter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake

# Based on a script at:
Expand Down
1 change: 1 addition & 0 deletions lib/rake/default_loader.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake

# Default Rakefile loader used by +import+.
Expand Down
1 change: 1 addition & 0 deletions lib/rake/dsl_definition.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Rake DSL functions.
require "rake/file_utils_ext"

Expand Down
1 change: 1 addition & 0 deletions lib/rake/early_time.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake

# EarlyTime is a fake timestamp that occurs _before_ any other time value.
Expand Down
1 change: 1 addition & 0 deletions lib/rake/ext/core.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
class Module
# Check for an existing method in the current class before extending. If
# the method already exists, then a warning is printed and the extension is
Expand Down
3 changes: 2 additions & 1 deletion lib/rake/ext/string.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rake/ext/core"

class String
Expand Down Expand Up @@ -136,7 +137,7 @@ def pathmap_replace(patterns, &block)
# This String extension comes from Rake
def pathmap(spec=nil, &block)
return self if spec.nil?
result = ""
result = "".dup
spec.scan(/%\{[^}]*\}-?\d*[sdpfnxX%]|%-?\d+d|%.|[^%]+/) do |frag|
case frag
when "%f"
Expand Down
1 change: 1 addition & 0 deletions lib/rake/file_creation_task.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rake/file_task"
require "rake/early_time"

Expand Down
1 change: 1 addition & 0 deletions lib/rake/file_list.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rake/cloneable"
require "rake/file_utils_ext"
require "rake/ext/string"
Expand Down
1 change: 1 addition & 0 deletions lib/rake/file_task.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rake/task.rb"
require "rake/early_time"

Expand Down
1 change: 1 addition & 0 deletions lib/rake/file_utils.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rbconfig"
require "fileutils"

Expand Down
1 change: 1 addition & 0 deletions lib/rake/file_utils_ext.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rake/file_utils"

module Rake
Expand Down
1 change: 1 addition & 0 deletions lib/rake/invocation_chain.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake

# InvocationChain tracks the chain of task invocations to detect
Expand Down
1 change: 1 addition & 0 deletions lib/rake/invocation_exception_mixin.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake
module InvocationExceptionMixin
# Return the invocation chain (list of Rake tasks) that were in
Expand Down
1 change: 1 addition & 0 deletions lib/rake/late_time.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake
# LateTime is a fake timestamp that occurs _after_ any other time value.
class LateTime
Expand Down
1 change: 1 addition & 0 deletions lib/rake/linked_list.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake

# Polylithic linked list structure used to implement several data
Expand Down
1 change: 1 addition & 0 deletions lib/rake/loaders/makefile.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake

# Makefile loader to be used with the import file loader. Use this to
Expand Down
1 change: 1 addition & 0 deletions lib/rake/multi_task.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake

# Same as a regular task, but the immediate prerequisites are done in
Expand Down
1 change: 1 addition & 0 deletions lib/rake/name_space.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
##
# The NameSpace class will lookup task names in the scope defined by a
# +namespace+ command.
Expand Down
1 change: 1 addition & 0 deletions lib/rake/packagetask.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Define a package task library to aid in the definition of
# redistributable package files.

Expand Down
1 change: 1 addition & 0 deletions lib/rake/phony.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Defines a :phony task that you can use as a dependency. This allows
# file-based tasks to use non-file-based tasks as prerequisites
# without forcing them to rebuild.
Expand Down
1 change: 1 addition & 0 deletions lib/rake/private_reader.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake

# Include PrivateReader to use +private_reader+.
Expand Down
1 change: 1 addition & 0 deletions lib/rake/promise.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake

# A Promise object represents a promise to do work (a chore) in the
Expand Down
1 change: 1 addition & 0 deletions lib/rake/pseudo_status.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake

##
Expand Down
1 change: 1 addition & 0 deletions lib/rake/rake_module.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rake/application"

module Rake
Expand Down
1 change: 1 addition & 0 deletions lib/rake/rake_test_loader.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rake"

# Load the test files from the command line.
Expand Down
1 change: 1 addition & 0 deletions lib/rake/rule_recursion_overflow_error.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake

# Error indicating a recursion overflow error in task selection.
Expand Down
1 change: 1 addition & 0 deletions lib/rake/scope.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake
class Scope < LinkedList # :nodoc: all

Expand Down
3 changes: 2 additions & 1 deletion lib/rake/task.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rake/invocation_exception_mixin"

module Rake
Expand Down Expand Up @@ -320,7 +321,7 @@ def set_arg_names(args)
# Return a string describing the internal state of a task. Useful for
# debugging.
def investigation
result = "------------------------------\n"
result = "------------------------------\n".dup
result << "Investigating #{name}\n"
result << "class: #{self.class}\n"
result << "task needed: #{needed?}\n"
Expand Down
1 change: 1 addition & 0 deletions lib/rake/task_argument_error.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake

# Error indicating an ill-formed task declaration.
Expand Down
1 change: 1 addition & 0 deletions lib/rake/task_arguments.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake

##
Expand Down
1 change: 1 addition & 0 deletions lib/rake/task_manager.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake

# The TaskManager module is a mixin for managing tasks.
Expand Down
1 change: 1 addition & 0 deletions lib/rake/tasklib.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rake"

module Rake
Expand Down
1 change: 1 addition & 0 deletions lib/rake/testtask.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rake"
require "rake/tasklib"

Expand Down
1 change: 1 addition & 0 deletions lib/rake/thread_history_display.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rake/private_reader"

module Rake
Expand Down
1 change: 1 addition & 0 deletions lib/rake/thread_pool.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "set"

require "rake/promise"
Expand Down
1 change: 1 addition & 0 deletions lib/rake/trace_output.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake
module TraceOutput # :nodoc: all

Expand Down
1 change: 1 addition & 0 deletions lib/rake/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module Rake
VERSION = "12.0.0"

Expand Down
1 change: 1 addition & 0 deletions lib/rake/win32.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rbconfig"

module Rake
Expand Down
1 change: 1 addition & 0 deletions test/helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
$:.unshift File.expand_path("../../lib", __FILE__)

require 'coveralls'
Expand Down
1 change: 1 addition & 0 deletions test/support/file_creation.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module FileCreation
OLDFILE = "old"
NEWFILE = "new"
Expand Down
1 change: 1 addition & 0 deletions test/support/rakefile_definitions.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module RakefileDefinitions
include FileUtils

Expand Down
1 change: 1 addition & 0 deletions test/support/ruby_runner.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
module RubyRunner
include FileUtils

Expand Down
1 change: 1 addition & 0 deletions test/test_private_reader.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)
require "rake/private_reader"

Expand Down
1 change: 1 addition & 0 deletions test/test_rake.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)

class TestRake < Rake::TestCase
Expand Down
4 changes: 2 additions & 2 deletions test/test_rake_application.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#encoding: UTF-8
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)

class TestRakeApplication < Rake::TestCase
Expand Down Expand Up @@ -37,7 +37,7 @@ def test_display_exception_details

def test_display_exception_details_bad_encoding
begin
raise "El Niño is coming!".force_encoding("US-ASCII")
raise "El Niño is coming!".dup.force_encoding("US-ASCII")
rescue => ex
end

Expand Down
1 change: 1 addition & 0 deletions test/test_rake_application_options.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)

TESTING_REQUIRE = []
Expand Down
1 change: 1 addition & 0 deletions test/test_rake_backtrace.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)
require "open3"

Expand Down
1 change: 1 addition & 0 deletions test/test_rake_clean.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)
require "rake/clean"

Expand Down
1 change: 1 addition & 0 deletions test/test_rake_cpu_counter.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)

class TestRakeCpuCounter < Rake::TestCase
Expand Down
1 change: 1 addition & 0 deletions test/test_rake_definitions.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)
require "fileutils"

Expand Down
1 change: 1 addition & 0 deletions test/test_rake_directory_task.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)
require "fileutils"
require "pathname"
Expand Down
1 change: 1 addition & 0 deletions test/test_rake_dsl.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)

class TestRakeDsl < Rake::TestCase
Expand Down
1 change: 1 addition & 0 deletions test/test_rake_early_time.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)

class TestRakeEarlyTime < Rake::TestCase
Expand Down
1 change: 1 addition & 0 deletions test/test_rake_extension.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)
require "stringio"

Expand Down
1 change: 1 addition & 0 deletions test/test_rake_file_creation_task.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)
require "fileutils"

Expand Down
1 change: 1 addition & 0 deletions test/test_rake_file_list.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)
require "pathname"

Expand Down
1 change: 1 addition & 0 deletions test/test_rake_file_list_path_map.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)

class TestRakeFileListPathMap < Rake::TestCase
Expand Down
1 change: 1 addition & 0 deletions test/test_rake_file_task.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)
require "fileutils"
require "pathname"
Expand Down
1 change: 1 addition & 0 deletions test/test_rake_file_utils.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)
require "fileutils"
require "stringio"
Expand Down
1 change: 1 addition & 0 deletions test/test_rake_functional.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)
require "fileutils"
require "open3"
Expand Down
1 change: 1 addition & 0 deletions test/test_rake_invocation_chain.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)

class TestRakeInvocationChain < Rake::TestCase
Expand Down
1 change: 1 addition & 0 deletions test/test_rake_late_time.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)

class TestRakeLateTime < Rake::TestCase
Expand Down
1 change: 1 addition & 0 deletions test/test_rake_linked_list.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)

class TestLinkedList < Rake::TestCase
Expand Down
1 change: 1 addition & 0 deletions test/test_rake_makefile_loader.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)
require "rake/loaders/makefile"

Expand Down
1 change: 1 addition & 0 deletions test/test_rake_multi_task.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)
require "thread"

Expand Down
1 change: 1 addition & 0 deletions test/test_rake_name_space.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)

class TestRakeNameSpace < Rake::TestCase
Expand Down
1 change: 1 addition & 0 deletions test/test_rake_package_task.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)
require "rake/packagetask"

Expand Down
1 change: 1 addition & 0 deletions test/test_rake_path_map.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
require File.expand_path("../helper", __FILE__)

class TestRakePathMap < Rake::TestCase
Expand Down
Loading

0 comments on commit 06381f6

Please sign in to comment.