overcommit 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/overcommit/plugins/pre_commit/css_linter.rb +1 -1
- data/lib/overcommit/plugins/pre_commit/js_console_log.rb +1 -1
- data/lib/overcommit/plugins/pre_commit/js_syntax.rb +1 -1
- data/lib/overcommit/plugins/pre_commit/python_flake8.rb +1 -1
- data/lib/overcommit/plugins/pre_commit/ruby_style.rb +3 -0
- data/lib/overcommit/plugins/pre_commit/scss_lint.rb +19 -3
- data/lib/overcommit/plugins/pre_commit/whitespace.rb +1 -1
- data/lib/overcommit/version.rb +1 -1
- metadata +62 -84
- data/lib/overcommit/plugins/pre_commit/erb_syntax.rb +0 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6cd8b8340af3898a298d1815312a9a626b1a8527
|
4
|
+
data.tar.gz: 785733cce0fe10a619d20ad2a761ac141a5a9130
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c5fd460690ff210f14f1940b08798d7d49c2d0c0e74ba5fcbc8391b2f46600484e058f8ea5af917ee3b34a3e6ba2a62511aed8d21fc942828c92eaf4c863ce24
|
7
|
+
data.tar.gz: 9a40e46f3cd1ddeb9a25aece89572d3000ddf41ff462599cb32c718ed3eccf740aacb0047e0fadc2f8ca54f9cbf2094224fa89bcb1f78f9a5a409af870b9d1e8
|
@@ -8,7 +8,7 @@ module Overcommit::GitHook
|
|
8
8
|
def run_check
|
9
9
|
return :warn, "Rhino is not installed" unless in_path? 'rhino'
|
10
10
|
|
11
|
-
paths = staged.
|
11
|
+
paths = staged.collect(&:path).join(' ')
|
12
12
|
|
13
13
|
output = `rhino #{CSS_LINTER_PATH} --quiet --format=compact #{paths} | grep 'Error - '`
|
14
14
|
return (output !~ /Error - (?!Unknown @ rule)/ ? :good : :bad), output
|
@@ -5,7 +5,7 @@ module Overcommit::GitHook
|
|
5
5
|
|
6
6
|
# https://www.pivotaltracker.com/story/show/18119495
|
7
7
|
def run_check
|
8
|
-
paths = staged.
|
8
|
+
paths = staged.collect(&:path).join(' ')
|
9
9
|
output = `grep -n -e 'console\\.log' #{paths}`.split("\n").reject do |line|
|
10
10
|
/^\d+:\s*\/\// =~ line || # Skip comments
|
11
11
|
/ALLOW_CONSOLE_LOG/ =~ line # and lines with ALLOW_CONSOLE_LOG
|
@@ -6,7 +6,7 @@ module Overcommit::GitHook
|
|
6
6
|
def run_check
|
7
7
|
return :warn, 'Need either `jshint` or `rhino` in path' unless runner
|
8
8
|
|
9
|
-
paths = staged.
|
9
|
+
paths = staged.collect(&:path).join(' ')
|
10
10
|
output = runner.call(paths)
|
11
11
|
|
12
12
|
return (output.empty? ? :good : :bad), output
|
@@ -8,7 +8,7 @@ module Overcommit::GitHook
|
|
8
8
|
return :warn, 'Run `pip install flake8`'
|
9
9
|
end
|
10
10
|
|
11
|
-
output = `flake8 #{(staged.join(' '))}`.split("\n")
|
11
|
+
output = `flake8 #{(staged.collect(&:path).join(' '))}`.split("\n")
|
12
12
|
return ($?.success? ? :good : :bad), output
|
13
13
|
end
|
14
14
|
end
|
@@ -10,11 +10,27 @@ module Overcommit::GitHook
|
|
10
10
|
return :warn, 'scss-lint not installed -- run `gem install scss-lint`'
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
paths_to_staged_files = Hash[staged.map { |s| [s.path, s] }]
|
14
|
+
staged_files = paths_to_staged_files.keys
|
14
15
|
|
15
|
-
output = `scss-lint #{
|
16
|
+
output = `scss-lint #{staged_files.join(' ')} 2>&1`
|
17
|
+
return :good if $?.success?
|
16
18
|
|
17
|
-
|
19
|
+
# Keep lines from the output for files that we actually modified
|
20
|
+
error_lines, warning_lines = output.lines.partition do |output_line|
|
21
|
+
if match = output_line.match(/^([^:]+):(\d+)/)
|
22
|
+
file = match[1]
|
23
|
+
line = match[2]
|
24
|
+
end
|
25
|
+
unless paths_to_staged_files[file]
|
26
|
+
return :warn, "Unexpected output from scss-lint:\n#{output}"
|
27
|
+
end
|
28
|
+
paths_to_staged_files[file].modified_lines.include?(line.to_i)
|
29
|
+
end
|
30
|
+
|
31
|
+
return :bad, error_lines.join unless error_lines.empty?
|
32
|
+
return :warn, "Modified files have lints (on lines you didn't modify)\n" <<
|
33
|
+
warning_lines.join
|
18
34
|
end
|
19
35
|
end
|
20
36
|
end
|
data/lib/overcommit/version.rb
CHANGED
metadata
CHANGED
@@ -1,129 +1,107 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: overcommit
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease: false
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 2
|
9
|
-
- 3
|
10
|
-
version: 0.2.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.4
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Causes Engineering
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2013-08-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
22
14
|
name: rspec
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
33
20
|
type: :development
|
34
|
-
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
35
27
|
description: Overcommit is a utility to install and extend Git hooks
|
36
28
|
email: eng@causes.com
|
37
|
-
executables:
|
29
|
+
executables:
|
38
30
|
- overcommit
|
39
31
|
extensions: []
|
40
|
-
|
41
32
|
extra_rdoc_files: []
|
42
|
-
|
43
|
-
|
44
|
-
- lib/overcommit/
|
45
|
-
- lib/overcommit/
|
46
|
-
- lib/overcommit/
|
47
|
-
- lib/overcommit/
|
48
|
-
- lib/overcommit/staged_file.rb
|
49
|
-
- lib/overcommit/plugins/commit_msg/hard_tabs.rb
|
50
|
-
- lib/overcommit/plugins/commit_msg/russian_novel.rb
|
33
|
+
files:
|
34
|
+
- lib/overcommit.rb
|
35
|
+
- lib/overcommit/version.rb
|
36
|
+
- lib/overcommit/utils.rb
|
37
|
+
- lib/overcommit/plugins/commit_msg/trailing_period.rb
|
38
|
+
- lib/overcommit/plugins/commit_msg/change_id.rb
|
51
39
|
- lib/overcommit/plugins/commit_msg/release_note.rb
|
52
40
|
- lib/overcommit/plugins/commit_msg/single_line_subject.rb
|
53
|
-
- lib/overcommit/plugins/commit_msg/
|
41
|
+
- lib/overcommit/plugins/commit_msg/russian_novel.rb
|
42
|
+
- lib/overcommit/plugins/commit_msg/hard_tabs.rb
|
54
43
|
- lib/overcommit/plugins/commit_msg/text_width.rb
|
55
|
-
- lib/overcommit/plugins/
|
56
|
-
- lib/overcommit/plugins/pre_commit/
|
44
|
+
- lib/overcommit/plugins/pre_commit/js_console_log.rb
|
45
|
+
- lib/overcommit/plugins/pre_commit/ruby_syntax.rb
|
57
46
|
- lib/overcommit/plugins/pre_commit/js_syntax.rb
|
58
|
-
- lib/overcommit/plugins/pre_commit/test_history.rb
|
59
47
|
- lib/overcommit/plugins/pre_commit/yaml_syntax.rb
|
60
|
-
- lib/overcommit/plugins/pre_commit/
|
48
|
+
- lib/overcommit/plugins/pre_commit/haml_syntax.rb
|
61
49
|
- lib/overcommit/plugins/pre_commit/causes_email.rb
|
62
|
-
- lib/overcommit/plugins/pre_commit/js_console_log.rb
|
63
50
|
- lib/overcommit/plugins/pre_commit/author_name.rb
|
64
|
-
- lib/overcommit/plugins/pre_commit/erb_syntax.rb
|
65
|
-
- lib/overcommit/plugins/pre_commit/scss_lint.rb
|
66
|
-
- lib/overcommit/plugins/pre_commit/coffee_lint.rb
|
67
|
-
- lib/overcommit/plugins/pre_commit/haml_syntax.rb
|
68
51
|
- lib/overcommit/plugins/pre_commit/whitespace.rb
|
52
|
+
- lib/overcommit/plugins/pre_commit/python_flake8.rb
|
53
|
+
- lib/overcommit/plugins/pre_commit/coffee_lint.rb
|
54
|
+
- lib/overcommit/plugins/pre_commit/test_history.rb
|
69
55
|
- lib/overcommit/plugins/pre_commit/restricted_paths.rb
|
70
|
-
- lib/overcommit/plugins/pre_commit/
|
56
|
+
- lib/overcommit/plugins/pre_commit/ruby_style.rb
|
57
|
+
- lib/overcommit/plugins/pre_commit/scss_lint.rb
|
71
58
|
- lib/overcommit/plugins/pre_commit/css_linter.rb
|
72
|
-
- lib/overcommit/
|
59
|
+
- lib/overcommit/staged_file.rb
|
60
|
+
- lib/overcommit/reporter.rb
|
61
|
+
- lib/overcommit/hook_specific_check.rb
|
62
|
+
- lib/overcommit/installer.rb
|
73
63
|
- lib/overcommit/errors.rb
|
74
|
-
- lib/overcommit/
|
64
|
+
- lib/overcommit/git_hook.rb
|
75
65
|
- lib/overcommit/configuration.rb
|
76
|
-
- lib/overcommit/version.rb
|
77
66
|
- lib/overcommit/hooks/pre_commit.rb
|
78
67
|
- lib/overcommit/hooks/commit_msg.rb
|
79
|
-
- lib/overcommit/
|
80
|
-
- lib/overcommit.rb
|
81
|
-
- bin/overcommit
|
68
|
+
- lib/overcommit/logger.rb
|
69
|
+
- lib/overcommit/cli.rb
|
82
70
|
- bin/run-hook
|
83
|
-
- bin/scripts/jshint.js
|
84
71
|
- bin/scripts/index-tags
|
85
|
-
- bin/scripts/csslint-rhino.js
|
86
72
|
- bin/scripts/gerrit-change-id
|
73
|
+
- bin/scripts/jshint.js
|
74
|
+
- bin/scripts/csslint-rhino.js
|
87
75
|
- bin/scripts/jshint_runner.js
|
76
|
+
- bin/overcommit
|
88
77
|
- bin/hooks/commit-msg
|
89
|
-
- bin/hooks/pre-commit
|
90
|
-
- bin/hooks/post-merge
|
91
78
|
- bin/hooks/post-checkout
|
79
|
+
- bin/hooks/post-merge
|
80
|
+
- bin/hooks/pre-commit
|
92
81
|
- bin/hooks/prepare-commit-msg
|
93
82
|
- config/templates.yml
|
94
|
-
has_rdoc: true
|
95
83
|
homepage: http://github.com/causes/overcommit
|
96
|
-
licenses:
|
84
|
+
licenses:
|
97
85
|
- MIT
|
86
|
+
metadata: {}
|
98
87
|
post_install_message:
|
99
88
|
rdoc_options: []
|
100
|
-
|
101
|
-
require_paths:
|
89
|
+
require_paths:
|
102
90
|
- lib
|
103
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
none: false
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
hash: 3
|
118
|
-
segments:
|
119
|
-
- 0
|
120
|
-
version: "0"
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
121
101
|
requirements: []
|
122
|
-
|
123
102
|
rubyforge_project:
|
124
|
-
rubygems_version:
|
103
|
+
rubygems_version: 2.0.2
|
125
104
|
signing_key:
|
126
|
-
specification_version:
|
105
|
+
specification_version: 4
|
127
106
|
summary: Opinionated Git hook manager
|
128
107
|
test_files: []
|
129
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
require 'erb'
|
2
|
-
|
3
|
-
module Overcommit::GitHook
|
4
|
-
class ErbSyntax < HookSpecificCheck
|
5
|
-
include HookRegistry
|
6
|
-
file_type :erb
|
7
|
-
ERB_CHECKER = 'bin/check-rails-erb'
|
8
|
-
|
9
|
-
def skip?
|
10
|
-
return 'Bundler is not installed' unless in_path? 'bundle'
|
11
|
-
unless File.executable? ERB_CHECKER
|
12
|
-
return "Can't find/execute #{ERB_CHECKER}"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def run_check
|
17
|
-
output = `bundle exec #{ERB_CHECKER} #{staged.map{ |file| file.path }.join(' ')}`
|
18
|
-
return (output !~ /: compile error$/ ? :good : :bad), output
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|