overcommit 0.1.4 → 0.1.5
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/scripts/jshint_runner.js +3 -9
- data/lib/overcommit/plugins/pre_commit/js_syntax.rb +17 -7
- data/lib/overcommit/version.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: ee54344839806219b40d78711ba92a3d75807f78
|
4
|
+
data.tar.gz: 943596ad2a69862b7495b714cb5a7047c86a6faa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38c3e9ab81ed52c14bca93297c3ad2fa9aefb6350460ccb6f46976a5559cc7c08638c3c3124d396e91a9349a376cadc9a7a812ca3b235baa9bb49898f1eabd84
|
7
|
+
data.tar.gz: afeda1f2ba01a717d5b5d120ce8d1a5e3bba0fc77f68062d3a7994e81e35ecfe19061d106aeb445dd7488617292b00eafd647d478b6877096e40662cf8752000
|
@@ -28,19 +28,13 @@ for (i = 0; i < arguments.length; i++) {
|
|
28
28
|
source = readFile(file);
|
29
29
|
result = JSHINT(source, options);
|
30
30
|
|
31
|
-
if (result
|
32
|
-
print(arguments[i] + " -- OK");
|
33
|
-
}
|
34
|
-
else {
|
31
|
+
if (!result) {
|
35
32
|
for (j = 0; j < JSHINT.errors.length; j++) {
|
36
33
|
error = JSHINT.errors[j];
|
37
34
|
|
38
|
-
print("
|
39
|
-
|
40
|
-
print("\t" + error.reason);
|
41
|
-
print("");
|
35
|
+
print(file + ": line " + error.line + ", col " + error.character + ", " +
|
36
|
+
error.reason);
|
42
37
|
print("\t" + error.evidence);
|
43
|
-
print("");
|
44
38
|
}
|
45
39
|
}
|
46
40
|
}
|
@@ -3,16 +3,26 @@ module Overcommit::GitHook
|
|
3
3
|
include HookRegistry
|
4
4
|
file_type :js
|
5
5
|
|
6
|
-
JS_HINT_PATH = Overcommit::Utils.script_path 'jshint.js'
|
7
|
-
JS_HINT_RUNNER_PATH = Overcommit::Utils.script_path 'jshint_runner.js'
|
8
|
-
|
9
6
|
def run_check
|
10
|
-
return :warn,
|
7
|
+
return :warn, 'Need either `jshint` or `rhino` in path' unless runner
|
8
|
+
|
9
|
+
output = runner.call(staged.join(' ')).split("\n")
|
10
|
+
return (output.none? ? :good : :bad), output
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
11
14
|
|
12
|
-
|
15
|
+
JS_HINT_PATH = Overcommit::Utils.script_path 'jshint.js'
|
16
|
+
JS_HINT_RUNNER_PATH = Overcommit::Utils.script_path 'jshint_runner.js'
|
13
17
|
|
14
|
-
|
15
|
-
|
18
|
+
def runner
|
19
|
+
if in_path? 'jshint'
|
20
|
+
lambda { |paths| `jshint #{paths}` }
|
21
|
+
elsif in_path? 'rhino'
|
22
|
+
lambda do |paths|
|
23
|
+
`rhino -strict -f #{JS_HINT_PATH} #{JS_HINT_RUNNER_PATH} #{paths} 2>&1 | grep -v warning | grep -v -e '^js: '`
|
24
|
+
end
|
25
|
+
end
|
16
26
|
end
|
17
27
|
end
|
18
28
|
end
|
data/lib/overcommit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: overcommit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Causes Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|