Class: YardJunk::Janitor
- Inherits:
-
Object
show all
- Defined in:
- lib/yard-junk/janitor.rb,
lib/yard-junk/janitor/resolver.rb,
lib/yard-junk/janitor/yard_options.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, YardOptions
Instance Method Summary
collapse
Constructor Details
#initialize(mode: :full, pathes: nil) ⇒ Janitor
Returns a new instance of Janitor.
8
9
10
11
|
# File 'lib/yard-junk/janitor.rb', line 8
def initialize(mode: :full, pathes: nil)
@mode = mode
@files = expand_pathes(pathes)
end
|
Instance Method Details
#exit_code ⇒ Object
48
49
50
51
52
|
# File 'lib/yard-junk/janitor.rb', line 48
def exit_code
return 2 unless errors.empty?
return 1 unless problems.empty?
0
end
|
#report(*args, **opts) ⇒ Object
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/yard-junk/janitor.rb', line 36
def report(*args, **opts)
guess_reporters(*args, **opts).each do |reporter|
reporter.section('Errors', 'severe code or formatting problems', errors)
reporter.section('Problems', 'mistyped tags or other typos in documentation', problems)
reporter.stats(stats)
reporter.finalize
end
exit_code
end
|
#run(*opts) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/yard-junk/janitor.rb', line 13
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(*prepare_options(opts))
Resolver.resolve_all(command.options) unless mode == :sanity
end
self
end
|
#stats ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/yard-junk/janitor.rb', line 28
def stats
{
errors: errors.count,
problems: problems.count,
duration: @duration || 0
}
end
|