Skip to content

Commit f8a27d6

Browse files
HarlemSquirrelsds
authored andcommitted
Rubocop fixes
- Add back `.freeze` on contstants for Ruby 2.2
1 parent 28c4d3d commit f8a27d6

11 files changed

+20
-20
lines changed

.rubocop.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
AllCops:
2-
TargetRubyVersion: 2.3
2+
TargetRubyVersion: 2.2
33

44
Layout/ClosingParenthesisIndentation:
55
Enabled: false

lib/overcommit/configuration_validator.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
# rubocop:disable Metrics/ClassLength, Metrics/MethodLength, Metrics/LineLength
3+
# rubocop:disable Metrics/ClassLength, Metrics/CyclomaticComplexity, Metrics/MethodLength
44
module Overcommit
55
# Validates and normalizes a configuration.
66
class ConfigurationValidator
@@ -183,4 +183,4 @@ def check_for_verify_plugin_signatures_option(hash)
183183
end
184184
end
185185
end
186-
# rubocop:enable Metrics/ClassLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength, Metrics/LineLength
186+
# rubocop:enable Metrics/ClassLength, Metrics/CyclomaticComplexity, Metrics/MethodLength

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'
6+
CONFIG_FILE_NAME = '.overcommit.yml'.freeze
77

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

10-
REPO_URL = 'https://github.com/brigade/overcommit'
11-
BUG_REPORT_URL = "#{REPO_URL}/issues"
10+
REPO_URL = 'https://github.com/brigade/overcommit'.freeze
11+
BUG_REPORT_URL = "#{REPO_URL}/issues".freeze
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'
9+
LOCK_FILE = 'Berksfile.lock'.freeze
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'
8+
LOCK_FILE = 'Gemfile.lock'.freeze
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'
9+
LOCK_FILE = 'Gemfile.lock'.freeze
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'
9+
LOCK_FILE = 'Gemfile.lock'.freeze
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'
9+
LOCK_FILE = 'yarn.lock'.freeze
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/pre_commit.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def amendment?
2121
# containing unicode characters, we replace the offending characters,
2222
# since the pattern we're looking for will consist of ASCII characters
2323
unless cmd.valid_encoding?
24-
cmd = Overcommit::Utils.parent_command.encode('UTF-16be', invalid: :replace, replace: '?')
25-
.encode('UTF-8')
24+
cmd = Overcommit::Utils.parent_command.encode('UTF-16be', invalid: :replace, replace: '?').
25+
encode('UTF-8')
2626
end
2727

2828
return @amendment if

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:'
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:'
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
1717

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

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.46.0'
5+
VERSION = '0.46.0'.freeze
66
end

0 commit comments

Comments
 (0)