Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
340c6743
Commit
340c6743
authored
Nov 30, 2012
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 784072: Use Pod::Coverage to make sure that all subroutines are documented
r=wurblzap a=LpSolit
parent
5321b1f3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
1 deletion
+71
-1
011pod.t
t/011pod.t
+70
-1
Files.pm
t/Support/Files.pm
+1
-0
No files found.
t/011pod.t
View file @
340c6743
...
@@ -16,8 +16,32 @@ use lib 't';
...
@@ -16,8 +16,32 @@ use lib 't';
use Support::Files;
use Support::Files;
use Pod::Checker;
use Pod::Checker;
use Pod::Coverage;
use Test::More tests => scalar(@Support::Files::testitems);
use Test::More tests => scalar(@Support::Files::testitems)
+ scalar(@Support::Files::module_files);
# These methods do not need to be documented by default.
use constant DEFAULT_WHITELIST => qr/^(?:new|new_from_list|check|run_create_validators)$/;
# These subroutines do not need to be documented, generally because
# you shouldn't call them yourself. No need to include subroutines
# of the form _foo(); they are already treated as private.
use constant SUB_WHITELIST => (
'Bugzilla::Flag' => qr/^(?:(force_)?retarget|force_cleanup)$/,
'Bugzilla::FlagType' => qr/^sqlify_criteria$/,
);
# These modules do not need to be documented, generally because they
# are subclasses of another module which already has all the relevant
# documentation. Partial names are allowed.
use constant MODULE_WHITELIST => qw(
Bugzilla::Auth::Login::
Bugzilla::Auth::Persist::
Bugzilla::Auth::Verify::
Bugzilla::BugUrl::
Bugzilla::Config::
);
# Capture the TESTOUT from Test::More or Test::Builder for printing errors.
# Capture the TESTOUT from Test::More or Test::Builder for printing errors.
# This will handle verbosity for us automatically.
# This will handle verbosity for us automatically.
...
@@ -48,4 +72,49 @@ foreach my $file (@testitems) {
...
@@ -48,4 +72,49 @@ foreach my $file (@testitems) {
}
}
}
}
my %sub_whitelist = SUB_WHITELIST;
my @module_files = sort @Support::Files::module_files;
foreach my $file (@module_files) {
my $module = $file;
$module =~ s/\.pm$//;
$module =~ s#/#::#g;
my @whitelist = (DEFAULT_WHITELIST);
push(@whitelist, $sub_whitelist{$module}) if $sub_whitelist{$module};
# XXX Once all methods are correctly documented, nonwhitespace should
# be set to 1.
my $cover = Pod::Coverage->new(package => $module, nonwhitespace => 0,
trustme => \@whitelist);
my $coverage = $cover->coverage;
my $reason = $cover->why_unrated;
if (defined $coverage) {
if ($coverage == 1) {
ok(1, "$file has POD for all methods");
}
else {
ok(0, "$file POD coverage is " . sprintf("%u%%", 100 * $coverage) .
". Undocumented methods: " . join(', ', $cover->uncovered));
}
}
# This error is thrown when the module couldn't be loaded due to
# a missing dependency.
elsif ($reason eq "no public symbols defined") {
ok(1, "$file cannot be loaded");
}
elsif ($reason eq "couldn't find pod") {
if (grep { $module =~ /^\Q$_\E/ } MODULE_WHITELIST) {
ok(1, "$file does not contain any POD (whitelisted)");
}
else {
ok(0, "$file POD coverage is 0%");
}
}
else {
ok(0, "$file: $reason");
}
}
exit 0;
exit 0;
t/Support/Files.pm
View file @
340c6743
...
@@ -42,6 +42,7 @@ foreach $currentfile (@files) {
...
@@ -42,6 +42,7 @@ foreach $currentfile (@files) {
if
(
isTestingFile
(
$currentfile
))
{
if
(
isTestingFile
(
$currentfile
))
{
push
(
@testitems
,
$currentfile
);
push
(
@testitems
,
$currentfile
);
}
}
push
(
@module_files
,
$currentfile
)
if
$currentfile
=~
/\.pm$/
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment