1b8851fccSafresh1#!/usr/bin/perl 2b8851fccSafresh1# 3b8851fccSafresh1# Check for spelling errors in POD documentation. 4b8851fccSafresh1# 5b8851fccSafresh1# The canonical version of this file is maintained in the rra-c-util package, 65759b3d2Safresh1# which can be found at <https://www.eyrie.org/~eagle/software/rra-c-util/>. 7b8851fccSafresh1# 8b8851fccSafresh1# Written by Russ Allbery <eagle@eyrie.org> 9*e0680481Safresh1# Copyright 2019, 2021 Russ Allbery <eagle@eyrie.org> 10b46d8ef2Safresh1# Copyright 2013-2014 11b8851fccSafresh1# The Board of Trustees of the Leland Stanford Junior University 12b8851fccSafresh1# 13b8851fccSafresh1# Permission is hereby granted, free of charge, to any person obtaining a 14b8851fccSafresh1# copy of this software and associated documentation files (the "Software"), 15b8851fccSafresh1# to deal in the Software without restriction, including without limitation 16b8851fccSafresh1# the rights to use, copy, modify, merge, publish, distribute, sublicense, 17b8851fccSafresh1# and/or sell copies of the Software, and to permit persons to whom the 18b8851fccSafresh1# Software is furnished to do so, subject to the following conditions: 19b8851fccSafresh1# 20b8851fccSafresh1# The above copyright notice and this permission notice shall be included in 21b8851fccSafresh1# all copies or substantial portions of the Software. 22b8851fccSafresh1# 23b8851fccSafresh1# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24b8851fccSafresh1# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 25b8851fccSafresh1# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 26b8851fccSafresh1# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27b8851fccSafresh1# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 28b8851fccSafresh1# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 29b8851fccSafresh1# DEALINGS IN THE SOFTWARE. 30b46d8ef2Safresh1# 31b46d8ef2Safresh1# SPDX-License-Identifier: MIT 32b8851fccSafresh1 33*e0680481Safresh1use 5.010; 34b8851fccSafresh1use strict; 35b8851fccSafresh1use warnings; 36b8851fccSafresh1 37b8851fccSafresh1use lib 't/lib'; 38b8851fccSafresh1 39b8851fccSafresh1use Test::RRA qw(skip_unless_author use_prereq); 40b8851fccSafresh1 4156d68f1eSafresh1use Test::More; 4256d68f1eSafresh1 43b8851fccSafresh1# Only run this test for the module author since the required stopwords are 44b8851fccSafresh1# too sensitive to the exact spell-checking program and dictionary. 45b8851fccSafresh1skip_unless_author('Spelling tests'); 46b8851fccSafresh1 47b8851fccSafresh1# Load prerequisite modules. 48b8851fccSafresh1use_prereq('Test::Spelling'); 49b8851fccSafresh1 50*e0680481Safresh1# Check all POD in the Perl distribution. Add the examples and t/lib 51*e0680481Safresh1# directories if they exist. Also add any files in usr/bin or usr/sbin, which 52*e0680481Safresh1# are widely used in Stanford-internal packages. 53b8851fccSafresh1my @files = all_pod_files(); 54b8851fccSafresh1if (-d 'examples') { 55b8851fccSafresh1 push(@files, all_pod_files('examples')); 56b8851fccSafresh1} 57*e0680481Safresh1if (-d File::Spec->catfile('t', 'lib')) { 58*e0680481Safresh1 push(@files, all_pod_files(File::Spec->catfile('t', 'lib'))); 59*e0680481Safresh1} 60b8851fccSafresh1for my $dir (qw(usr/bin usr/sbin)) { 61b8851fccSafresh1 if (-d $dir) { 62b8851fccSafresh1 push(@files, glob("$dir/*")); 63b8851fccSafresh1 } 64b8851fccSafresh1} 65b8851fccSafresh1 66b8851fccSafresh1# We now have a list of all files to check, so output a plan and run the 67b8851fccSafresh1# tests. We can't use all_pod_files_spelling_ok because it refuses to check 68b8851fccSafresh1# non-Perl files and Stanford-internal packages have a lot of shell scripts 69b8851fccSafresh1# with POD documentation. 70b8851fccSafresh1plan tests => scalar(@files); 71b8851fccSafresh1for my $file (@files) { 72b8851fccSafresh1 pod_file_spelling_ok($file); 73b8851fccSafresh1} 74