Skip to content

Commit 7a0a809

Browse files
committed
Remove unnecessary freeze calls on literal strings
Now that we no longer support Ruby 2.2, we can remove these redundant `freeze` calls since we specify `frozen_string_literal` at the top of these files.
1 parent 19812b5 commit 7a0a809

10 files changed

+17
-17
lines changed

lib/overcommit/constants.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# Global application constants.
44
module Overcommit
55
HOME = File.expand_path(File.join(File.dirname(__FILE__), '..', '..')).freeze
6-
CONFIG_FILE_NAME = '.overcommit.yml'.freeze
6+
CONFIG_FILE_NAME = '.overcommit.yml'
77

88
HOOK_DIRECTORY = File.join(HOME, 'lib', 'overcommit', 'hook').freeze
99

10-
REPO_URL = 'https://github.com/brigade/overcommit'.freeze
11-
BUG_REPORT_URL = "#{REPO_URL}/issues".freeze
10+
REPO_URL = 'https://github.com/brigade/overcommit'
11+
BUG_REPORT_URL = "#{REPO_URL}/issues"
1212
end

lib/overcommit/hook/pre_commit/berksfile_check.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Overcommit::Hook::PreCommit
66
#
77
# @see http://berkshelf.com/
88
class BerksfileCheck < Base
9-
LOCK_FILE = 'Berksfile.lock'.freeze
9+
LOCK_FILE = 'Berksfile.lock'
1010

1111
def run
1212
# Ignore if Berksfile.lock is not tracked by git

lib/overcommit/hook/pre_commit/bundle_audit.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Overcommit::Hook::PreCommit
55
#
66
# @see https://github.com/rubysec/bundler-audit
77
class BundleAudit < Base
8-
LOCK_FILE = 'Gemfile.lock'.freeze
8+
LOCK_FILE = 'Gemfile.lock'
99

1010
def run
1111
# Ignore if Gemfile.lock is not tracked by git

lib/overcommit/hook/pre_commit/bundle_check.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Overcommit::Hook::PreCommit
66
#
77
# @see http://bundler.io/
88
class BundleCheck < Base
9-
LOCK_FILE = 'Gemfile.lock'.freeze
9+
LOCK_FILE = 'Gemfile.lock'
1010

1111
def run
1212
# Ignore if Gemfile.lock is not tracked by git

lib/overcommit/hook/pre_commit/bundle_outdated.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Overcommit::Hook::PreCommit
66
#
77
# @see http://bundler.io/bundle_outdated.html
88
class BundleOutdated < Base
9-
LOCK_FILE = 'Gemfile.lock'.freeze
9+
LOCK_FILE = 'Gemfile.lock'
1010

1111
def run
1212
# Ignore if Gemfile.lock is not tracked by git

lib/overcommit/hook/pre_commit/yarn_check.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Overcommit::Hook::PreCommit
66
#
77
# @see https://yarnpkg.com/en/docs/cli/check
88
class YarnCheck < Base
9-
LOCK_FILE = 'yarn.lock'.freeze
9+
LOCK_FILE = 'yarn.lock'
1010

1111
# A lot of the errors returned by `yarn check` are outside the developer's control
1212
# (are caused by bad package specification, in the hands of the upstream maintainer)

lib/overcommit/hook_context/prepare_commit_msg.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def commit_message_filename
1616
# exists); or commit, followed by a commit SHA-1 (if a -c, -C or --amend
1717
# option was given)
1818
def commit_message_source
19-
@args[1].to_sym if @args[1]
19+
@args[1]&.to_sym
2020
end
2121

2222
# Returns the commit's SHA-1.

lib/overcommit/message_processor.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ module Overcommit
88
# output tuple from an array of {Overcommit::Hook::Message}s, respecting the
99
# configuration settings for the given hook.
1010
class MessageProcessor
11-
ERRORS_MODIFIED_HEADER = 'Errors on modified lines:'.freeze
12-
WARNINGS_MODIFIED_HEADER = 'Warnings on modified lines:'.freeze
13-
ERRORS_UNMODIFIED_HEADER = "Errors on lines you didn't modify:".freeze
14-
WARNINGS_UNMODIFIED_HEADER = "Warnings on lines you didn't modify:".freeze
15-
ERRORS_GENERIC_HEADER = 'Errors:'.freeze
16-
WARNINGS_GENERIC_HEADER = 'Warnings:'.freeze
11+
ERRORS_MODIFIED_HEADER = 'Errors on modified lines:'
12+
WARNINGS_MODIFIED_HEADER = 'Warnings on modified lines:'
13+
ERRORS_UNMODIFIED_HEADER = "Errors on lines you didn't modify:"
14+
WARNINGS_UNMODIFIED_HEADER = "Warnings on lines you didn't modify:"
15+
ERRORS_GENERIC_HEADER = 'Errors:'
16+
WARNINGS_GENERIC_HEADER = 'Warnings:'
1717

1818
# @param hook [Overcommit::Hook::Base]
1919
# @param unmodified_lines_setting [String] how to treat messages on

lib/overcommit/utils.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def matches_path?(pattern, path)
297297
#
298298
# @param args [Array<String>]
299299
def debug(*args)
300-
log.debug(*args) if log
300+
log&.debug(*args)
301301
end
302302
end
303303
end

lib/overcommit/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
# Defines the gem version.
44
module Overcommit
5-
VERSION = '0.47.0'.freeze
5+
VERSION = '0.47.0'
66
end

0 commit comments

Comments
 (0)