Class: Overcommit::GitHook::HookSpecificCheck
- Inherits:
-
Object
- Object
- Overcommit::GitHook::HookSpecificCheck
show all
- Defined in:
- lib/overcommit/hook_specific_check.rb
Direct Known Subclasses
AuthorName, CausesEmail, ChangeID, CssLinter, ErbSyntax, HamlSyntax, JSConsoleLog, JSSyntax, ReleaseNote, RestrictedPaths, RubySyntax, RussianNovel, ScssLint, TestHistory, TextWidth, TrailingPeriod, Whitespace, YamlSyntax
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of HookSpecificCheck.
33
34
35
|
# File 'lib/overcommit/hook_specific_check.rb', line 33
def initialize(*args)
@arguments = args
end
|
Class Attribute Details
.filetype ⇒ Object
Returns the value of attribute filetype.
16
17
18
|
# File 'lib/overcommit/hook_specific_check.rb', line 16
def filetype
@filetype
end
|
.required ⇒ Object
Returns the value of attribute required.
16
17
18
|
# File 'lib/overcommit/hook_specific_check.rb', line 16
def required
@required
end
|
.stealth ⇒ Object
Returns the value of attribute stealth.
16
17
18
|
# File 'lib/overcommit/hook_specific_check.rb', line 16
def stealth
@stealth
end
|
Class Method Details
.file_type(type) ⇒ Object
86
87
88
|
# File 'lib/overcommit/hook_specific_check.rb', line 86
def self.file_type(type)
self.filetype = type
end
|
.required! ⇒ Object
22
23
24
|
# File 'lib/overcommit/hook_specific_check.rb', line 22
def required!
self.required = true
end
|
.skippable? ⇒ Boolean
Can the check be skipped by environment variables? This can always be overriden with --no-verify.
28
29
30
|
# File 'lib/overcommit/hook_specific_check.rb', line 28
def skippable?
!required
end
|
.stealth! ⇒ Object
18
19
20
|
# File 'lib/overcommit/hook_specific_check.rb', line 18
def stealth!
self.stealth = true
end
|
Instance Method Details
#name ⇒ Object
37
38
39
|
# File 'lib/overcommit/hook_specific_check.rb', line 37
def name
Overcommit::Utils.underscorize self.class.name.to_s.split('::').last
end
|
#run_check ⇒ Object
55
56
57
|
# File 'lib/overcommit/hook_specific_check.rb', line 55
def run_check
[:bad, 'No checks defined!']
end
|
#skip? ⇒ Boolean
41
42
43
|
# File 'lib/overcommit/hook_specific_check.rb', line 41
def skip?
false
end
|
#staged ⇒ Object
49
50
51
52
53
|
# File 'lib/overcommit/hook_specific_check.rb', line 49
def staged
@staged ||= Utils.modified_files.select do |filename|
filename.end_with?(".#{self.class.filetype}")
end
end
|
#stealth? ⇒ Boolean
45
46
47
|
# File 'lib/overcommit/hook_specific_check.rb', line 45
def stealth?
self.class.stealth
end
|