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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f420353498dc12daf40ef7ac8a5feac288f3a58f
4
- data.tar.gz: 64d4c036d7ca0a4b570c0bec2a299b8d3f94c3ac
3
+ metadata.gz: ec088cfc089b79bf86cf1fb5ab77513c67e8bcd0
4
+ data.tar.gz: 3d1896c3eb7ec40d47b5a780f4319dd45db4d8c6
5
5
  SHA512:
6
- metadata.gz: f11578118c1dcacb9ac1a58505a2e96fa72e0b1bdd367e292811d899aa09394878ae6006a6eecc22204ad8f9ccfd44bf668e4f497f0633c53d36eeacc6a6ceeb
7
- data.tar.gz: e046c62a724ce15b47c6e678d7137bb0f78ffb4cfbe26dc8aaba97d43f5e81e0dad71b5cf890f092148bdd07cad8c6707afa7fe0fae1b9e7a290d8493eb56b47
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
- return @config if @config
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
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
- plugin = plugins.detect{|plugin| class2string(class2name(plugin.class)) == plugin_name.to_s}
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
@@ -43,14 +43,14 @@ module PreCommit
43
43
  end
44
44
 
45
45
  def templates
46
- return @templates if @templates
47
- pattern = File.join(TEMPLATE_DIR, "*")
48
-
49
- @templates =
50
- Dir.glob(pattern).inject({}) do |hash, file|
51
- key = file.match(/\/([^\/]+?)$/)[1]
52
- hash[key] = file
53
- hash
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