Skip to content

Commit a885e8c

Browse files
committed
Upgrade Rubocop for Travis builds from 0.25.0 -> 0.26.0
In the process, we've also decided to switch access modifiers from outdented style to indented, keeping us in line with the defaults. Change-Id: Id578bffad07009a8b5c9e1fe9c9a3858f8e57ccd Reviewed-on: http://gerrit.causes.com/42250 Tested-by: jenkins <jenkins@causes.com> Reviewed-by: Shane da Silva <shane.dasilva@brigade.com>
1 parent 49521b3 commit a885e8c

22 files changed

+24
-29
lines changed

.rubocop.yml

-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
AmbiguousRegexpLiteral:
22
Enabled: false
33

4-
AccessModifierIndentation:
5-
EnforcedStyle: outdent
6-
74
AssignmentInCondition:
85
Enabled: false
96

bin/overcommit

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@ require 'overcommit/cli'
55

66
logger = Overcommit::Logger.new(STDOUT)
77

8-
Overcommit::CLI.new(ARGV, logger).tap do |cli|
9-
cli.run
10-
end
8+
Overcommit::CLI.new(ARGV, logger).run

lib/overcommit/cli.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def run
2121
end
2222
end
2323

24-
private
24+
private
2525

2626
attr_reader :log
2727

lib/overcommit/configuration.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ def apply_environment!(hook_context, env)
6666
end
6767
end
6868

69-
protected
69+
protected
7070

7171
attr_reader :hash
7272

73-
private
73+
private
7474

7575
def built_in_hook?(hook_context, hook_name)
7676
hook_name = Overcommit::Utils.snake_case(hook_name)

lib/overcommit/configuration_loader.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def default_configuration
2121
@default_config ||= load_from_file(DEFAULT_CONFIG_PATH)
2222
end
2323

24-
private
24+
private
2525

2626
# Loads a configuration, ensuring it extends the default configuration.
2727
def load_file(file)

lib/overcommit/configuration_validator.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def validate(hash)
99
hash
1010
end
1111

12-
private
12+
private
1313

1414
# Ensures that keys for all supported hook types exist (PreCommit,
1515
# CommitMsg, etc.)

lib/overcommit/hook/base.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def applicable_files
7474
@applicable_files ||= modified_files.select { |file| applicable_file?(file) }
7575
end
7676

77-
private
77+
private
7878

7979
def requires_modified_files?
8080
@config['requires_files']

lib/overcommit/hook/post_checkout/index_tags.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def run
1212
:pass
1313
end
1414

15-
private
15+
private
1616

1717
SCRIPT_LOCATION = Overcommit::Utils.script_path('index-tags')
1818

lib/overcommit/hook/pre_commit/image_optim.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def run
2525
:pass
2626
end
2727

28-
private
28+
private
2929

3030
def optimize_images(image_paths)
3131
image_optim = ::ImageOptim.new(:pngout => false)

lib/overcommit/hook/pre_commit/rails_schema_up_to_date.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def run # rubocop:disable CyclomaticComplexity, PerceivedComplexity
2828
:pass
2929
end
3030

31-
private
31+
private
3232

3333
def migration_files
3434
@migration_files ||= applicable_files.select do |file|

lib/overcommit/hook_context/commit_msg.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def commit_message_file
2323
@args[0]
2424
end
2525

26-
private
26+
private
2727

2828
def raw_commit_message_lines
2929
::IO.readlines(commit_message_file)

lib/overcommit/hook_context/pre_commit.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def modified_lines(file)
6767
@modified_lines[file] ||= Overcommit::GitRepo.extract_modified_lines(file, :staged => true)
6868
end
6969

70-
private
70+
private
7171

7272
# Clears the working tree so that the stash can be applied.
7373
def clear_working_tree

lib/overcommit/hook_loader/base.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def load_hooks
2020
raise NotImplementedError
2121
end
2222

23-
private
23+
private
2424

2525
attr_reader :log
2626

lib/overcommit/hook_loader/plugin_hook_loader.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ def load_hooks
1818
end
1919
end
2020

21-
private
21+
private
2222

2323
def check_for_modified_plugins(plugin_paths)
2424
modified_plugins = plugin_paths.
2525
map { |path| Overcommit::HookSigner.new(path, @config, @context) }.
26-
select { |signer| signer.signature_changed? }
26+
select(&:signature_changed?)
2727

2828
return if modified_plugins.empty?
2929

@@ -45,7 +45,7 @@ def check_for_modified_plugins(plugin_paths)
4545
raise Overcommit::Exceptions::HookCancelled
4646
end
4747

48-
modified_plugins.each { |signer| signer.update_signature! }
48+
modified_plugins.each(&:update_signature!)
4949
end
5050
end
5151
end

lib/overcommit/hook_runner.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def run
3131
end
3232
end
3333

34-
private
34+
private
3535

3636
attr_reader :log
3737

lib/overcommit/hook_signer.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def update_signature!
3838
end
3939
end
4040

41-
private
41+
private
4242

4343
# Calculates a hash of a hook using a combination of its configuration and
4444
# file contents.

lib/overcommit/installer.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def run(target, options)
2323
end
2424
end
2525

26-
private
26+
private
2727

2828
attr_reader :log
2929

lib/overcommit/logger.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def bold_warning(str)
4242
color('1;33', str)
4343
end
4444

45-
private
45+
private
4646

4747
def color(code, str)
4848
log(@out.tty? ? "\033[#{code}m#{str}\033[0m" : str)

lib/overcommit/printer.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def end_hook(hook, status, output)
5959
print_result(hook, status, output)
6060
end
6161

62-
private
62+
private
6363

6464
def print_header(hook)
6565
hook_name = "[#{hook.name}] "

lib/overcommit/user_input.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def get
1313
@io.gets
1414
end
1515

16-
private
16+
private
1717

1818
# Git hooks are not interactive and will close STDIN by default.
1919
def reopen_tty

lib/overcommit/utils.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def supported_hook_types
4242
# Returns a list of supported hook classes (PreCommit, CommitMsg, etc.)
4343
def supported_hook_type_classes
4444
supported_hook_types.map do |file|
45-
file.split('-').map { |part| part.capitalize }.join
45+
file.split('-').map(&:capitalize).join
4646
end
4747
end
4848

overcommit.gemspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ Gem::Specification.new do |s|
3030

3131
s.add_development_dependency 'image_optim', '~> 0.15.0'
3232
s.add_development_dependency 'rspec', '~> 3.0'
33-
s.add_development_dependency 'rubocop', '0.25.0' # Pin for Travis builds
33+
s.add_development_dependency 'rubocop', '0.26.0' # Pin for Travis builds
3434
end

0 commit comments

Comments
 (0)