Class: PreCommit::Checks::Csslint
- Inherits:
-
Js
- Object
- Plugin
- Js
- PreCommit::Checks::Csslint
show all
- Defined in:
- lib/plugins/pre_commit/checks/csslint.rb
Constant Summary
collapse
- SOURCE =
"https://github.com/stubbornella/csslint/blob/v0.10.0/release/csslint.js"
Instance Attribute Summary
Attributes inherited from Plugin
#config, #pluginator
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Js
#call, #display_error
Methods inherited from Plugin
#initialize, #name
Class Method Details
.description ⇒ Object
26
27
28
|
# File 'lib/plugins/pre_commit/checks/csslint.rb', line 26
def self.description
"Checks CSS files with CSSLint."
end
|
Instance Method Details
#error_selector ⇒ Object
18
19
20
|
# File 'lib/plugins/pre_commit/checks/csslint.rb', line 18
def error_selector
'message'
end
|
#files_filter(staged_files) ⇒ Object
22
23
24
|
# File 'lib/plugins/pre_commit/checks/csslint.rb', line 22
def files_filter(staged_files)
staged_files.grep(/\.css$/)
end
|
#linter_src ⇒ Object
14
15
16
|
# File 'lib/plugins/pre_commit/checks/csslint.rb', line 14
def linter_src
File.expand_path("../../../../pre-commit/support/csslint/csslint.js", __FILE__)
end
|
#run_check(file) ⇒ Object
9
10
11
12
|
# File 'lib/plugins/pre_commit/checks/csslint.rb', line 9
def run_check(file)
context = ExecJS.compile(File.read(linter_src))
context.call("CSSLint.verify", File.read(file))["messages"]
end
|