Skip to content

Commit 1aa68ee

Browse files
committed
Deprecate :good status in favor of :pass
Similar to the deprecation of `:bad`, we want to standardize on verbs for statuses going forward. Change-Id: Iee9df48a6ea6050b5148dd3a8fdcb9fd05577c91 Reviewed-on: http://gerrit.causes.com/40975 Tested-by: jenkins <jenkins@causes.com> Reviewed-by: Shane da Silva <shane.dasilva@brigade.com>
1 parent 1f51f11 commit 1aa68ee

39 files changed

+49
-42
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
updated hook
1010
* Display message when `overcommit-hook` file is automatically updated
1111
* Deprecate `:bad` status in favor of `:fail`
12+
Blah
13+
* Deprecate `:good` status in favor of `:pass`
1214

1315
## 0.14.1
1416

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ module Overcommit::Hook::PreCommit
194194

195195
return :fail, errors.join("\n") if errors.any?
196196

197-
:good
197+
:pass
198198
end
199199
end
200200
```

lib/overcommit/hook/commit_msg/gerrit_change_id.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class GerritChangeId < Base
1010

1111
def run
1212
result = execute([SCRIPT_LOCATION, commit_message_file])
13-
return :good if result.success?
13+
return :pass if result.success?
1414

1515
[:fail, result.stdout]
1616
end

lib/overcommit/hook/commit_msg/hard_tabs.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def run
77
return :warn, "Don't use hard tabs in commit messages"
88
end
99

10-
:good
10+
:pass
1111
end
1212
end
1313
end

lib/overcommit/hook/commit_msg/russian_novel.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def run
88
return :warn, 'You seem to have authored a Russian novel; congratulations!'
99
end
1010

11-
:good
11+
:pass
1212
end
1313
end
1414
end

lib/overcommit/hook/commit_msg/single_line_subject.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def run
66
return :warn, 'Subject should be one line and followed by a blank line'
77
end
88

9-
:good
9+
:pass
1010
end
1111
end
1212
end

lib/overcommit/hook/commit_msg/text_width.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def run
2525

2626
return :warn, errors.join("\n") if errors.any?
2727

28-
:good
28+
:pass
2929
end
3030
end
3131
end

lib/overcommit/hook/commit_msg/trailing_period.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def run
66
return :warn, 'Please omit trailing period from commit message subject'
77
end
88

9-
:good
9+
:pass
1010
end
1111
end
1212
end

lib/overcommit/hook/post_checkout/bundle_check.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def run
1111
return :warn, "#{LOCK_FILE} is not up-to-date -- run `bundle check`"
1212
end
1313

14-
:good
14+
:pass
1515
end
1616

1717
private

lib/overcommit/hook/post_checkout/index_tags.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ module Overcommit::Hook::PostCheckout
44
class IndexTags < Base
55
def run
66
unless in_path?('ctags')
7-
return :good # Silently ignore
7+
return :pass # Silently ignore
88
end
99

1010
index_tags_in_background
1111

12-
:good
12+
:pass
1313
end
1414

1515
private

lib/overcommit/hook/pre_commit/author_email.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def run
1212
'`git config --global user.email your_email@example.com`'
1313
end
1414

15-
:good
15+
:pass
1616
end
1717
end
1818
end

lib/overcommit/hook/pre_commit/author_name.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def run
1111
"\nSet your name with `git config --global user.name 'Your Name'`"
1212
end
1313

14-
:good
14+
:pass
1515
end
1616
end
1717
end

lib/overcommit/hook/pre_commit/berksfile_check.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ def run
1111

1212
# Ignore if Berksfile.lock is not tracked by git
1313
ignored_files = execute(%w[git ls-files -o -i --exclude-standard]).stdout.split("\n")
14-
return :good if ignored_files.include?(LOCK_FILE)
14+
return :pass if ignored_files.include?(LOCK_FILE)
1515

1616
result = execute(%w[berks list --quiet])
1717
unless result.success?
1818
return :fail, result.stderr
1919
end
2020

21-
:good
21+
:pass
2222
end
2323
end
2424
end

lib/overcommit/hook/pre_commit/brakeman.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def run
88

99
result = execute(%w[brakeman --exit-on-warn --quiet --summary --only-files] +
1010
applicable_files)
11-
return :good if result.success?
11+
return :pass if result.success?
1212

1313
[:fail, result.stdout]
1414
end

lib/overcommit/hook/pre_commit/bundle_check.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def run
1111

1212
# Ignore if Gemfile.lock is not tracked by git
1313
ignored_files = execute(%w[git ls-files -o -i --exclude-standard]).stdout.split("\n")
14-
return :good if ignored_files.include?(LOCK_FILE)
14+
return :pass if ignored_files.include?(LOCK_FILE)
1515

1616
result = execute(%w[bundle check])
1717
unless result.success?
@@ -23,7 +23,7 @@ def run
2323
return :fail, "#{LOCK_FILE} is not up-to-date -- run `bundle check`"
2424
end
2525

26-
:good
26+
:pass
2727
end
2828
end
2929
end

lib/overcommit/hook/pre_commit/chamber_security.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def run
88

99
result = execute(%w[chamber secure --echo --files] + applicable_files)
1010

11-
return :good if result.stdout.empty?
11+
return :pass if result.stdout.empty?
1212
[:fail, "These settings appear to need to be secured but were not: #{result.stdout}"]
1313
end
1414
end

lib/overcommit/hook/pre_commit/coffee_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def run
77
end
88

99
result = execute(%w[coffeelint --quiet] + applicable_files)
10-
return :good if result.success?
10+
return :pass if result.success?
1111

1212
[:fail, result.stdout]
1313
end

lib/overcommit/hook/pre_commit/css_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def run
77
end
88

99
result = execute(%w[csslint --quiet --format=compact] + applicable_files)
10-
return :good if result.stdout !~ /Error - (?!Unknown @ rule)/
10+
return :pass if result.stdout !~ /Error - (?!Unknown @ rule)/
1111

1212
[:fail, result.stdout]
1313
end

lib/overcommit/hook/pre_commit/go_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def run
88

99
result = execute(%w[golint] + applicable_files)
1010
# Unfortunately the exit code is always 0
11-
return :good if result.stdout.empty?
11+
return :pass if result.stdout.empty?
1212

1313
[:fail, result.stdout]
1414
end

lib/overcommit/hook/pre_commit/haml_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def run
77
end
88

99
result = execute(%w[haml-lint] + applicable_files)
10-
return :good if result.success?
10+
return :pass if result.success?
1111

1212
# Keep lines from the output for files that we actually modified
1313
error_lines, warning_lines = result.stdout.split("\n").partition do |output_line|

lib/overcommit/hook/pre_commit/hard_tabs.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def run
88
return :fail, "Hard tabs detected:\n#{result.stdout}"
99
end
1010

11-
:good
11+
:pass
1212
end
1313
end
1414
end

lib/overcommit/hook/pre_commit/image_optim.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def run
2222
" image_optim #{optimized_images.join(' ')}"
2323
end
2424

25-
:good
25+
:pass
2626
end
2727

2828
private

lib/overcommit/hook/pre_commit/js_hint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def run
99
result = execute(%w[jshint] + applicable_files)
1010
output = result.stdout
1111

12-
return :good if output.empty?
12+
return :pass if output.empty?
1313

1414
[:fail, output]
1515
end

lib/overcommit/hook/pre_commit/jscs.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def run
88
end
99

1010
result = execute(%w[jscs --reporter=inline] + applicable_files)
11-
return :good if result.success?
11+
return :pass if result.success?
1212

1313
if result.status == 1
1414
return :warn, result.stderr.chomp

lib/overcommit/hook/pre_commit/json_syntax.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def run
1414
end
1515
end
1616

17-
return :good if output.empty?
17+
return :pass if output.empty?
1818

1919
[:fail, output]
2020
end

lib/overcommit/hook/pre_commit/jsx_hint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def run
99
result = execute(%w[jsxhint] + applicable_files)
1010
output = result.stdout
1111

12-
return :good if output.empty?
12+
return :pass if output.empty?
1313

1414
[:fail, output]
1515
end

lib/overcommit/hook/pre_commit/local_paths_in_gemfile.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def run
88
return :warn, "Avoid pointing to local paths in Gemfiles:\n#{result.stdout}"
99
end
1010

11-
:good
11+
:pass
1212
end
1313
end
1414
end

lib/overcommit/hook/pre_commit/merge_conflicts.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def run
88
return :fail, "Merge conflict markers detected:\n#{result.stdout}"
99
end
1010

11-
:good
11+
:pass
1212
end
1313
end
1414
end

lib/overcommit/hook/pre_commit/pry_binding.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def run
88
return :fail, "Found a `binding.pry` call left in:\n#{result.stdout}"
99
end
1010

11-
:good
11+
:pass
1212
end
1313
end
1414
end

lib/overcommit/hook/pre_commit/python_flake8.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def run
77
end
88

99
result = execute(%w[flake8] + applicable_files)
10-
return :good if result.success?
10+
return :pass if result.success?
1111

1212
[:fail, result.stdout]
1313
end

lib/overcommit/hook/pre_commit/rails_schema_up_to_date.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def run # rubocop:disable CyclomaticComplexity
1818
end
1919
end
2020

21-
:good
21+
:pass
2222
end
2323

2424
private

lib/overcommit/hook/pre_commit/rubocop.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def run
77
end
88

99
result = execute(%w[rubocop --format=emacs --force-exclusion] + applicable_files)
10-
return :good if result.success?
10+
return :pass if result.success?
1111

1212
output = result.stdout + result.stderr
1313

lib/overcommit/hook/pre_commit/scss_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def run
77
end
88

99
result = execute(%w[scss-lint] + applicable_files)
10-
return :good if result.success?
10+
return :pass if result.success?
1111

1212
# Keep lines from the output for files that we actually modified
1313
error_lines, warning_lines = result.stdout.split("\n").partition do |output_line|

lib/overcommit/hook/pre_commit/trailing_whitespace.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def run
77
return :fail, "Trailing whitespace detected:\n#{result.stdout}"
88
end
99

10-
:good
10+
:pass
1111
end
1212
end
1313
end

lib/overcommit/hook/pre_commit/travis_lint.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def run
77
end
88

99
result = execute(%w[travis-lint] + applicable_files)
10-
return :good if result.success?
10+
return :pass if result.success?
1111

1212
[:fail, result.stdout.strip]
1313
end

lib/overcommit/hook/pre_commit/yaml_syntax.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def run
1414
end
1515
end
1616

17-
return :good if output.empty?
17+
return :pass if output.empty?
1818

1919
[:fail, output]
2020
end

lib/overcommit/printer.rb

+7-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def required_hook_not_skipped(hook)
5454
def end_hook(hook, status, output)
5555
# Want to print the header for quiet hooks only if the result wasn't good
5656
# so that the user knows what failed
57-
print_header(hook) if hook.quiet? && status != :good
57+
print_header(hook) if hook.quiet? && ![:good, :pass].include?(status)
5858

5959
print_result(hook, status, output)
6060
end
@@ -68,8 +68,13 @@ def print_header(hook)
6868

6969
def print_result(hook, status, output) # rubocop:disable CyclomaticComplexity, MethodLength
7070
case status
71-
when :good
71+
when :pass
7272
log.success 'OK' unless hook.quiet?
73+
when :good
74+
log.success 'OK'
75+
log.bold_error 'Hook returned a status of `:good`. This is deprecated ' \
76+
'in favor of `:pass` and will be removed in a future ' \
77+
'version of Overcommit'
7378
when :warn
7479
log.warning 'WARNING'
7580
print_report(output, :bold_warning)

spec/overcommit/hook_signer_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
module Overcommit::Hook::PreCommit
1717
class SomeHook
1818
def run
19-
:good
19+
:pass
2020
end
2121
end
2222
end

spec/support/matchers/hook.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def failure_message(actual, error_message)
6161
end
6262

6363
RSpec::Matchers.define :pass do |*args|
64-
check_matcher = HookMatcher.new(:good, args)
64+
check_matcher = HookMatcher.new(:pass, args)
6565

6666
match do
6767
check_matcher.matches?(actual)

0 commit comments

Comments
 (0)