-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathRakefile
More file actions
44 lines (36 loc) · 1.2 KB
/
Copy pathRakefile
File metadata and controls
44 lines (36 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
require 'rubocop'
require 'rubocop/rake_task'
require 'rubocop-performance'
require 'rubocop-rspec'
require 'rubocop-rake'
require 'yard'
RuboCop::RakeTask.new(:rubocop) do |t|
config_path = File.expand_path(File.join('.rubocop.yml'), __dir__)
t.options = ['--config', config_path]
t.requires << 'rubocop-rspec'
t.requires << 'rubocop-performance'
t.requires << 'rubocop-rake'
end
RSpec::Core::RakeTask.new(:rspec)
YARD::Rake::YardocTask.new(:doc) do |t|
t.files = Dir[Pathname.new(__FILE__).join('../lib/**/*.rb')]
t.options = %w[--protected --private]
end
task default: :rspec
desc 'Code documentation coverage check'
task yardoc: :doc do
undocumented_code_objects = YARD::Registry.tap(&:load).select do |code_object|
code_object.docstring.empty?
end
if undocumented_code_objects.empty?
puts 'YARD COVERAGE [SUCCESS] => 100% documentation coverage!'
else
failing_code_objects = undocumented_code_objects.map do |code_object|
"- #{code_object.class} => #{code_object}"
end.join("\n")
abort("YARD COVERAGE [FAILURE] => No documentation found for: \n #{failing_code_objects}")
end
end