-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
53 lines (41 loc) · 1.34 KB
/
Copy pathRakefile
File metadata and controls
53 lines (41 loc) · 1.34 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
45
46
47
48
49
50
51
52
53
# frozen_string_literal: true
require "bundler/gem_tasks"
require "minitest/test_task"
require "rubocop/rake_task"
require "rake/testtask"
require "yard"
Rake::TestTask.new(:test) do |t|
t.libs << "test"
t.libs << "lib"
t.warning = false
t.test_files = FileList["test/**/*_test.rb"]
end
RuboCop::RakeTask.new(:rubocop) do |task|
task.options = ["--parallel"]
end
YARD::Rake::YardocTask.new(:yard) do |task|
task.files = ["lib/**/*.rb"]
task.options = ["--protected", "--markup", "markdown", "--readme", "docs/index.md"]
end
YARD::Rake::YardocTask.new(:yard)
namespace :yard do
desc "Validate YARD documentation coverage"
task :validate do
require "open3"
stdout, stderr, status = Open3.capture3("bundle", "exec", "yard", "stats")
text = "#{stdout}\n#{stderr}"
puts text
abort("yard stats failed") unless status.success?
match = text.match(/([0-9]+(?:\.[0-9]+)?)%\s+documented/)
abort("Unable to determine YARD coverage") unless match
coverage = match[1].to_f
minimum = 95.0
abort(format("YARD coverage %<coverage> is below %<minimum>", { coverage:, minimum: })) if coverage < minimum
puts format("YARD coverage %.2f%%", coverage)
end
end
desc "Validate curated RBS signatures"
task :steep_check do
sh "bundle exec steep check"
end
task default: %i[test rubocop steep_check yard yard:validate]