overcommit 0.56.0 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/overcommit +6 -5
- data/config/default.yml +28 -1
- data/lib/overcommit/cli.rb +14 -13
- data/lib/overcommit/command_splitter.rb +2 -0
- data/lib/overcommit/configuration.rb +1 -1
- data/lib/overcommit/configuration_loader.rb +11 -8
- data/lib/overcommit/git_config.rb +1 -0
- data/lib/overcommit/git_repo.rb +4 -4
- data/lib/overcommit/hook/commit_msg/base.rb +1 -1
- data/lib/overcommit/hook/commit_msg/spell_check.rb +1 -1
- data/lib/overcommit/hook/commit_msg/text_width.rb +1 -1
- data/lib/overcommit/hook/post_checkout/base.rb +1 -0
- data/lib/overcommit/hook/post_commit/git_guilt.rb +2 -1
- data/lib/overcommit/hook/pre_commit/bundle_audit.rb +1 -1
- data/lib/overcommit/hook/pre_commit/chamber_compare.rb +5 -5
- data/lib/overcommit/hook/pre_commit/chamber_security.rb +1 -0
- data/lib/overcommit/hook/pre_commit/coffee_lint.rb +1 -1
- data/lib/overcommit/hook/pre_commit/css_lint.rb +1 -1
- data/lib/overcommit/hook/pre_commit/dart_analyzer.rb +22 -0
- data/lib/overcommit/hook/pre_commit/erb_lint.rb +20 -0
- data/lib/overcommit/hook/pre_commit/es_lint.rb +3 -6
- data/lib/overcommit/hook/pre_commit/fasterer.rb +1 -1
- data/lib/overcommit/hook/pre_commit/foodcritic.rb +3 -1
- data/lib/overcommit/hook/pre_commit/hlint.rb +1 -1
- data/lib/overcommit/hook/pre_commit/html_tidy.rb +1 -1
- data/lib/overcommit/hook/pre_commit/java_checkstyle.rb +1 -1
- data/lib/overcommit/hook/pre_commit/js_lint.rb +1 -1
- data/lib/overcommit/hook/pre_commit/jsl.rb +1 -1
- data/lib/overcommit/hook/pre_commit/kt_lint.rb +1 -1
- data/lib/overcommit/hook/pre_commit/license_finder.rb +1 -0
- data/lib/overcommit/hook/pre_commit/line_endings.rb +3 -2
- data/lib/overcommit/hook/pre_commit/nginx_test.rb +1 -1
- data/lib/overcommit/hook/pre_commit/php_cs.rb +1 -1
- data/lib/overcommit/hook/pre_commit/php_cs_fixer.rb +1 -1
- data/lib/overcommit/hook/pre_commit/php_lint.rb +3 -3
- data/lib/overcommit/hook/pre_commit/php_stan.rb +1 -1
- data/lib/overcommit/hook/pre_commit/puppet_lint.rb +1 -1
- data/lib/overcommit/hook/pre_commit/puppet_metadata_json_lint.rb +1 -1
- data/lib/overcommit/hook/pre_commit/pyflakes.rb +1 -1
- data/lib/overcommit/hook/pre_commit/pylint.rb +1 -1
- data/lib/overcommit/hook/pre_commit/python_flake8.rb +1 -1
- data/lib/overcommit/hook/pre_commit/rails_best_practices.rb +1 -1
- data/lib/overcommit/hook/pre_commit/rails_schema_up_to_date.rb +2 -2
- data/lib/overcommit/hook/pre_commit/rst_lint.rb +1 -1
- data/lib/overcommit/hook/pre_commit/scalariform.rb +1 -1
- data/lib/overcommit/hook/pre_commit/scalastyle.rb +1 -1
- data/lib/overcommit/hook/pre_commit/scss_lint.rb +3 -3
- data/lib/overcommit/hook/pre_commit/semi_standard.rb +1 -1
- data/lib/overcommit/hook/pre_commit/sqlint.rb +1 -1
- data/lib/overcommit/hook/pre_commit/standard.rb +1 -1
- data/lib/overcommit/hook/pre_commit/stylelint.rb +2 -1
- data/lib/overcommit/hook/pre_commit/swift_lint.rb +1 -1
- data/lib/overcommit/hook/pre_commit/ts_lint.rb +4 -4
- data/lib/overcommit/hook/pre_commit/w3c_css.rb +4 -4
- data/lib/overcommit/hook/pre_commit/w3c_html.rb +4 -4
- data/lib/overcommit/hook/pre_commit/xml_lint.rb +1 -1
- data/lib/overcommit/hook/pre_commit/yaml_lint.rb +25 -4
- data/lib/overcommit/hook/pre_commit/yaml_syntax.rb +7 -3
- data/lib/overcommit/hook/pre_commit/yard_coverage.rb +0 -1
- data/lib/overcommit/hook/pre_push/cargo_test.rb +1 -0
- data/lib/overcommit/hook/pre_push/flutter_test.rb +16 -0
- data/lib/overcommit/hook/pre_push/pub_test.rb +16 -0
- data/lib/overcommit/hook/prepare_commit_msg/base.rb +1 -0
- data/lib/overcommit/hook/prepare_commit_msg/replace_branch.rb +1 -1
- data/lib/overcommit/hook/shared/bower_install.rb +1 -0
- data/lib/overcommit/hook/shared/bundle_install.rb +1 -0
- data/lib/overcommit/hook/shared/composer_install.rb +1 -0
- data/lib/overcommit/hook/shared/npm_install.rb +1 -0
- data/lib/overcommit/hook/shared/pronto.rb +16 -4
- data/lib/overcommit/hook/shared/yarn_install.rb +1 -0
- data/lib/overcommit/hook_context/helpers/file_modifications.rb +1 -0
- data/lib/overcommit/hook_context/helpers/stash_unstaged_changes.rb +4 -1
- data/lib/overcommit/hook_context/post_commit.rb +1 -0
- data/lib/overcommit/hook_context/pre_push.rb +1 -0
- data/lib/overcommit/hook_context/run_all.rb +1 -0
- data/lib/overcommit/hook_context.rb +3 -3
- data/lib/overcommit/hook_loader/base.rb +3 -3
- data/lib/overcommit/hook_loader/plugin_hook_loader.rb +3 -3
- data/lib/overcommit/hook_runner.rb +8 -7
- data/lib/overcommit/hook_signer.rb +1 -0
- data/lib/overcommit/installer.rb +2 -1
- data/lib/overcommit/logger.rb +5 -0
- data/lib/overcommit/printer.rb +3 -4
- data/lib/overcommit/subprocess.rb +24 -2
- data/lib/overcommit/utils/messages_utils.rb +1 -0
- data/lib/overcommit/version.rb +1 -1
- data/libexec/index-tags +6 -4
- data/template-dir/hooks/commit-msg +27 -20
- data/template-dir/hooks/overcommit-hook +27 -20
- data/template-dir/hooks/post-checkout +27 -20
- data/template-dir/hooks/post-commit +27 -20
- data/template-dir/hooks/post-merge +27 -20
- data/template-dir/hooks/post-rewrite +27 -20
- data/template-dir/hooks/pre-commit +27 -20
- data/template-dir/hooks/pre-push +27 -20
- data/template-dir/hooks/pre-rebase +27 -20
- data/template-dir/hooks/prepare-commit-msg +27 -20
- metadata +21 -3
data/lib/overcommit/printer.rb
CHANGED
@@ -43,16 +43,14 @@ module Overcommit
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def interrupt_triggered
|
46
|
-
log.
|
47
|
-
log.error 'Interrupt signal received. Stopping hooks...'
|
46
|
+
log.error "\nInterrupt signal received. Stopping hooks..."
|
48
47
|
end
|
49
48
|
|
50
49
|
# Executed when a hook run was interrupted/cancelled by user.
|
51
50
|
def run_interrupted
|
52
51
|
log.newline
|
53
52
|
log.warning '⚠ Hook run interrupted by user'
|
54
|
-
log.warning
|
55
|
-
log.newline
|
53
|
+
log.warning "⚠ If files appear modified/missing, check your stash to recover them\n"
|
56
54
|
end
|
57
55
|
|
58
56
|
# Executed when one or more hooks by the end of the run.
|
@@ -91,6 +89,7 @@ module Overcommit
|
|
91
89
|
log.partial hook.description
|
92
90
|
log.partial '.' * [70 - hook.description.length - hook_name.length, 0].max
|
93
91
|
log.partial hook_name
|
92
|
+
log.flush
|
94
93
|
end
|
95
94
|
|
96
95
|
def print_result(hook, status, output) # rubocop:disable Metrics/CyclomaticComplexity
|
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'childprocess'
|
4
4
|
require 'tempfile'
|
5
|
+
require 'overcommit/os'
|
5
6
|
|
6
7
|
module Overcommit
|
7
8
|
# Manages execution of a child process, collecting the exit status and
|
@@ -38,7 +39,7 @@ module Overcommit
|
|
38
39
|
if options[:input]
|
39
40
|
begin
|
40
41
|
process.io.stdin.puts(options[:input])
|
41
|
-
rescue StandardError
|
42
|
+
rescue StandardError
|
42
43
|
# Silently ignore if the standard input stream of the spawned
|
43
44
|
# process is closed before we get a chance to write to it. This
|
44
45
|
# happens on JRuby a lot.
|
@@ -51,7 +52,7 @@ module Overcommit
|
|
51
52
|
err.rewind
|
52
53
|
out.rewind
|
53
54
|
|
54
|
-
Result.new(process.exit_code, out.read, err.read)
|
55
|
+
Result.new(process.exit_code, to_utf8(out.read), to_utf8(err.read))
|
55
56
|
end
|
56
57
|
|
57
58
|
# Spawns a new process in the background using the given array of
|
@@ -83,6 +84,27 @@ module Overcommit
|
|
83
84
|
%w[cmd.exe /c] + [args.join(' ')]
|
84
85
|
end
|
85
86
|
|
87
|
+
# Convert string from current locale to utf-8
|
88
|
+
#
|
89
|
+
# When running commands under windows the command output is using
|
90
|
+
# current system locale (depends on system lanuage) not UTF-8
|
91
|
+
#
|
92
|
+
# @param process [String]
|
93
|
+
# @return [String]
|
94
|
+
def to_utf8(string)
|
95
|
+
# Our encoding code doesn't work on the GitHub Actions Windows
|
96
|
+
# environment for unknown reasons, so just skip it in CI.
|
97
|
+
return string if OS.windows? && ENV['GITHUB_ACTIONS']
|
98
|
+
|
99
|
+
if Encoding.locale_charmap == 'UTF-8'
|
100
|
+
return string
|
101
|
+
end
|
102
|
+
|
103
|
+
ec = Encoding::Converter.new(Encoding.locale_charmap, 'UTF-8')
|
104
|
+
# Convert encoding, alternatively simple: string.scrub will suffice
|
105
|
+
ec.convert(string)
|
106
|
+
end
|
107
|
+
|
86
108
|
# @param process [ChildProcess]
|
87
109
|
# @return [Array<IO>]
|
88
110
|
def assign_output_streams(process)
|
data/lib/overcommit/version.rb
CHANGED
data/libexec/index-tags
CHANGED
@@ -6,10 +6,12 @@
|
|
6
6
|
|
7
7
|
set -e
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
dir="`git rev-parse --git-dir`"
|
10
|
+
|
11
|
+
trap "rm -f $dir/tags.$$" EXIT
|
12
|
+
err_file=$dir/ctags.err
|
13
|
+
if ctags --tag-relative -Rf$dir/tags.$$ --exclude=.git "$@" 2>${err_file}; then
|
14
|
+
mv $dir/tags.$$ $dir/tags
|
13
15
|
[ -e ${err_file} ] && rm -f ${err_file}
|
14
16
|
else
|
15
17
|
# Ignore STDERR unless `ctags` returned a non-zero exit code
|
@@ -29,15 +29,22 @@ end
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
30
30
|
require 'yaml'
|
31
31
|
# rubocop:disable Style/RescueModifier
|
32
|
-
|
32
|
+
gemfile =
|
33
|
+
begin
|
34
|
+
YAML.load_file('.overcommit.yml', aliases: true)['gemfile']
|
35
|
+
rescue ArgumentError
|
36
|
+
YAML.load_file('.overcommit.yml')['gemfile']
|
37
|
+
end rescue nil
|
38
|
+
|
39
|
+
if gemfile
|
33
40
|
ENV['BUNDLE_GEMFILE'] = gemfile
|
34
41
|
require 'bundler'
|
35
42
|
|
36
43
|
begin
|
37
44
|
Bundler.setup
|
38
|
-
rescue Bundler::BundlerError =>
|
39
|
-
puts "Problem loading '#{gemfile}': #{
|
40
|
-
puts "Try running:\nbundle install --gemfile=#{gemfile}" if
|
45
|
+
rescue Bundler::BundlerError => e
|
46
|
+
puts "Problem loading '#{gemfile}': #{e.message}"
|
47
|
+
puts "Try running:\nbundle install --gemfile=#{gemfile}" if e.is_a?(Bundler::GemNotFound)
|
41
48
|
exit 78 # EX_CONFIG
|
42
49
|
end
|
43
50
|
end
|
@@ -80,37 +87,37 @@ begin
|
|
80
87
|
status = runner.run
|
81
88
|
|
82
89
|
exit(status ? 0 : 65) # 65 = EX_DATAERR
|
83
|
-
rescue Overcommit::Exceptions::ConfigurationError =>
|
84
|
-
puts
|
90
|
+
rescue Overcommit::Exceptions::ConfigurationError => e
|
91
|
+
puts e
|
85
92
|
exit 78 # EX_CONFIG
|
86
|
-
rescue Overcommit::Exceptions::HookContextLoadError =>
|
87
|
-
puts
|
93
|
+
rescue Overcommit::Exceptions::HookContextLoadError => e
|
94
|
+
puts e
|
88
95
|
puts 'Are you running an old version of Overcommit?'
|
89
96
|
exit 69 # EX_UNAVAILABLE
|
90
97
|
rescue Overcommit::Exceptions::HookLoadError,
|
91
|
-
Overcommit::Exceptions::InvalidHookDefinition =>
|
92
|
-
puts
|
93
|
-
puts
|
98
|
+
Overcommit::Exceptions::InvalidHookDefinition => e
|
99
|
+
puts e.message
|
100
|
+
puts e.backtrace
|
94
101
|
exit 78 # EX_CONFIG
|
95
102
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
96
|
-
Overcommit::Exceptions::HookCleanupFailed =>
|
97
|
-
puts
|
103
|
+
Overcommit::Exceptions::HookCleanupFailed => e
|
104
|
+
puts e.message
|
98
105
|
exit 74 # EX_IOERR
|
99
106
|
rescue Overcommit::Exceptions::HookCancelled
|
100
107
|
puts 'You cancelled the hook run'
|
101
108
|
exit 130 # Ctrl-C cancel
|
102
|
-
rescue Overcommit::Exceptions::InvalidGitRepo =>
|
103
|
-
puts
|
109
|
+
rescue Overcommit::Exceptions::InvalidGitRepo => e
|
110
|
+
puts e
|
104
111
|
exit 64 # EX_USAGE
|
105
|
-
rescue Overcommit::Exceptions::ConfigurationSignatureChanged =>
|
106
|
-
puts
|
112
|
+
rescue Overcommit::Exceptions::ConfigurationSignatureChanged => e
|
113
|
+
puts e
|
107
114
|
puts "For more information, see #{Overcommit::REPO_URL}#security"
|
108
115
|
exit 1
|
109
116
|
rescue Overcommit::Exceptions::InvalidHookSignature
|
110
117
|
exit 1
|
111
|
-
rescue StandardError =>
|
112
|
-
puts
|
113
|
-
puts
|
118
|
+
rescue StandardError => e
|
119
|
+
puts e.message
|
120
|
+
puts e.backtrace
|
114
121
|
puts "Report this bug at #{Overcommit::BUG_REPORT_URL}"
|
115
122
|
exit 70 # EX_SOFTWARE
|
116
123
|
end
|
@@ -29,15 +29,22 @@ end
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
30
30
|
require 'yaml'
|
31
31
|
# rubocop:disable Style/RescueModifier
|
32
|
-
|
32
|
+
gemfile =
|
33
|
+
begin
|
34
|
+
YAML.load_file('.overcommit.yml', aliases: true)['gemfile']
|
35
|
+
rescue ArgumentError
|
36
|
+
YAML.load_file('.overcommit.yml')['gemfile']
|
37
|
+
end rescue nil
|
38
|
+
|
39
|
+
if gemfile
|
33
40
|
ENV['BUNDLE_GEMFILE'] = gemfile
|
34
41
|
require 'bundler'
|
35
42
|
|
36
43
|
begin
|
37
44
|
Bundler.setup
|
38
|
-
rescue Bundler::BundlerError =>
|
39
|
-
puts "Problem loading '#{gemfile}': #{
|
40
|
-
puts "Try running:\nbundle install --gemfile=#{gemfile}" if
|
45
|
+
rescue Bundler::BundlerError => e
|
46
|
+
puts "Problem loading '#{gemfile}': #{e.message}"
|
47
|
+
puts "Try running:\nbundle install --gemfile=#{gemfile}" if e.is_a?(Bundler::GemNotFound)
|
41
48
|
exit 78 # EX_CONFIG
|
42
49
|
end
|
43
50
|
end
|
@@ -80,37 +87,37 @@ begin
|
|
80
87
|
status = runner.run
|
81
88
|
|
82
89
|
exit(status ? 0 : 65) # 65 = EX_DATAERR
|
83
|
-
rescue Overcommit::Exceptions::ConfigurationError =>
|
84
|
-
puts
|
90
|
+
rescue Overcommit::Exceptions::ConfigurationError => e
|
91
|
+
puts e
|
85
92
|
exit 78 # EX_CONFIG
|
86
|
-
rescue Overcommit::Exceptions::HookContextLoadError =>
|
87
|
-
puts
|
93
|
+
rescue Overcommit::Exceptions::HookContextLoadError => e
|
94
|
+
puts e
|
88
95
|
puts 'Are you running an old version of Overcommit?'
|
89
96
|
exit 69 # EX_UNAVAILABLE
|
90
97
|
rescue Overcommit::Exceptions::HookLoadError,
|
91
|
-
Overcommit::Exceptions::InvalidHookDefinition =>
|
92
|
-
puts
|
93
|
-
puts
|
98
|
+
Overcommit::Exceptions::InvalidHookDefinition => e
|
99
|
+
puts e.message
|
100
|
+
puts e.backtrace
|
94
101
|
exit 78 # EX_CONFIG
|
95
102
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
96
|
-
Overcommit::Exceptions::HookCleanupFailed =>
|
97
|
-
puts
|
103
|
+
Overcommit::Exceptions::HookCleanupFailed => e
|
104
|
+
puts e.message
|
98
105
|
exit 74 # EX_IOERR
|
99
106
|
rescue Overcommit::Exceptions::HookCancelled
|
100
107
|
puts 'You cancelled the hook run'
|
101
108
|
exit 130 # Ctrl-C cancel
|
102
|
-
rescue Overcommit::Exceptions::InvalidGitRepo =>
|
103
|
-
puts
|
109
|
+
rescue Overcommit::Exceptions::InvalidGitRepo => e
|
110
|
+
puts e
|
104
111
|
exit 64 # EX_USAGE
|
105
|
-
rescue Overcommit::Exceptions::ConfigurationSignatureChanged =>
|
106
|
-
puts
|
112
|
+
rescue Overcommit::Exceptions::ConfigurationSignatureChanged => e
|
113
|
+
puts e
|
107
114
|
puts "For more information, see #{Overcommit::REPO_URL}#security"
|
108
115
|
exit 1
|
109
116
|
rescue Overcommit::Exceptions::InvalidHookSignature
|
110
117
|
exit 1
|
111
|
-
rescue StandardError =>
|
112
|
-
puts
|
113
|
-
puts
|
118
|
+
rescue StandardError => e
|
119
|
+
puts e.message
|
120
|
+
puts e.backtrace
|
114
121
|
puts "Report this bug at #{Overcommit::BUG_REPORT_URL}"
|
115
122
|
exit 70 # EX_SOFTWARE
|
116
123
|
end
|
@@ -29,15 +29,22 @@ end
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
30
30
|
require 'yaml'
|
31
31
|
# rubocop:disable Style/RescueModifier
|
32
|
-
|
32
|
+
gemfile =
|
33
|
+
begin
|
34
|
+
YAML.load_file('.overcommit.yml', aliases: true)['gemfile']
|
35
|
+
rescue ArgumentError
|
36
|
+
YAML.load_file('.overcommit.yml')['gemfile']
|
37
|
+
end rescue nil
|
38
|
+
|
39
|
+
if gemfile
|
33
40
|
ENV['BUNDLE_GEMFILE'] = gemfile
|
34
41
|
require 'bundler'
|
35
42
|
|
36
43
|
begin
|
37
44
|
Bundler.setup
|
38
|
-
rescue Bundler::BundlerError =>
|
39
|
-
puts "Problem loading '#{gemfile}': #{
|
40
|
-
puts "Try running:\nbundle install --gemfile=#{gemfile}" if
|
45
|
+
rescue Bundler::BundlerError => e
|
46
|
+
puts "Problem loading '#{gemfile}': #{e.message}"
|
47
|
+
puts "Try running:\nbundle install --gemfile=#{gemfile}" if e.is_a?(Bundler::GemNotFound)
|
41
48
|
exit 78 # EX_CONFIG
|
42
49
|
end
|
43
50
|
end
|
@@ -80,37 +87,37 @@ begin
|
|
80
87
|
status = runner.run
|
81
88
|
|
82
89
|
exit(status ? 0 : 65) # 65 = EX_DATAERR
|
83
|
-
rescue Overcommit::Exceptions::ConfigurationError =>
|
84
|
-
puts
|
90
|
+
rescue Overcommit::Exceptions::ConfigurationError => e
|
91
|
+
puts e
|
85
92
|
exit 78 # EX_CONFIG
|
86
|
-
rescue Overcommit::Exceptions::HookContextLoadError =>
|
87
|
-
puts
|
93
|
+
rescue Overcommit::Exceptions::HookContextLoadError => e
|
94
|
+
puts e
|
88
95
|
puts 'Are you running an old version of Overcommit?'
|
89
96
|
exit 69 # EX_UNAVAILABLE
|
90
97
|
rescue Overcommit::Exceptions::HookLoadError,
|
91
|
-
Overcommit::Exceptions::InvalidHookDefinition =>
|
92
|
-
puts
|
93
|
-
puts
|
98
|
+
Overcommit::Exceptions::InvalidHookDefinition => e
|
99
|
+
puts e.message
|
100
|
+
puts e.backtrace
|
94
101
|
exit 78 # EX_CONFIG
|
95
102
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
96
|
-
Overcommit::Exceptions::HookCleanupFailed =>
|
97
|
-
puts
|
103
|
+
Overcommit::Exceptions::HookCleanupFailed => e
|
104
|
+
puts e.message
|
98
105
|
exit 74 # EX_IOERR
|
99
106
|
rescue Overcommit::Exceptions::HookCancelled
|
100
107
|
puts 'You cancelled the hook run'
|
101
108
|
exit 130 # Ctrl-C cancel
|
102
|
-
rescue Overcommit::Exceptions::InvalidGitRepo =>
|
103
|
-
puts
|
109
|
+
rescue Overcommit::Exceptions::InvalidGitRepo => e
|
110
|
+
puts e
|
104
111
|
exit 64 # EX_USAGE
|
105
|
-
rescue Overcommit::Exceptions::ConfigurationSignatureChanged =>
|
106
|
-
puts
|
112
|
+
rescue Overcommit::Exceptions::ConfigurationSignatureChanged => e
|
113
|
+
puts e
|
107
114
|
puts "For more information, see #{Overcommit::REPO_URL}#security"
|
108
115
|
exit 1
|
109
116
|
rescue Overcommit::Exceptions::InvalidHookSignature
|
110
117
|
exit 1
|
111
|
-
rescue StandardError =>
|
112
|
-
puts
|
113
|
-
puts
|
118
|
+
rescue StandardError => e
|
119
|
+
puts e.message
|
120
|
+
puts e.backtrace
|
114
121
|
puts "Report this bug at #{Overcommit::BUG_REPORT_URL}"
|
115
122
|
exit 70 # EX_SOFTWARE
|
116
123
|
end
|
@@ -29,15 +29,22 @@ end
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
30
30
|
require 'yaml'
|
31
31
|
# rubocop:disable Style/RescueModifier
|
32
|
-
|
32
|
+
gemfile =
|
33
|
+
begin
|
34
|
+
YAML.load_file('.overcommit.yml', aliases: true)['gemfile']
|
35
|
+
rescue ArgumentError
|
36
|
+
YAML.load_file('.overcommit.yml')['gemfile']
|
37
|
+
end rescue nil
|
38
|
+
|
39
|
+
if gemfile
|
33
40
|
ENV['BUNDLE_GEMFILE'] = gemfile
|
34
41
|
require 'bundler'
|
35
42
|
|
36
43
|
begin
|
37
44
|
Bundler.setup
|
38
|
-
rescue Bundler::BundlerError =>
|
39
|
-
puts "Problem loading '#{gemfile}': #{
|
40
|
-
puts "Try running:\nbundle install --gemfile=#{gemfile}" if
|
45
|
+
rescue Bundler::BundlerError => e
|
46
|
+
puts "Problem loading '#{gemfile}': #{e.message}"
|
47
|
+
puts "Try running:\nbundle install --gemfile=#{gemfile}" if e.is_a?(Bundler::GemNotFound)
|
41
48
|
exit 78 # EX_CONFIG
|
42
49
|
end
|
43
50
|
end
|
@@ -80,37 +87,37 @@ begin
|
|
80
87
|
status = runner.run
|
81
88
|
|
82
89
|
exit(status ? 0 : 65) # 65 = EX_DATAERR
|
83
|
-
rescue Overcommit::Exceptions::ConfigurationError =>
|
84
|
-
puts
|
90
|
+
rescue Overcommit::Exceptions::ConfigurationError => e
|
91
|
+
puts e
|
85
92
|
exit 78 # EX_CONFIG
|
86
|
-
rescue Overcommit::Exceptions::HookContextLoadError =>
|
87
|
-
puts
|
93
|
+
rescue Overcommit::Exceptions::HookContextLoadError => e
|
94
|
+
puts e
|
88
95
|
puts 'Are you running an old version of Overcommit?'
|
89
96
|
exit 69 # EX_UNAVAILABLE
|
90
97
|
rescue Overcommit::Exceptions::HookLoadError,
|
91
|
-
Overcommit::Exceptions::InvalidHookDefinition =>
|
92
|
-
puts
|
93
|
-
puts
|
98
|
+
Overcommit::Exceptions::InvalidHookDefinition => e
|
99
|
+
puts e.message
|
100
|
+
puts e.backtrace
|
94
101
|
exit 78 # EX_CONFIG
|
95
102
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
96
|
-
Overcommit::Exceptions::HookCleanupFailed =>
|
97
|
-
puts
|
103
|
+
Overcommit::Exceptions::HookCleanupFailed => e
|
104
|
+
puts e.message
|
98
105
|
exit 74 # EX_IOERR
|
99
106
|
rescue Overcommit::Exceptions::HookCancelled
|
100
107
|
puts 'You cancelled the hook run'
|
101
108
|
exit 130 # Ctrl-C cancel
|
102
|
-
rescue Overcommit::Exceptions::InvalidGitRepo =>
|
103
|
-
puts
|
109
|
+
rescue Overcommit::Exceptions::InvalidGitRepo => e
|
110
|
+
puts e
|
104
111
|
exit 64 # EX_USAGE
|
105
|
-
rescue Overcommit::Exceptions::ConfigurationSignatureChanged =>
|
106
|
-
puts
|
112
|
+
rescue Overcommit::Exceptions::ConfigurationSignatureChanged => e
|
113
|
+
puts e
|
107
114
|
puts "For more information, see #{Overcommit::REPO_URL}#security"
|
108
115
|
exit 1
|
109
116
|
rescue Overcommit::Exceptions::InvalidHookSignature
|
110
117
|
exit 1
|
111
|
-
rescue StandardError =>
|
112
|
-
puts
|
113
|
-
puts
|
118
|
+
rescue StandardError => e
|
119
|
+
puts e.message
|
120
|
+
puts e.backtrace
|
114
121
|
puts "Report this bug at #{Overcommit::BUG_REPORT_URL}"
|
115
122
|
exit 70 # EX_SOFTWARE
|
116
123
|
end
|
@@ -29,15 +29,22 @@ end
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
30
30
|
require 'yaml'
|
31
31
|
# rubocop:disable Style/RescueModifier
|
32
|
-
|
32
|
+
gemfile =
|
33
|
+
begin
|
34
|
+
YAML.load_file('.overcommit.yml', aliases: true)['gemfile']
|
35
|
+
rescue ArgumentError
|
36
|
+
YAML.load_file('.overcommit.yml')['gemfile']
|
37
|
+
end rescue nil
|
38
|
+
|
39
|
+
if gemfile
|
33
40
|
ENV['BUNDLE_GEMFILE'] = gemfile
|
34
41
|
require 'bundler'
|
35
42
|
|
36
43
|
begin
|
37
44
|
Bundler.setup
|
38
|
-
rescue Bundler::BundlerError =>
|
39
|
-
puts "Problem loading '#{gemfile}': #{
|
40
|
-
puts "Try running:\nbundle install --gemfile=#{gemfile}" if
|
45
|
+
rescue Bundler::BundlerError => e
|
46
|
+
puts "Problem loading '#{gemfile}': #{e.message}"
|
47
|
+
puts "Try running:\nbundle install --gemfile=#{gemfile}" if e.is_a?(Bundler::GemNotFound)
|
41
48
|
exit 78 # EX_CONFIG
|
42
49
|
end
|
43
50
|
end
|
@@ -80,37 +87,37 @@ begin
|
|
80
87
|
status = runner.run
|
81
88
|
|
82
89
|
exit(status ? 0 : 65) # 65 = EX_DATAERR
|
83
|
-
rescue Overcommit::Exceptions::ConfigurationError =>
|
84
|
-
puts
|
90
|
+
rescue Overcommit::Exceptions::ConfigurationError => e
|
91
|
+
puts e
|
85
92
|
exit 78 # EX_CONFIG
|
86
|
-
rescue Overcommit::Exceptions::HookContextLoadError =>
|
87
|
-
puts
|
93
|
+
rescue Overcommit::Exceptions::HookContextLoadError => e
|
94
|
+
puts e
|
88
95
|
puts 'Are you running an old version of Overcommit?'
|
89
96
|
exit 69 # EX_UNAVAILABLE
|
90
97
|
rescue Overcommit::Exceptions::HookLoadError,
|
91
|
-
Overcommit::Exceptions::InvalidHookDefinition =>
|
92
|
-
puts
|
93
|
-
puts
|
98
|
+
Overcommit::Exceptions::InvalidHookDefinition => e
|
99
|
+
puts e.message
|
100
|
+
puts e.backtrace
|
94
101
|
exit 78 # EX_CONFIG
|
95
102
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
96
|
-
Overcommit::Exceptions::HookCleanupFailed =>
|
97
|
-
puts
|
103
|
+
Overcommit::Exceptions::HookCleanupFailed => e
|
104
|
+
puts e.message
|
98
105
|
exit 74 # EX_IOERR
|
99
106
|
rescue Overcommit::Exceptions::HookCancelled
|
100
107
|
puts 'You cancelled the hook run'
|
101
108
|
exit 130 # Ctrl-C cancel
|
102
|
-
rescue Overcommit::Exceptions::InvalidGitRepo =>
|
103
|
-
puts
|
109
|
+
rescue Overcommit::Exceptions::InvalidGitRepo => e
|
110
|
+
puts e
|
104
111
|
exit 64 # EX_USAGE
|
105
|
-
rescue Overcommit::Exceptions::ConfigurationSignatureChanged =>
|
106
|
-
puts
|
112
|
+
rescue Overcommit::Exceptions::ConfigurationSignatureChanged => e
|
113
|
+
puts e
|
107
114
|
puts "For more information, see #{Overcommit::REPO_URL}#security"
|
108
115
|
exit 1
|
109
116
|
rescue Overcommit::Exceptions::InvalidHookSignature
|
110
117
|
exit 1
|
111
|
-
rescue StandardError =>
|
112
|
-
puts
|
113
|
-
puts
|
118
|
+
rescue StandardError => e
|
119
|
+
puts e.message
|
120
|
+
puts e.backtrace
|
114
121
|
puts "Report this bug at #{Overcommit::BUG_REPORT_URL}"
|
115
122
|
exit 70 # EX_SOFTWARE
|
116
123
|
end
|
@@ -29,15 +29,22 @@ end
|
|
29
29
|
# Check if Overcommit should invoke a Bundler context for loading gems
|
30
30
|
require 'yaml'
|
31
31
|
# rubocop:disable Style/RescueModifier
|
32
|
-
|
32
|
+
gemfile =
|
33
|
+
begin
|
34
|
+
YAML.load_file('.overcommit.yml', aliases: true)['gemfile']
|
35
|
+
rescue ArgumentError
|
36
|
+
YAML.load_file('.overcommit.yml')['gemfile']
|
37
|
+
end rescue nil
|
38
|
+
|
39
|
+
if gemfile
|
33
40
|
ENV['BUNDLE_GEMFILE'] = gemfile
|
34
41
|
require 'bundler'
|
35
42
|
|
36
43
|
begin
|
37
44
|
Bundler.setup
|
38
|
-
rescue Bundler::BundlerError =>
|
39
|
-
puts "Problem loading '#{gemfile}': #{
|
40
|
-
puts "Try running:\nbundle install --gemfile=#{gemfile}" if
|
45
|
+
rescue Bundler::BundlerError => e
|
46
|
+
puts "Problem loading '#{gemfile}': #{e.message}"
|
47
|
+
puts "Try running:\nbundle install --gemfile=#{gemfile}" if e.is_a?(Bundler::GemNotFound)
|
41
48
|
exit 78 # EX_CONFIG
|
42
49
|
end
|
43
50
|
end
|
@@ -80,37 +87,37 @@ begin
|
|
80
87
|
status = runner.run
|
81
88
|
|
82
89
|
exit(status ? 0 : 65) # 65 = EX_DATAERR
|
83
|
-
rescue Overcommit::Exceptions::ConfigurationError =>
|
84
|
-
puts
|
90
|
+
rescue Overcommit::Exceptions::ConfigurationError => e
|
91
|
+
puts e
|
85
92
|
exit 78 # EX_CONFIG
|
86
|
-
rescue Overcommit::Exceptions::HookContextLoadError =>
|
87
|
-
puts
|
93
|
+
rescue Overcommit::Exceptions::HookContextLoadError => e
|
94
|
+
puts e
|
88
95
|
puts 'Are you running an old version of Overcommit?'
|
89
96
|
exit 69 # EX_UNAVAILABLE
|
90
97
|
rescue Overcommit::Exceptions::HookLoadError,
|
91
|
-
Overcommit::Exceptions::InvalidHookDefinition =>
|
92
|
-
puts
|
93
|
-
puts
|
98
|
+
Overcommit::Exceptions::InvalidHookDefinition => e
|
99
|
+
puts e.message
|
100
|
+
puts e.backtrace
|
94
101
|
exit 78 # EX_CONFIG
|
95
102
|
rescue Overcommit::Exceptions::HookSetupFailed,
|
96
|
-
Overcommit::Exceptions::HookCleanupFailed =>
|
97
|
-
puts
|
103
|
+
Overcommit::Exceptions::HookCleanupFailed => e
|
104
|
+
puts e.message
|
98
105
|
exit 74 # EX_IOERR
|
99
106
|
rescue Overcommit::Exceptions::HookCancelled
|
100
107
|
puts 'You cancelled the hook run'
|
101
108
|
exit 130 # Ctrl-C cancel
|
102
|
-
rescue Overcommit::Exceptions::InvalidGitRepo =>
|
103
|
-
puts
|
109
|
+
rescue Overcommit::Exceptions::InvalidGitRepo => e
|
110
|
+
puts e
|
104
111
|
exit 64 # EX_USAGE
|
105
|
-
rescue Overcommit::Exceptions::ConfigurationSignatureChanged =>
|
106
|
-
puts
|
112
|
+
rescue Overcommit::Exceptions::ConfigurationSignatureChanged => e
|
113
|
+
puts e
|
107
114
|
puts "For more information, see #{Overcommit::REPO_URL}#security"
|
108
115
|
exit 1
|
109
116
|
rescue Overcommit::Exceptions::InvalidHookSignature
|
110
117
|
exit 1
|
111
|
-
rescue StandardError =>
|
112
|
-
puts
|
113
|
-
puts
|
118
|
+
rescue StandardError => e
|
119
|
+
puts e.message
|
120
|
+
puts e.backtrace
|
114
121
|
puts "Report this bug at #{Overcommit::BUG_REPORT_URL}"
|
115
122
|
exit 70 # EX_SOFTWARE
|
116
123
|
end
|