Class: PreCommit::Checks::Coffeelint
- Inherits:
-
Shell
show all
- Defined in:
- lib/plugins/pre_commit/checks/coffeelint.rb
Instance Attribute Summary
Attributes inherited from Plugin
#config, #pluginator
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Plugin
#initialize, #name
Class Method Details
.description ⇒ Object
28
29
30
|
# File 'lib/plugins/pre_commit/checks/coffeelint.rb', line 28
def self.description
"Runs coffeelint to detect errors"
end
|
Instance Method Details
#alternate_config_file ⇒ Object
24
25
26
|
# File 'lib/plugins/pre_commit/checks/coffeelint.rb', line 24
def alternate_config_file
'coffeelint.json'
end
|
#call(staged_files) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/plugins/pre_commit/checks/coffeelint.rb', line 7
def call(staged_files)
staged_files = staged_files.grep(/\.coffee$/)
return if staged_files.empty?
result =
in_groups(staged_files).map do |files|
args = %w{coffeelint} + config_file_flag + files
execute(args)
end.compact
result.empty? ? nil : result.join("\n")
end
|
#config_file_flag ⇒ Object
20
21
22
|
# File 'lib/plugins/pre_commit/checks/coffeelint.rb', line 20
def config_file_flag
config_file ? ['-f', config_file] : []
end
|