Class: Codeqa::Checkers::CheckYard
Instance Attribute Summary
#errors, #sourcefile
Class Method Summary
collapse
Instance Method Summary
collapse
#initialize
Class Method Details
.available? ⇒ Boolean
9
10
11
|
# File 'lib/codeqa/checkers/check_yard.rb', line 9
def self.available?
yard?
end
|
.check?(sourcefile) ⇒ Boolean
6
7
8
|
# File 'lib/codeqa/checkers/check_yard.rb', line 6
def self.check?(sourcefile)
sourcefile.ruby? && !(sourcefile.filename =~ /^(test|spec)/)
end
|
.io ⇒ Object
13
14
15
|
# File 'lib/codeqa/checkers/check_yard.rb', line 13
def self.io
@@io ||= StringIO.new
end
|
Instance Method Details
#check ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/codeqa/checkers/check_yard.rb', line 25
def check
if self.class.yard?
::YARD.parse_string(sourcefile.content) io.rewind message = io.read
warnings = message.match(/\A\[warn\]: /)
errors.add(nil, message.gsub(/\(stdin\)/, sourcefile.filename)) if warnings
end
ensure
io.reopen end
|
#hint ⇒ Object
21
22
23
|
# File 'lib/codeqa/checkers/check_yard.rb', line 21
def hint
'Yard gives us some warnings on the file you can run <yardoc filename> to check yourself.'
end
|
#name ⇒ Object
17
18
19
|
# File 'lib/codeqa/checkers/check_yard.rb', line 17
def name
'yard'
end
|