Skip to content

Commit 0082eb3

Browse files
committed
Merge pull request #61 from rspec/enforce_doc_coverage_rules
Enforce doc coverage rules
2 parents 5858611 + d65a1d6 commit 0082eb3

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

travis/script/functions.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ function rspec_support_compatible {
5757
fi
5858
}
5959

60+
function documentation_enforced {
61+
if [ -x ./bin/yard ]; then
62+
return 0
63+
else
64+
return 1
65+
fi
66+
}
6067

6168
function clone_repo {
6269
if [ ! -d $1 ]; then # don't clone if the dir is already there
@@ -118,3 +125,17 @@ function run_spec_suite_for {
118125
popd
119126
fi;
120127
}
128+
129+
function check_documentation_coverage {
130+
bin/yard stats --list-undoc | ruby -e "
131+
while line = gets
132+
coverage ||= line[/([\d\.]+)% documented/, 1]
133+
puts line
134+
end
135+
136+
unless Float(coverage) == 100
137+
puts \"\n\nMissing documentation coverage (currently at #{coverage}%)\"
138+
exit(1)
139+
end
140+
"
141+
}

travis/script/run_build

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ source script/functions.sh
55
run_specs_and_record_done
66
run_cukes
77

8+
if documentation_enforced; then
9+
check_documentation_coverage
10+
fi
11+
812
if is_mri; then
913
run_specs_one_by_one
1014
run_spec_suite_for "rspec-core"

0 commit comments

Comments
 (0)