pre-commit 0.32.0 → 0.33.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/lib/plugins/pre_commit/checks/jshint.rb +1 -1
- data/lib/plugins/pre_commit/configuration/providers/yaml.rb +7 -6
- data/lib/pre-commit/checks/grep.rb +8 -0
- data/lib/pre-commit/configuration/providers.rb +1 -3
- data/lib/pre-commit/installer.rb +8 -8
- data/lib/pre-commit/support/jshint/jshint.js +22466 -8840
- data/lib/pre-commit/utils/git_conversions.rb +1 -1
- data/lib/pre-commit/utils/staged_files.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec088cfc089b79bf86cf1fb5ab77513c67e8bcd0
|
4
|
+
data.tar.gz: 3d1896c3eb7ec40d47b5a780f4319dd45db4d8c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fed5a4b45980d95e7ce45988a39cba06d78fec36ac647bc26c87abc5aa5aa214c7f2b3dddab9bd934892f37cb48eb240103e77cadea24404233760e3a411642
|
7
|
+
data.tar.gz: 9187460a1c5eb9cc3fea8a3048ff88f6092fc77c4fe7d42e165d81b271a657d0b121ad39d479c37b8e4abdfb28984157c0079d821cdcf13dea3684fdaec760e1
|
@@ -23,7 +23,7 @@ module PreCommit
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def context
|
26
|
-
@context ||= ExecJS.compile(File.read(linter_src) << <<-JAVASCRIPT)
|
26
|
+
@context ||= ExecJS.compile("global = this;" << File.read(linter_src) << <<-JAVASCRIPT)
|
27
27
|
;JSHINT._getErrors = function(source, options, globals) {
|
28
28
|
JSHINT(source, options, globals);
|
29
29
|
return JSHINT.errors;
|
@@ -25,12 +25,13 @@ module PreCommit
|
|
25
25
|
private
|
26
26
|
|
27
27
|
def config
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
@config ||= begin
|
29
|
+
config = {}
|
30
|
+
config.merge!(read_config(system_file))
|
31
|
+
config.merge!(read_config(global_file))
|
32
|
+
config.merge!(read_config(local_file))
|
33
|
+
config
|
34
|
+
end
|
34
35
|
end
|
35
36
|
|
36
37
|
def read_config(path)
|
@@ -5,6 +5,14 @@ require 'pre-commit/line'
|
|
5
5
|
module PreCommit
|
6
6
|
module Checks
|
7
7
|
class Grep < Shell
|
8
|
+
def initialize(*)
|
9
|
+
super
|
10
|
+
|
11
|
+
@extra_grep = nil
|
12
|
+
@message = nil
|
13
|
+
@pattern = nil
|
14
|
+
end
|
15
|
+
|
8
16
|
class PaternNotSet < StandardError
|
9
17
|
def message
|
10
18
|
"Please define 'pattern' method."
|
@@ -43,9 +43,7 @@ module PreCommit
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def find_update_plugin(plugin_name)
|
46
|
-
|
47
|
-
raise PluginNotFound.new("Plugin not found for #{plugin_name}.") unless plugin
|
48
|
-
plugin
|
46
|
+
plugins.detect{|plugin| class2string(class2name(plugin.class)) == plugin_name.to_s} || raise(PluginNotFound.new("Plugin not found for #{plugin_name}."))
|
49
47
|
end
|
50
48
|
|
51
49
|
end
|
data/lib/pre-commit/installer.rb
CHANGED
@@ -43,14 +43,14 @@ module PreCommit
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def templates
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
46
|
+
@templates ||= begin
|
47
|
+
pattern = File.join(TEMPLATE_DIR, "*")
|
48
|
+
|
49
|
+
Dir.glob(pattern).inject({}) do |hash, file|
|
50
|
+
key = file.match(/\/([^\/]+?)$/)[1]
|
51
|
+
hash[key] = file
|
52
|
+
hash
|
53
|
+
end
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|