Class: Overcommit::GitHook::BaseHook
- Inherits:
-
Object
- Object
- Overcommit::GitHook::BaseHook
show all
- Defined in:
- lib/overcommit/git_hook.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of BaseHook.
4
5
6
7
8
9
10
11
|
# File 'lib/overcommit/git_hook.rb', line 4
def initialize
Overcommit.config.desired_plugins.each do |plugin|
require plugin
end
rescue LoadError, NameError => ex
log.error "Couldn't load plugin: #{ex}"
exit 0
end
|
Instance Method Details
#run(*args) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/overcommit/git_hook.rb', line 13
def run(*args)
exit unless (checks = registered_checks) && checks.any?
exit if requires_modified_files? && Utils.modified_files.empty?
reporter = Reporter.new(Overcommit::Utils.hook_name, checks)
reporter.
checks.each do |check_class|
check = check_class.new(*args)
next if check.skip?
next if check_class.filetype && check.staged.empty?
reporter.with_status(check) do
run_and_filter_check(check)
end
end
reporter.print_result
end
|
#skip_checks ⇒ Object
40
41
42
|
# File 'lib/overcommit/git_hook.rb', line 40
def skip_checks
@skip_checks ||= ENV.fetch('SKIP_CHECKS', '').split(/[:, ]/)
end
|