Class: Quality::Tools::Jscs
- Inherits:
-
Tool
- Object
- Tool
- Quality::Tools::Jscs
show all
- Defined in:
- lib/quality/tools/jscs.rb
Overview
Adds ‘bigfiles’ tool support to quality gem
Instance Method Summary
collapse
Methods inherited from Tool
#initialize
Instance Method Details
#jscs_args ⇒ Object
7
8
9
|
# File 'lib/quality/tools/jscs.rb', line 7
def jscs_args
'-r unix ' + js_files.join(' ')
end
|
11
12
13
14
15
16
17
|
# File 'lib/quality/tools/jscs.rb', line 11
def jscs_check_configured
return 0 if js_files.empty?
puts 'No JSCS config found! To generate one, run ' \
'jscs --auto-configure representative_file.js'
0
end
|
#jscs_count_violations_on_line(line) ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'lib/quality/tools/jscs.rb', line 19
def jscs_count_violations_on_line(line)
if line =~ /^.*:\d+:\d+: /
1
elsif line =~ /^No configuration found/
jscs_check_configured
else
0
end
end
|
#quality_jscs ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/quality/tools/jscs.rb', line 29
def quality_jscs
ratchet_quality_cmd('jscs',
args: jscs_args,
gives_error_code_on_violations: true) do |line|
jscs_count_violations_on_line(line)
end
end
|