overcommit 0.22.0 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/default.yml +169 -41
- data/lib/overcommit/configuration.rb +0 -2
- data/lib/overcommit/git_repo.rb +10 -3
- data/lib/overcommit/hook/base.rb +4 -0
- data/lib/overcommit/hook/post_checkout/index_tags.rb +2 -19
- data/lib/overcommit/hook/post_commit/base.rb +10 -0
- data/lib/overcommit/hook/post_commit/git_guilt.rb +39 -0
- data/lib/overcommit/hook/post_commit/index_tags.rb +9 -0
- data/lib/overcommit/hook/post_merge/base.rb +10 -0
- data/lib/overcommit/hook/post_merge/index_tags.rb +9 -0
- data/lib/overcommit/hook/post_rewrite/base.rb +10 -0
- data/lib/overcommit/hook/post_rewrite/index_tags.rb +12 -0
- data/lib/overcommit/hook/pre_commit/css_lint.rb +20 -2
- data/lib/overcommit/hook/pre_commit/es_lint.rb +18 -0
- data/lib/overcommit/hook/pre_commit/html_tidy.rb +35 -0
- data/lib/overcommit/hook/pre_commit/image_optim.rb +1 -1
- data/lib/overcommit/hook/pre_commit/java_checkstyle.rb +19 -0
- data/lib/overcommit/hook/pre_commit/js_hint.rb +9 -3
- data/lib/overcommit/hook/pre_commit/pep257.rb +19 -0
- data/lib/overcommit/hook/pre_commit/pep8.rb +19 -0
- data/lib/overcommit/hook/pre_commit/pyflakes.rb +28 -0
- data/lib/overcommit/hook/pre_commit/pylint.rb +28 -0
- data/lib/overcommit/hook/pre_commit/python_flake8.rb +18 -1
- data/lib/overcommit/hook/pre_commit/scalastyle.rb +26 -0
- data/lib/overcommit/hook/pre_commit/semi_standard.rb +17 -0
- data/lib/overcommit/hook/pre_commit/standard.rb +17 -0
- data/lib/overcommit/hook/pre_commit/w3c_css.rb +77 -0
- data/lib/overcommit/hook/pre_commit/w3c_html.rb +74 -0
- data/lib/overcommit/hook/pre_commit/xml_lint.rb +20 -0
- data/lib/overcommit/hook_context/post_commit.rb +31 -0
- data/lib/overcommit/hook_context/post_merge.rb +35 -0
- data/lib/overcommit/hook_context/post_rewrite.rb +18 -0
- data/lib/overcommit/hook_context/run_all.rb +12 -9
- data/lib/overcommit/utils.rb +25 -6
- data/lib/overcommit/version.rb +1 -1
- data/template-dir/hooks/post-commit +81 -0
- data/template-dir/hooks/post-merge +81 -0
- data/template-dir/hooks/post-rewrite +81 -0
- metadata +48 -10
- data/lib/overcommit/hook/pre_commit/jsx_hint.rb +0 -13
- data/lib/overcommit/hook/pre_commit/jsxcs.rb +0 -20
@@ -0,0 +1,81 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Entrypoint for Overcommit hook integration. Installing Overcommit will result
|
4
|
+
# in all of your git hooks being symlinked to this file, allowing the framework
|
5
|
+
# to manage your hooks for you.
|
6
|
+
|
7
|
+
# Prevent a Ruby stack trace from appearing when we interrupt the hook.
|
8
|
+
# Note that this will be overridden when Overcommit is loaded, since the
|
9
|
+
# InterruptHandler will redefine the trap at that time.
|
10
|
+
Signal.trap('INT') do
|
11
|
+
puts 'Hook run interrupted'
|
12
|
+
exit 130
|
13
|
+
end
|
14
|
+
|
15
|
+
# Allow hooks to be disabled via environment variable so git commands can be run
|
16
|
+
# in scripts without Overcommit running hooks
|
17
|
+
if ENV['OVERCOMMIT_DISABLE'].to_i != 0 || ENV['OVERCOMMIT_DISABLED'].to_i != 0
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
|
21
|
+
hook_type = File.basename($0)
|
22
|
+
if hook_type == 'overcommit-hook'
|
23
|
+
puts "Don't run `overcommit-hook` directly; it is intended to be symlinked " \
|
24
|
+
"by each hook in a repository's .git/hooks directory."
|
25
|
+
exit 64 # EX_USAGE
|
26
|
+
end
|
27
|
+
|
28
|
+
begin
|
29
|
+
require 'overcommit'
|
30
|
+
rescue LoadError
|
31
|
+
puts 'This repository contains hooks installed by Overcommit, but the ' \
|
32
|
+
"overcommit gem is not installed.\n" \
|
33
|
+
'Install it with `gem install overcommit`.'
|
34
|
+
exit
|
35
|
+
end
|
36
|
+
|
37
|
+
begin
|
38
|
+
logger = Overcommit::Logger.new(STDOUT)
|
39
|
+
|
40
|
+
# Ensure master hook is up-to-date
|
41
|
+
installer = Overcommit::Installer.new(logger)
|
42
|
+
if installer.run(Overcommit::Utils.repo_root, action: :update)
|
43
|
+
exec($0, *ARGV) # Execute the updated hook with all original arguments
|
44
|
+
end
|
45
|
+
|
46
|
+
config = Overcommit::ConfigurationLoader.load_repo_config
|
47
|
+
|
48
|
+
context = Overcommit::HookContext.create(hook_type, config, ARGV)
|
49
|
+
config.apply_environment!(context, ENV)
|
50
|
+
|
51
|
+
printer = Overcommit::Printer.new(logger, context)
|
52
|
+
runner = Overcommit::HookRunner.new(config, logger, context, printer)
|
53
|
+
|
54
|
+
status = runner.run
|
55
|
+
|
56
|
+
exit(status ? 0 : 65) # 65 = EX_DATAERR
|
57
|
+
rescue Overcommit::Exceptions::ConfigurationError => error
|
58
|
+
puts error
|
59
|
+
exit 78 # EX_CONFIG
|
60
|
+
rescue Overcommit::Exceptions::HookContextLoadError => error
|
61
|
+
puts error
|
62
|
+
puts 'Are you running an old version of Overcommit?'
|
63
|
+
exit 69 # EX_UNAVAILABLE
|
64
|
+
rescue Overcommit::Exceptions::HookSetupFailed,
|
65
|
+
Overcommit::Exceptions::HookCleanupFailed => error
|
66
|
+
puts error.message
|
67
|
+
exit 74 # EX_IOERR
|
68
|
+
rescue Overcommit::Exceptions::HookCancelled
|
69
|
+
puts 'You cancelled the hook run'
|
70
|
+
exit 130 # Ctrl-C cancel
|
71
|
+
rescue Overcommit::Exceptions::InvalidGitRepo => error
|
72
|
+
puts error
|
73
|
+
exit 64 # EX_USAGE
|
74
|
+
rescue Overcommit::Exceptions::InvalidHookSignature
|
75
|
+
exit 1
|
76
|
+
rescue => error
|
77
|
+
puts error.message
|
78
|
+
puts error.backtrace
|
79
|
+
puts "Report this bug at #{Overcommit::BUG_REPORT_URL}"
|
80
|
+
exit 70 # EX_SOFTWARE
|
81
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# Entrypoint for Overcommit hook integration. Installing Overcommit will result
|
4
|
+
# in all of your git hooks being symlinked to this file, allowing the framework
|
5
|
+
# to manage your hooks for you.
|
6
|
+
|
7
|
+
# Prevent a Ruby stack trace from appearing when we interrupt the hook.
|
8
|
+
# Note that this will be overridden when Overcommit is loaded, since the
|
9
|
+
# InterruptHandler will redefine the trap at that time.
|
10
|
+
Signal.trap('INT') do
|
11
|
+
puts 'Hook run interrupted'
|
12
|
+
exit 130
|
13
|
+
end
|
14
|
+
|
15
|
+
# Allow hooks to be disabled via environment variable so git commands can be run
|
16
|
+
# in scripts without Overcommit running hooks
|
17
|
+
if ENV['OVERCOMMIT_DISABLE'].to_i != 0 || ENV['OVERCOMMIT_DISABLED'].to_i != 0
|
18
|
+
exit
|
19
|
+
end
|
20
|
+
|
21
|
+
hook_type = File.basename($0)
|
22
|
+
if hook_type == 'overcommit-hook'
|
23
|
+
puts "Don't run `overcommit-hook` directly; it is intended to be symlinked " \
|
24
|
+
"by each hook in a repository's .git/hooks directory."
|
25
|
+
exit 64 # EX_USAGE
|
26
|
+
end
|
27
|
+
|
28
|
+
begin
|
29
|
+
require 'overcommit'
|
30
|
+
rescue LoadError
|
31
|
+
puts 'This repository contains hooks installed by Overcommit, but the ' \
|
32
|
+
"overcommit gem is not installed.\n" \
|
33
|
+
'Install it with `gem install overcommit`.'
|
34
|
+
exit
|
35
|
+
end
|
36
|
+
|
37
|
+
begin
|
38
|
+
logger = Overcommit::Logger.new(STDOUT)
|
39
|
+
|
40
|
+
# Ensure master hook is up-to-date
|
41
|
+
installer = Overcommit::Installer.new(logger)
|
42
|
+
if installer.run(Overcommit::Utils.repo_root, action: :update)
|
43
|
+
exec($0, *ARGV) # Execute the updated hook with all original arguments
|
44
|
+
end
|
45
|
+
|
46
|
+
config = Overcommit::ConfigurationLoader.load_repo_config
|
47
|
+
|
48
|
+
context = Overcommit::HookContext.create(hook_type, config, ARGV)
|
49
|
+
config.apply_environment!(context, ENV)
|
50
|
+
|
51
|
+
printer = Overcommit::Printer.new(logger, context)
|
52
|
+
runner = Overcommit::HookRunner.new(config, logger, context, printer)
|
53
|
+
|
54
|
+
status = runner.run
|
55
|
+
|
56
|
+
exit(status ? 0 : 65) # 65 = EX_DATAERR
|
57
|
+
rescue Overcommit::Exceptions::ConfigurationError => error
|
58
|
+
puts error
|
59
|
+
exit 78 # EX_CONFIG
|
60
|
+
rescue Overcommit::Exceptions::HookContextLoadError => error
|
61
|
+
puts error
|
62
|
+
puts 'Are you running an old version of Overcommit?'
|
63
|
+
exit 69 # EX_UNAVAILABLE
|
64
|
+
rescue Overcommit::Exceptions::HookSetupFailed,
|
65
|
+
Overcommit::Exceptions::HookCleanupFailed => error
|
66
|
+
puts error.message
|
67
|
+
exit 74 # EX_IOERR
|
68
|
+
rescue Overcommit::Exceptions::HookCancelled
|
69
|
+
puts 'You cancelled the hook run'
|
70
|
+
exit 130 # Ctrl-C cancel
|
71
|
+
rescue Overcommit::Exceptions::InvalidGitRepo => error
|
72
|
+
puts error
|
73
|
+
exit 64 # EX_USAGE
|
74
|
+
rescue Overcommit::Exceptions::InvalidHookSignature
|
75
|
+
exit 1
|
76
|
+
rescue => error
|
77
|
+
puts error.message
|
78
|
+
puts error.backtrace
|
79
|
+
puts "Report this bug at #{Overcommit::BUG_REPORT_URL}"
|
80
|
+
exit 70 # EX_SOFTWARE
|
81
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: overcommit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.23.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Causes Engineering
|
@@ -9,36 +9,36 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-02-
|
12
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: childprocess
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.5.
|
20
|
+
version: 0.5.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.5.
|
27
|
+
version: 0.5.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: image_optim
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 0.
|
34
|
+
version: 0.20.0
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 0.
|
41
|
+
version: 0.20.0
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: rspec
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,6 +67,20 @@ dependencies:
|
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '1.7'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: w3c_validators
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - "~>"
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '1.2'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '1.2'
|
70
84
|
description: Utility to install, configure, and extend Git hooks
|
71
85
|
email:
|
72
86
|
- eng@causes.com
|
@@ -97,6 +111,13 @@ files:
|
|
97
111
|
- lib/overcommit/hook/commit_msg/trailing_period.rb
|
98
112
|
- lib/overcommit/hook/post_checkout/base.rb
|
99
113
|
- lib/overcommit/hook/post_checkout/index_tags.rb
|
114
|
+
- lib/overcommit/hook/post_commit/base.rb
|
115
|
+
- lib/overcommit/hook/post_commit/git_guilt.rb
|
116
|
+
- lib/overcommit/hook/post_commit/index_tags.rb
|
117
|
+
- lib/overcommit/hook/post_merge/base.rb
|
118
|
+
- lib/overcommit/hook/post_merge/index_tags.rb
|
119
|
+
- lib/overcommit/hook/post_rewrite/base.rb
|
120
|
+
- lib/overcommit/hook/post_rewrite/index_tags.rb
|
100
121
|
- lib/overcommit/hook/pre_commit/author_email.rb
|
101
122
|
- lib/overcommit/hook/pre_commit/author_name.rb
|
102
123
|
- lib/overcommit/hook/pre_commit/base.rb
|
@@ -107,31 +128,45 @@ files:
|
|
107
128
|
- lib/overcommit/hook/pre_commit/chamber_security.rb
|
108
129
|
- lib/overcommit/hook/pre_commit/coffee_lint.rb
|
109
130
|
- lib/overcommit/hook/pre_commit/css_lint.rb
|
131
|
+
- lib/overcommit/hook/pre_commit/es_lint.rb
|
110
132
|
- lib/overcommit/hook/pre_commit/go_lint.rb
|
111
133
|
- lib/overcommit/hook/pre_commit/haml_lint.rb
|
112
134
|
- lib/overcommit/hook/pre_commit/hard_tabs.rb
|
135
|
+
- lib/overcommit/hook/pre_commit/html_tidy.rb
|
113
136
|
- lib/overcommit/hook/pre_commit/image_optim.rb
|
137
|
+
- lib/overcommit/hook/pre_commit/java_checkstyle.rb
|
114
138
|
- lib/overcommit/hook/pre_commit/js_hint.rb
|
115
139
|
- lib/overcommit/hook/pre_commit/jscs.rb
|
116
140
|
- lib/overcommit/hook/pre_commit/json_syntax.rb
|
117
|
-
- lib/overcommit/hook/pre_commit/jsx_hint.rb
|
118
|
-
- lib/overcommit/hook/pre_commit/jsxcs.rb
|
119
141
|
- lib/overcommit/hook/pre_commit/local_paths_in_gemfile.rb
|
120
142
|
- lib/overcommit/hook/pre_commit/merge_conflicts.rb
|
143
|
+
- lib/overcommit/hook/pre_commit/pep257.rb
|
144
|
+
- lib/overcommit/hook/pre_commit/pep8.rb
|
121
145
|
- lib/overcommit/hook/pre_commit/pry_binding.rb
|
146
|
+
- lib/overcommit/hook/pre_commit/pyflakes.rb
|
147
|
+
- lib/overcommit/hook/pre_commit/pylint.rb
|
122
148
|
- lib/overcommit/hook/pre_commit/python_flake8.rb
|
123
149
|
- lib/overcommit/hook/pre_commit/rails_schema_up_to_date.rb
|
124
150
|
- lib/overcommit/hook/pre_commit/reek.rb
|
125
151
|
- lib/overcommit/hook/pre_commit/rubocop.rb
|
152
|
+
- lib/overcommit/hook/pre_commit/scalastyle.rb
|
126
153
|
- lib/overcommit/hook/pre_commit/scss_lint.rb
|
154
|
+
- lib/overcommit/hook/pre_commit/semi_standard.rb
|
127
155
|
- lib/overcommit/hook/pre_commit/shell_check.rb
|
156
|
+
- lib/overcommit/hook/pre_commit/standard.rb
|
128
157
|
- lib/overcommit/hook/pre_commit/trailing_whitespace.rb
|
129
158
|
- lib/overcommit/hook/pre_commit/travis_lint.rb
|
159
|
+
- lib/overcommit/hook/pre_commit/w3c_css.rb
|
160
|
+
- lib/overcommit/hook/pre_commit/w3c_html.rb
|
161
|
+
- lib/overcommit/hook/pre_commit/xml_lint.rb
|
130
162
|
- lib/overcommit/hook/pre_commit/yaml_syntax.rb
|
131
163
|
- lib/overcommit/hook_context.rb
|
132
164
|
- lib/overcommit/hook_context/base.rb
|
133
165
|
- lib/overcommit/hook_context/commit_msg.rb
|
134
166
|
- lib/overcommit/hook_context/post_checkout.rb
|
167
|
+
- lib/overcommit/hook_context/post_commit.rb
|
168
|
+
- lib/overcommit/hook_context/post_merge.rb
|
169
|
+
- lib/overcommit/hook_context/post_rewrite.rb
|
135
170
|
- lib/overcommit/hook_context/pre_commit.rb
|
136
171
|
- lib/overcommit/hook_context/run_all.rb
|
137
172
|
- lib/overcommit/hook_loader/base.rb
|
@@ -152,6 +187,9 @@ files:
|
|
152
187
|
- template-dir/hooks/commit-msg
|
153
188
|
- template-dir/hooks/overcommit-hook
|
154
189
|
- template-dir/hooks/post-checkout
|
190
|
+
- template-dir/hooks/post-commit
|
191
|
+
- template-dir/hooks/post-merge
|
192
|
+
- template-dir/hooks/post-rewrite
|
155
193
|
- template-dir/hooks/pre-commit
|
156
194
|
homepage: https://github.com/causes/overcommit
|
157
195
|
licenses:
|
@@ -1,13 +0,0 @@
|
|
1
|
-
module Overcommit::Hook::PreCommit
|
2
|
-
# Runs `jsxhint` against any modified JSX files.
|
3
|
-
class JsxHint < Base
|
4
|
-
def run
|
5
|
-
result = execute(command + applicable_files)
|
6
|
-
output = result.stdout
|
7
|
-
|
8
|
-
return :pass if output.empty?
|
9
|
-
|
10
|
-
[:fail, output]
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Overcommit::Hook::PreCommit
|
2
|
-
# Runs `jsxcs` (JSCS (JavaScript Code Style Checker) wrapper for JSX files)
|
3
|
-
# against any modified JavaScript files.
|
4
|
-
class Jsxcs < Base
|
5
|
-
def run
|
6
|
-
result = execute(command + applicable_files)
|
7
|
-
return :pass if result.success?
|
8
|
-
|
9
|
-
if result.status == 1
|
10
|
-
# No configuration found
|
11
|
-
return :warn, result.stderr.chomp
|
12
|
-
end
|
13
|
-
|
14
|
-
extract_messages(
|
15
|
-
result.stdout.split("\n"),
|
16
|
-
/^(?<file>[^:]+):[^\d]+(?<line>\d+)/,
|
17
|
-
)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|