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, CoffeeLint, CssLinter, ErbSyntax, HamlSyntax, HardTabs, JSConsoleLog, JSSyntax, PythonFlake8, ReleaseNote, RestrictedPaths, RubyStyle, RubySyntax, RussianNovel, ScssLint, SingleLineSubject, 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.
37
38
39
|
# File 'lib/overcommit/hook_specific_check.rb', line 37
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
.friendly_name ⇒ Object
32
33
34
|
# File 'lib/overcommit/hook_specific_check.rb', line 32
def friendly_name
Overcommit::Utils.underscorize name.to_s.split('::').last
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
41
42
43
|
# File 'lib/overcommit/hook_specific_check.rb', line 41
def name
self.class.friendly_name
end
|
#run_check ⇒ Object
61
62
63
|
# File 'lib/overcommit/hook_specific_check.rb', line 61
def run_check
[:bad, 'No checks defined!']
end
|
#skip? ⇒ Boolean
45
46
47
|
# File 'lib/overcommit/hook_specific_check.rb', line 45
def skip?
false
end
|
#staged ⇒ Object
53
54
55
56
57
58
59
|
# File 'lib/overcommit/hook_specific_check.rb', line 53
def staged
@staged ||= modified_files.map do |filename|
if self.class.filetype.nil? || filename.end_with?(".#{self.class.filetype}")
StagedFile.new(filename)
end
end.compact
end
|
#stealth? ⇒ Boolean
49
50
51
|
# File 'lib/overcommit/hook_specific_check.rb', line 49
def stealth?
self.class.stealth
end
|