overcommit 0.29.0 → 0.29.1
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91af002cf7828227351dd72b5c6bf2b27e3b217d
|
4
|
+
data.tar.gz: 025444e49ce27a05f6fc54134ae0ce70a466f851
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 602cf07b0687009d092330706d3f6d54179d2cbfcd1d58fb3cfa3c9fe92195ee1a0af3d452d5649666e534d5d352ab2ca52d5dd1711bda55ec1f20d7bc5fbbcc
|
7
|
+
data.tar.gz: 642bc0ec26c0af5dcfa44a30ea930f847f1cda71dd6bcd0d78003624f5b10c3c227918dea4d68d110c4b5844e7c40fe2a4538848685d185f28297516bddc4f62
|
data/lib/overcommit/cli.rb
CHANGED
@@ -95,7 +95,7 @@ module Overcommit
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def add_other_options(opts)
|
98
|
-
opts.on('-s', '--sign', 'Update hook signatures') do |hook_to_sign|
|
98
|
+
opts.on('-s', '--sign [hook]', 'Update hook signatures', String) do |hook_to_sign|
|
99
99
|
@options[:hook_to_sign] = hook_to_sign if hook_to_sign.is_a?(String)
|
100
100
|
@options[:action] = :sign
|
101
101
|
end
|
@@ -14,6 +14,7 @@ module Overcommit
|
|
14
14
|
|
15
15
|
hash = convert_nils_to_empty_hashes(hash)
|
16
16
|
ensure_hook_type_sections_exist(hash)
|
17
|
+
check_hook_name_format(hash)
|
17
18
|
check_for_missing_enabled_option(hash) unless @options[:default]
|
18
19
|
check_for_verify_plugin_signatures_option(hash)
|
19
20
|
|
@@ -48,6 +49,31 @@ module Overcommit
|
|
48
49
|
end
|
49
50
|
end
|
50
51
|
|
52
|
+
# Prints an error message and raises an exception if a hook has an
|
53
|
+
# invalid name, since this can result in strange errors elsewhere.
|
54
|
+
def check_hook_name_format(hash)
|
55
|
+
errors = []
|
56
|
+
|
57
|
+
Overcommit::Utils.supported_hook_type_classes.each do |hook_type|
|
58
|
+
hash.fetch(hook_type, {}).each do |hook_name, _|
|
59
|
+
next if hook_name == 'ALL'
|
60
|
+
|
61
|
+
unless hook_name =~ /\A[A-Za-z0-9]+\z/
|
62
|
+
errors << "#{hook_type}::#{hook_name} has an invalid name " \
|
63
|
+
"#{hook_name}. It must contain only alphanumeric " \
|
64
|
+
'characters (no underscores or dashes, etc.)'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
if errors.any?
|
70
|
+
@log.error errors.join("\n") if @log
|
71
|
+
@log.newline if @log
|
72
|
+
raise Overcommit::Exceptions::ConfigurationError,
|
73
|
+
'One or more hooks had invalid names'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
51
77
|
# Prints a warning if there are any hooks listed in the configuration
|
52
78
|
# without `enabled` explicitly set.
|
53
79
|
def check_for_missing_enabled_option(hash)
|
@@ -11,13 +11,15 @@ module Overcommit::Hook::PreCommit
|
|
11
11
|
ignored_files = execute(%w[git ls-files -o -i --exclude-standard]).stdout.split("\n")
|
12
12
|
return :pass if ignored_files.include?(LOCK_FILE)
|
13
13
|
|
14
|
+
previous_lockfile = File.read(LOCK_FILE) if File.exist?(LOCK_FILE)
|
15
|
+
|
14
16
|
result = execute(command)
|
15
17
|
unless result.success?
|
16
18
|
return :fail, result.stdout
|
17
19
|
end
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
+
new_lockfile = File.read(LOCK_FILE) if File.exist?(LOCK_FILE)
|
22
|
+
if previous_lockfile != new_lockfile
|
21
23
|
return :fail, "#{LOCK_FILE} is not up-to-date -- run `#{command.join(' ')}`"
|
22
24
|
end
|
23
25
|
|
data/lib/overcommit/version.rb
CHANGED