Class: Codeqa::Checkers::Rubocop
Instance Attribute Summary
#errors, #sourcefile
Class Method Summary
collapse
Instance Method Summary
collapse
#initialize
Class Method Details
.available? ⇒ Boolean
8
9
10
|
# File 'lib/codeqa/checkers/rubocop_full.rb', line 8
def self.available?
rubocop?
end
|
.check?(sourcefile) ⇒ Boolean
4
5
6
|
# File 'lib/codeqa/checkers/rubocop_full.rb', line 4
def self.check?(sourcefile)
sourcefile.ruby?
end
|
Instance Method Details
#check ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/codeqa/checkers/rubocop_full.rb', line 20
def check
return unless self.class.rubocop?
with_existing_file do |filename|
args = config_args << filename
success, captured = capture do
if defined?(RuboCop) ::RuboCop::CLI.new.run(default_args + args) == 0
else
::Rubocop::CLI.new.run(default_args + args) == 0
end
end
errors.add(nil, captured) unless success
end
end
|
#hint ⇒ Object
16
17
18
|
# File 'lib/codeqa/checkers/rubocop_full.rb', line 16
def hint
'Rubocop does not like your syntax, please fix your code.'
end
|
#name ⇒ Object
12
13
14
|
# File 'lib/codeqa/checkers/rubocop_full.rb', line 12
def name
'rubocop'
end
|