Class: YardJunk::Janitor
- Inherits:
-
Object
show all
- Defined in:
- lib/yard-junk/janitor.rb,
lib/yard-junk/janitor/resolver.rb,
lib/yard-junk/janitor/base_reporter.rb,
lib/yard-junk/janitor/html_reporter.rb,
lib/yard-junk/janitor/text_reporter.rb
Defined Under Namespace
Classes: BaseReporter, HtmlReporter, Resolver, TextReporter
Instance Method Summary
collapse
Instance Method Details
#exit_code ⇒ Object
43
44
45
46
47
|
# File 'lib/yard-junk/janitor.rb', line 43
def exit_code
return 2 unless errors.empty?
return 1 unless problems.empty?
0
end
|
#report(*args, path: nil, **opts) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/yard-junk/janitor.rb', line 31
def report(*args, path: nil, **opts)
guess_reporters(*args, **opts).each do |reporter|
reporter.section('Errors', 'severe code or formatting problems', filter(errors, path))
reporter.section('Problems', 'mistyped tags or other typos in documentation', filter(problems, path))
reporter.stats(stats(path))
reporter.finalize
end
exit_code
end
|
#run(*opts) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/yard-junk/janitor.rb', line 8
def run(*opts)
YARD::Registry.clear Logger.instance.format = nil
puts "Running YardJunk janitor (version #{YardJunk::VERSION})...\n\n"
@duration = Benchmark.realtime do
command = YARD::CLI::Yardoc.new
command.run('--no-save', '--no-progress', '--no-stats', '--no-output', *opts)
Resolver.resolve_all(command.options)
end
self
end
|
#stats(path = nil) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/yard-junk/janitor.rb', line 23
def stats(path = nil)
{
errors: filter(errors, path).count,
problems: filter(problems, path).count,
duration: @duration || 0
}
end
|