Test-Spelling-0.25/0000755000175000017500000000000013473356055014707 5ustar cwhitenercwhitenerTest-Spelling-0.25/t/0000755000175000017500000000000013473356055015152 5ustar cwhitenercwhitenerTest-Spelling-0.25/t/00-report-prereqs.dd0000644000175000017500000000557313473356055020704 0ustar cwhitenercwhitenerdo { my $x = { 'build' => { 'requires' => { 'ExtUtils::MakeMaker' => '0' } }, 'configure' => { 'requires' => { 'ExtUtils::MakeMaker' => '0' }, 'suggests' => { 'JSON::PP' => '2.27300' } }, 'develop' => { 'requires' => { 'Dist::Zilla' => '0', 'File::Spec' => '0', 'IO::Handle' => '0', 'IPC::Open3' => '0', 'Pod::Coverage::TrustPod' => '0', 'Test::CPAN::Changes' => '0.4', 'Test::CheckManifest' => '1.29', 'Test::Kwalitee' => '1.22', 'Test::More' => '0.88', 'Test::Pod' => '1.41', 'Test::Pod::Coverage' => '1.08', 'Test::Pod::Spelling::CommonMistakes' => '1.000', 'Test::Spelling' => '0.12', 'Test::Version' => '1' } }, 'runtime' => { 'requires' => { 'Exporter' => '5.57', 'File::Spec' => '0', 'IPC::Run3' => '0', 'Pod::Spell' => '0', 'Symbol' => '0', 'Test::Builder' => '0', 'Text::Wrap' => '0', 'perl' => '5.008', 'strict' => '0', 'warnings' => '0' } }, 'test' => { 'recommends' => { 'CPAN::Meta' => '2.120900' }, 'requires' => { 'ExtUtils::MakeMaker' => '0', 'File::Spec' => '0', 'Test::More' => '0.88', 'Test::Tester' => '0', 'strict' => '0', 'utf8' => '0', 'warnings' => '0' } } }; $x; }Test-Spelling-0.25/t/stopword.t0000644000175000017500000000101613473356055017216 0ustar cwhitenercwhiteneruse Test::Tester; use Test::More; use Test::Spelling; BEGIN { if (!has_working_spellchecker()) { plan skip_all => "no working spellchecker found"; } } check_test(sub { pod_file_spelling_ok('t/corpus/stopword.pm', 'stopword pod file') }, { ok => 0, name => 'stopword pod file', diag => "Errors:\n Xzaue", }); add_stopwords('xzaue'); check_test(sub { pod_file_spelling_ok('t/corpus/stopword.pm', 'stopword pod file') }, { ok => 1, name => 'stopword pod file', }); done_testing; Test-Spelling-0.25/t/basic.t0000644000175000017500000000165313473356055016425 0ustar cwhitenercwhiteneruse Test::Tester; use Test::More; use Test::Spelling; use utf8; BEGIN { if (!has_working_spellchecker()) { plan skip_all => "no working spellchecker found"; } } check_test(sub { pod_file_spelling_ok('t/corpus/no-pod.pm', 'no pod has no errors') }, { ok => 1, name => 'no pod has no errors', }); check_test(sub { pod_file_spelling_ok('t/corpus/good-pod.pm', 'good pod has no errors') }, { ok => 1, name => 'good pod has no errors', }); check_test(sub { pod_file_spelling_ok('t/corpus/bad-pod.pm', 'bad pod has no errors') }, { ok => 0, name => 'bad pod has no errors', diag => "Errors:\n incorectly", }); SKIP: { skip "Unicode support reverted", 1; add_stopwords("ünıçöđé"); check_test(sub { pod_file_spelling_ok('t/corpus/unicode-pod.pm', 'unicode pod has no errors') }, { ok => 1, name => 'unicode pod has no errors', }); }; done_testing; Test-Spelling-0.25/t/fake_checker.t0000644000175000017500000000216213473356055017732 0ustar cwhitenercwhiteneruse Test::Tester; use Test::More; use Test::Spelling; # Use perl to fake a working spell checker # so we can test module portability even where no spell checker is present. my $spell_cmd = $^X . q< -e "print STDERR q[FOOBAR]">; set_spell_cmd($spell_cmd); is eval { pod_file_spelling_ok('t/corpus/bad-pod.pm', 'expect STDERR'); 1 }, undef, 'spell check died'; like $@, qr/Unable to find a working spellchecker:\n Unable to run '\Q$spell_cmd\E': spellchecker had errors: FOOBAR/, 'died with text found on STDERR'; my $badword = 'Xzaue'; $spell_cmd = $^X . qq< -ane "print grep { /$badword/i } \@F">; set_spell_cmd($spell_cmd); check_test(sub { pod_file_spelling_ok('t/corpus/good-pod.pm', 'no mistakes') }, { ok => 1, name => 'no mistakes', }); check_test(sub { pod_file_spelling_ok('t/corpus/stopword.pm', 'found misspelled word') }, { ok => 0, name => 'found misspelled word', diag => "Errors:\n $badword", }); add_stopwords(lc $badword); check_test(sub { pod_file_spelling_ok('t/corpus/stopword.pm', 'used stopword') }, { ok => 1, name => 'used stopword', }); done_testing; Test-Spelling-0.25/t/load.t0000644000175000017500000000051313473356055016255 0ustar cwhitenercwhiteneruse Test::More tests=>1; BEGIN { use_ok( 'Test::Spelling' ); } if (my $checker = Test::Spelling::has_working_spellchecker()) { diag "Test::Spelling found a spellchecker: $checker"; } else { diag "Test::Spelling did not find a spellchecker. Please make sure you have spell, aspell, ispell, or hunspell installed."; } Test-Spelling-0.25/t/corpus/0000755000175000017500000000000013473356055016465 5ustar cwhitenercwhitenerTest-Spelling-0.25/t/corpus/no-pod.pm0000644000175000017500000000010513473356055020213 0ustar cwhitenercwhitenerpackage No::Pod; use strict; use warnings; sub foo {} 1; __END__ Test-Spelling-0.25/t/corpus/bad-pod.pm0000644000175000017500000000017413473356055020333 0ustar cwhitenercwhitenerpackage Bad::Pod; use strict; use warnings; sub foo {} 1; __END__ =head1 NAME Bad::Pod - incorectly spelled POD =END Test-Spelling-0.25/t/corpus/stopword.pm0000644000175000017500000000023113473356055020700 0ustar cwhitenercwhitenerpackage Stopword::Pod; use strict; use warnings; sub foo {} 1; __END__ =head1 NAME Stopword::Pod - correctly spelled POD and a Xzaue creator =END Test-Spelling-0.25/t/corpus/unicode-pod.pm0000644000175000017500000000020113473356055021222 0ustar cwhitenercwhitenerpackage Unicode::Pod; use strict; use warnings; sub foo {} 1; __END__ =head1 NAME UTF8::Pod - POD with ünıçöđé =END Test-Spelling-0.25/t/corpus/good-pod.pm0000644000175000017500000000017513473356055020536 0ustar cwhitenercwhitenerpackage Good::Pod; use strict; use warnings; sub foo {} 1; __END__ =head1 NAME Good::Pod - correctly spelled POD =END Test-Spelling-0.25/t/00-report-prereqs.t0000644000175000017500000001342613473356055020554 0ustar cwhitenercwhitener#!perl use strict; use warnings; # This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.027 use Test::More tests => 1; use ExtUtils::MakeMaker; use File::Spec; # from $version::LAX my $lax_version_re = qr/(?: undef | (?: (?:[0-9]+) (?: \. | (?:\.[0-9]+) (?:_[0-9]+)? )? | (?:\.[0-9]+) (?:_[0-9]+)? ) | (?: v (?:[0-9]+) (?: (?:\.[0-9]+)+ (?:_[0-9]+)? )? | (?:[0-9]+)? (?:\.[0-9]+){2,} (?:_[0-9]+)? ) )/x; # hide optional CPAN::Meta modules from prereq scanner # and check if they are available my $cpan_meta = "CPAN::Meta"; my $cpan_meta_pre = "CPAN::Meta::Prereqs"; my $HAS_CPAN_META = eval "require $cpan_meta; $cpan_meta->VERSION('2.120900')" && eval "require $cpan_meta_pre"; ## no critic # Verify requirements? my $DO_VERIFY_PREREQS = 1; sub _max { my $max = shift; $max = ( $_ > $max ) ? $_ : $max for @_; return $max; } sub _merge_prereqs { my ($collector, $prereqs) = @_; # CPAN::Meta::Prereqs object if (ref $collector eq $cpan_meta_pre) { return $collector->with_merged_prereqs( CPAN::Meta::Prereqs->new( $prereqs ) ); } # Raw hashrefs for my $phase ( keys %$prereqs ) { for my $type ( keys %{ $prereqs->{$phase} } ) { for my $module ( keys %{ $prereqs->{$phase}{$type} } ) { $collector->{$phase}{$type}{$module} = $prereqs->{$phase}{$type}{$module}; } } } return $collector; } my @include = qw( ); my @exclude = qw( ); # Add static prereqs to the included modules list my $static_prereqs = do './t/00-report-prereqs.dd'; # Merge all prereqs (either with ::Prereqs or a hashref) my $full_prereqs = _merge_prereqs( ( $HAS_CPAN_META ? $cpan_meta_pre->new : {} ), $static_prereqs ); # Add dynamic prereqs to the included modules list (if we can) my ($source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; my $cpan_meta_error; if ( $source && $HAS_CPAN_META && (my $meta = eval { CPAN::Meta->load_file($source) } ) ) { $full_prereqs = _merge_prereqs($full_prereqs, $meta->prereqs); } else { $cpan_meta_error = $@; # capture error from CPAN::Meta->load_file($source) $source = 'static metadata'; } my @full_reports; my @dep_errors; my $req_hash = $HAS_CPAN_META ? $full_prereqs->as_string_hash : $full_prereqs; # Add static includes into a fake section for my $mod (@include) { $req_hash->{other}{modules}{$mod} = 0; } for my $phase ( qw(configure build test runtime develop other) ) { next unless $req_hash->{$phase}; next if ($phase eq 'develop' and not $ENV{AUTHOR_TESTING}); for my $type ( qw(requires recommends suggests conflicts modules) ) { next unless $req_hash->{$phase}{$type}; my $title = ucfirst($phase).' '.ucfirst($type); my @reports = [qw/Module Want Have/]; for my $mod ( sort keys %{ $req_hash->{$phase}{$type} } ) { next if $mod eq 'perl'; next if grep { $_ eq $mod } @exclude; my $file = $mod; $file =~ s{::}{/}g; $file .= ".pm"; my ($prefix) = grep { -e File::Spec->catfile($_, $file) } @INC; my $want = $req_hash->{$phase}{$type}{$mod}; $want = "undef" unless defined $want; $want = "any" if !$want && $want == 0; my $req_string = $want eq 'any' ? 'any version required' : "version '$want' required"; if ($prefix) { my $have = MM->parse_version( File::Spec->catfile($prefix, $file) ); $have = "undef" unless defined $have; push @reports, [$mod, $want, $have]; if ( $DO_VERIFY_PREREQS && $HAS_CPAN_META && $type eq 'requires' ) { if ( $have !~ /\A$lax_version_re\z/ ) { push @dep_errors, "$mod version '$have' cannot be parsed ($req_string)"; } elsif ( ! $full_prereqs->requirements_for( $phase, $type )->accepts_module( $mod => $have ) ) { push @dep_errors, "$mod version '$have' is not in required range '$want'"; } } } else { push @reports, [$mod, $want, "missing"]; if ( $DO_VERIFY_PREREQS && $type eq 'requires' ) { push @dep_errors, "$mod is not installed ($req_string)"; } } } if ( @reports ) { push @full_reports, "=== $title ===\n\n"; my $ml = _max( map { length $_->[0] } @reports ); my $wl = _max( map { length $_->[1] } @reports ); my $hl = _max( map { length $_->[2] } @reports ); if ($type eq 'modules') { splice @reports, 1, 0, ["-" x $ml, "", "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s\n", -$ml, $_->[0], $hl, $_->[2]) } @reports; } else { splice @reports, 1, 0, ["-" x $ml, "-" x $wl, "-" x $hl]; push @full_reports, map { sprintf(" %*s %*s %*s\n", -$ml, $_->[0], $wl, $_->[1], $hl, $_->[2]) } @reports; } push @full_reports, "\n"; } } } if ( @full_reports ) { diag "\nVersions for all modules listed in $source (including optional ones):\n\n", @full_reports; } if ( $cpan_meta_error || @dep_errors ) { diag "\n*** WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING ***\n"; } if ( $cpan_meta_error ) { my ($orig_source) = grep { -f } 'MYMETA.json', 'MYMETA.yml'; diag "\nCPAN::Meta->load_file('$orig_source') failed with: $cpan_meta_error\n"; } if ( @dep_errors ) { diag join("\n", "\nThe following REQUIRED prerequisites were not satisfied:\n", @dep_errors, "\n" ); } pass; # vim: ts=4 sts=4 sw=4 et: Test-Spelling-0.25/META.yml0000644000175000017500000002675413473356055016176 0ustar cwhitenercwhitener--- abstract: 'Check for spelling errors in POD files' author: - 'Ivan Tubert-Brohman ' build_requires: ExtUtils::MakeMaker: '0' File::Spec: '0' Test::More: '0.88' Test::Tester: '0' strict: '0' utf8: '0' warnings: '0' configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 generated_by: 'Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Test-Spelling no_index: directory: - eg - examples - inc - share - t - xt provides: Test::Spelling: file: lib/Test/Spelling.pm version: '0.25' requires: Exporter: '5.57' File::Spec: '0' IPC::Run3: '0' Pod::Spell: '0' Symbol: '0' Test::Builder: '0' Text::Wrap: '0' perl: '5.008' strict: '0' warnings: '0' resources: bugtracker: https://github.com/genio/test-spelling/issues homepage: https://github.com/genio/test-spelling repository: https://github.com/genio/test-spelling.git version: '0.25' x_Dist_Zilla: perl: version: '5.026001' plugins: - class: Dist::Zilla::Plugin::Git::GatherDir config: Dist::Zilla::Plugin::GatherDir: exclude_filename: - LICENSE - META.json - Makefile.PL - README.md - t/00-report-prereqs.t exclude_match: [] follow_symlinks: 0 include_dotfiles: 0 prefix: '' prune_directory: [] root: . Dist::Zilla::Plugin::Git::GatherDir: include_untracked: 0 name: Git::GatherDir version: '2.046' - class: Dist::Zilla::Plugin::MetaYAML name: '@Starter/MetaYAML' version: '6.012' - class: Dist::Zilla::Plugin::MetaJSON name: '@Starter/MetaJSON' version: '6.012' - class: Dist::Zilla::Plugin::License name: '@Starter/License' version: '6.012' - class: Dist::Zilla::Plugin::Pod2Readme name: '@Starter/Pod2Readme' version: '0.004' - class: Dist::Zilla::Plugin::PodSyntaxTests name: '@Starter/PodSyntaxTests' version: '6.012' - class: Dist::Zilla::Plugin::Test::ReportPrereqs name: '@Starter/Test::ReportPrereqs' version: '0.027' - class: Dist::Zilla::Plugin::Test::Compile config: Dist::Zilla::Plugin::Test::Compile: bail_out_on_fail: '0' fail_on_warning: author fake_home: 0 filename: xt/author/00-compile.t module_finder: - ':InstallModules' needs_display: 0 phase: develop script_finder: - ':PerlExecFiles' skips: [] switch: [] name: '@Starter/Test::Compile' version: '2.058' - class: Dist::Zilla::Plugin::MakeMaker::Awesome config: Dist::Zilla::Plugin::MakeMaker: make_path: make version: '6.012' Dist::Zilla::Role::TestRunner: default_jobs: 1 version: '6.012' name: '@Starter/MakeMaker::Awesome' version: '0.48' - class: Dist::Zilla::Plugin::Manifest name: '@Starter/Manifest' version: '6.012' - class: Dist::Zilla::Plugin::PruneCruft name: '@Starter/PruneCruft' version: '6.012' - class: Dist::Zilla::Plugin::ManifestSkip name: '@Starter/ManifestSkip' version: '6.012' - class: Dist::Zilla::Plugin::RunExtraTests config: Dist::Zilla::Role::TestRunner: default_jobs: 1 name: '@Starter/RunExtraTests' version: '0.029' - class: Dist::Zilla::Plugin::RewriteVersion config: Dist::Zilla::Plugin::RewriteVersion: add_tarball_name: 0 finders: - ':ExecFiles' - ':InstallModules' global: 1 skip_version_provider: 0 name: '@Starter/RewriteVersion' version: '0.018' - class: Dist::Zilla::Plugin::NextRelease name: '@Starter/NextRelease' version: '6.012' - class: Dist::Zilla::Plugin::BumpVersionAfterRelease config: Dist::Zilla::Plugin::BumpVersionAfterRelease: finders: - ':ExecFiles' - ':InstallModules' global: 0 munge_makefile_pl: 1 name: '@Starter/BumpVersionAfterRelease' version: '0.018' - class: Dist::Zilla::Plugin::TestRelease name: '@Starter/TestRelease' version: '6.012' - class: Dist::Zilla::Plugin::ConfirmRelease name: '@Starter/ConfirmRelease' version: '6.012' - class: Dist::Zilla::Plugin::UploadToCPAN name: '@Starter/UploadToCPAN' version: '6.012' - class: Dist::Zilla::Plugin::MetaConfig name: '@Starter/MetaConfig' version: '6.012' - class: Dist::Zilla::Plugin::MetaNoIndex name: '@Starter/MetaNoIndex' version: '6.012' - class: Dist::Zilla::Plugin::MetaProvides::Package config: Dist::Zilla::Plugin::MetaProvides::Package: finder_objects: - class: Dist::Zilla::Plugin::FinderCode name: '@Starter/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.012' include_underscores: 0 Dist::Zilla::Role::MetaProvider::Provider: $Dist::Zilla::Role::MetaProvider::Provider::VERSION: '2.002004' inherit_missing: '1' inherit_version: '1' meta_noindex: '1' Dist::Zilla::Role::ModuleMetadata: Module::Metadata: '1.000036' version: '0.006' name: '@Starter/MetaProvides::Package' version: '2.004003' - class: Dist::Zilla::Plugin::ShareDir name: '@Starter/ShareDir' version: '6.012' - class: Dist::Zilla::Plugin::ExecDir name: '@Starter/ExecDir' version: '6.012' - class: Dist::Zilla::Plugin::ReadmeAnyFromPod config: Dist::Zilla::Role::FileWatcher: version: '0.006' name: Markdown_Readme version: '0.163250' - class: Dist::Zilla::Plugin::Prereqs::FromCPANfile name: Prereqs::FromCPANfile version: '0.08' - class: Dist::Zilla::Plugin::Git::Contributors config: Dist::Zilla::Plugin::Git::Contributors: git_version: 2.20.1 include_authors: 0 include_releaser: 1 order_by: name paths: [] name: Git::Contributors version: '0.035' - class: Dist::Zilla::Plugin::GithubMeta name: GithubMeta version: '0.58' - class: Dist::Zilla::Plugin::Git::Check config: Dist::Zilla::Plugin::Git::Check: untracked_files: die Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.20.1 repo_root: . name: '@Git/Check' version: '2.046' - class: Dist::Zilla::Plugin::Git::Commit config: Dist::Zilla::Plugin::Git::Commit: add_files_in: [] commit_msg: v%V%n%n%c Dist::Zilla::Role::Git::DirtyFiles: allow_dirty: - Changes - dist.ini allow_dirty_match: [] changelog: Changes Dist::Zilla::Role::Git::Repo: git_version: 2.20.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@Git/Commit' version: '2.046' - class: Dist::Zilla::Plugin::Git::Tag config: Dist::Zilla::Plugin::Git::Tag: branch: ~ changelog: Changes signed: 0 tag: v0.25 tag_format: v%V tag_message: v%V Dist::Zilla::Role::Git::Repo: git_version: 2.20.1 repo_root: . Dist::Zilla::Role::Git::StringFormatter: time_zone: local name: '@Git/Tag' version: '2.046' - class: Dist::Zilla::Plugin::Git::Push config: Dist::Zilla::Plugin::Git::Push: push_to: - origin remotes_must_exist: 1 Dist::Zilla::Role::Git::Repo: git_version: 2.20.1 repo_root: . name: '@Git/Push' version: '2.046' - class: Dist::Zilla::Plugin::CheckChangeLog name: CheckChangeLog version: '0.05' - class: Dist::Zilla::Plugin::CheckChangesHasContent name: CheckChangesHasContent version: '0.011' - class: Dist::Zilla::Plugin::Test::ChangesHasContent name: Test::ChangesHasContent version: '0.011' - class: Dist::Zilla::Plugin::Test::Kwalitee config: Dist::Zilla::Plugin::Test::Kwalitee: filename: xt/release/kwalitee.t skiptest: - no_symlinks name: Test::Kwalitee version: '2.12' - class: Dist::Zilla::Plugin::Test::Version name: Test::Version version: '1.09' - class: Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable name: Test::Pod::Coverage::Configurable version: '0.07' - class: Dist::Zilla::Plugin::Test::PodSpelling config: Dist::Zilla::Plugin::Test::PodSpelling: directories: - bin - lib spell_cmd: '' stopwords: - Brohman - CPAN - Tubert - brian - foy - github - preprocessing - stopwords - wordlist wordlist: Pod::Wordlist name: Test::PodSpelling version: '2.007005' - class: Dist::Zilla::Plugin::CopyFilesFromBuild name: CopyFilesFromBuild version: '0.170880' - class: Dist::Zilla::Plugin::FinderCode name: ':InstallModules' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':IncModules' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':TestFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ExtraTestFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ExecFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':PerlExecFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':ShareFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':MainModule' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':AllFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: ':NoFiles' version: '6.012' - class: Dist::Zilla::Plugin::FinderCode name: '@Starter/MetaProvides::Package/AUTOVIV/:InstallModulesPM' version: '6.012' zilla: class: Dist::Zilla::Dist::Builder config: is_trial: '0' version: '6.012' x_contributors: - 'Chase Whitener ' - 'David Golden ' - 'Karen Etheridge ' - 'Kent Fredric ' - 'Kivanc Yazan ' - 'Mohammad S Anwar ' - 'Olaf Alders ' - 'Olivier Mengué ' - 'Randy Stauner ' - 'Shawn M Moore ' - 'Thomas Sibley ' x_generated_by_perl: v5.26.1 x_serialization_backend: 'YAML::Tiny version 1.73' Test-Spelling-0.25/xt/0000755000175000017500000000000013473356055015342 5ustar cwhitenercwhitenerTest-Spelling-0.25/xt/author/0000755000175000017500000000000013473356055016644 5ustar cwhitenercwhitenerTest-Spelling-0.25/xt/author/pod-coverage.t0000644000175000017500000000217013473356055021404 0ustar cwhitenercwhitener#!perl # This file was automatically generated by Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable 0.07. use Test::Pod::Coverage 1.08; use Test::More 0.88; BEGIN { if ( $] <= 5.008008 ) { plan skip_all => 'These tests require Pod::Coverage::TrustPod, which only works with Perl 5.8.9+'; } } use Pod::Coverage::TrustPod; my %skip = map { $_ => 1 } qw( ); my @modules; for my $module ( all_modules() ) { next if $skip{$module}; push @modules, $module; } plan skip_all => 'All the modules we found were excluded from POD coverage test.' unless @modules; plan tests => scalar @modules; my %trustme = ( 'Test::Spelling' => [ qr/^(?:invalid_words_in|spellchecker_candidates)$/ ] ); my @also_private; for my $module ( sort @modules ) { pod_coverage_ok( $module, { coverage_class => 'Pod::Coverage::TrustPod', also_private => \@also_private, trustme => $trustme{$module} || [], }, "pod coverage for $module" ); } done_testing(); Test-Spelling-0.25/xt/author/test-version.t0000644000175000017500000000063713473356055021501 0ustar cwhitenercwhiteneruse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::Version 1.09 use Test::Version; my @imports = qw( version_all_ok ); my $params = { is_strict => 0, has_version => 1, multiple => 0, }; push @imports, $params if version->parse( $Test::Version::VERSION ) >= version->parse('1.002'); Test::Version->import(@imports); version_all_ok; done_testing; Test-Spelling-0.25/xt/author/00-compile.t0000644000175000017500000000254513473356055020704 0ustar cwhitenercwhiteneruse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.058 use Test::More; plan tests => 2; my @module_files = ( 'Test/Spelling.pm' ); # no fake home requested my @switches = ( -d 'blib' ? '-Mblib' : '-Ilib', ); use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } $^X, @switches, '-e', "require q[$lib]")) if $ENV{PERL_COMPILE_TEST_DEBUG}; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { +require blib; blib->VERSION('1.01') }; if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ); Test-Spelling-0.25/xt/author/pod-spell.t0000644000175000017500000000106613473356055020733 0ustar cwhitenercwhiteneruse strict; use warnings; use Test::More; # generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007005 use Test::Spelling 0.12; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ Alders Anwar Brohman CPAN Chase David Etheridge Fredric Golden Ivan Karen Kent Kivanc Mengué Mohammad Moore Olaf Olivier Randy Shawn Sibley Spelling Stauner Test Thomas Tubert Whitener Yazan brian capoeirab dagolden dolmen ether foy github itub kentfredric kivancyazan lib mohammad olaf preprocessing randy sartak stopwords trs wordlist Test-Spelling-0.25/xt/author/pod-syntax.t0000644000175000017500000000025213473356055021136 0ustar cwhitenercwhitener#!perl # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use strict; use warnings; use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Test-Spelling-0.25/xt/release/0000755000175000017500000000000013473356055016762 5ustar cwhitenercwhitenerTest-Spelling-0.25/xt/release/kwalitee.t0000644000175000017500000000032113473356055020750 0ustar cwhitenercwhitener# this test was generated with Dist::Zilla::Plugin::Test::Kwalitee 2.12 use strict; use warnings; use Test::More 0.88; use Test::Kwalitee 1.21 'kwalitee_ok'; kwalitee_ok( qw( -no_symlinks ) ); done_testing; Test-Spelling-0.25/xt/release/changes_has_content.t0000644000175000017500000000210013473356055023135 0ustar cwhitenercwhiteneruse Test::More tests => 2; note 'Checking Changes'; my $changes_file = 'Changes'; my $newver = '0.25'; my $trial_token = '-TRIAL'; my $encoding = 'UTF-8'; SKIP: { ok(-e $changes_file, "$changes_file file exists") or skip 'Changes is missing', 1; ok(_get_changes($newver), "$changes_file has content for $newver"); } done_testing; sub _get_changes { my $newver = shift; # parse changelog to find commit message open(my $fh, '<', $changes_file) or die "cannot open $changes_file: $!"; my $changelog = join('', <$fh>); if ($encoding) { require Encode; $changelog = Encode::decode($encoding, $changelog, Encode::FB_CROAK()); } close $fh; my @content = grep { /^$newver(?:$trial_token)?(?:\s+|$)/ ... /^\S/ } # from newver to un-indented split /\n/, $changelog; shift @content; # drop the version line # drop unindented last line and trailing blank lines pop @content while ( @content && $content[-1] =~ /^(?:\S|\s*$)/ ); # return number of non-blank lines return scalar @content; } Test-Spelling-0.25/README0000644000175000017500000002114313473356055015570 0ustar cwhitenercwhitenerNAME Test::Spelling - Check for spelling errors in POD files SYNOPSIS Place a file, "pod-spell.t" in your distribution's "xt/author" directory: use strict; use warnings; use Test::More; use Test::Spelling; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ SomeBizarreWord YetAnotherBIzarreWord Or, you can gate the spelling test with the environment variable "AUTHOR_TESTING": use strict; use warnings; use Test::More; BEGIN { plan skip_all => "Spelling tests only for authors" unless $ENV{AUTHOR_TESTING}; } use Test::Spelling; use Pod::Wordlist; all_pod_files_spelling_ok(); DESCRIPTION Test::Spelling lets you check the spelling of a "POD" file, and report its results in standard Test::More fashion. This module requires a spellcheck program such as Hunspell , aspell, spell, or, ispell. We suggest using Hunspell. use Test::Spelling; pod_file_spelling_ok('lib/Foo/Bar.pm', 'POD file spelling OK'); Note that it is a bad idea to run spelling tests during an ordinary CPAN distribution install, or in a package that will run in an uncontrolled environment. There is no way of predicting whether the word list or spellcheck program used will give the same results. You can include the test in your distribution, but be sure to run it only for authors of the module by guarding it in a "skip_all unless $ENV{AUTHOR_TESTING}" clause, or by putting the test in your distribution's xt/author directory. Anyway, people installing your module really do not need to run such tests, as it is unlikely that the documentation will acquire typos while in transit. You can add your own stop words, which are words that should be ignored by the spell check, like so: add_stopwords(qw(asdf thiswordiscorrect)); Adding stop words in this fashion affects all files checked for the remainder of the test script. See Pod::Spell (which this module is built upon) for a variety of ways to add per-file stop words to each .pm file. If you have a lot of stop words, it's useful to put them in your test file's "DATA" section like so: use strict; use warnings; use Test::More; use Test::Spelling; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok(); __DATA__ folksonomy Jifty Zakirov To maintain backwards compatibility, comment markers and some whitespace are ignored. In the near future, the preprocessing we do on the arguments to "add_stopwords" in Test::Spelling will be changed and documented properly. FUNCTIONS Test::Spelling makes the following methods available. add_stopwords add_stopwords(@words); add_stopwords(); # pull in stop words from the DATA section Add words that should be skipped by the spell checker. Note that Pod::Spell already skips words believed to be code, such as everything in verbatim (indented) blocks and code marked up with "...", as well as some common Perl jargon. all_pod_files all_pod_files(); all_pod_files(@list_of_directories); Returns a list of all the Perl files in each directory and its subdirectories, recursively. If no directories are passed, it defaults to blib if blib exists, or else lib if not. Skips any files in CVS or .svn directories. A Perl file is: * Any file that ends in .PL, .pl, .plx, .pm, .pod or .t. * Any file that has a first line with a shebang and "perl" on it. Furthermore, files for which the filter set by "set_pod_file_filter" return false are skipped. By default, this filter passes everything through. The order of the files returned is machine-dependent. If you want them sorted, you'll have to sort them yourself. all_pod_files_spelling_ok all_pod_files_spelling_ok(@list_of_files); all_pod_files_spelling_ok(@list_of_directories); Checks all the files for "POD" spelling. It gathers "all_pod_files" in Test::Spelling on each file/directory, and declares a "plan" in Test::More for you (one test for each file), so you must not call "plan" yourself. If @files is empty, the function finds all "POD" files in the blib directory if it exists, or the lib directory if it does not. A "POD" file is one that ends with .pod, .pl, .plx, or .pm; or any file where the first line looks like a perl shebang line. If there is no working spellchecker (determined by ), this test will issue a "skip all" directive. If you're testing a distribution, just create an xt/author/pod-spell.t with the code in the "SYNOPSIS". Returns true if every "POD" file has correct spelling, or false if any of them fail. This function will show any spelling errors as diagnostics. * NOTE: This only tests using bytes. This is not decoded content, etc. Do not expect this to work with Unicode content, for example. This uses an open with no layers and no decoding. get_pod_parser # a Pod::Spell -like object my $object = get_pod_parser(); Get the object we're using to parse the "POD". A new Pod::Spell object should be used for every file. People providing custom parsers will have to do this themselves. has_working_spellchecker my $cmd = has_working_spellchecker; "has_working_spellchecker" will return "undef" if there is no working spellchecker, or a true value (the spellchecker command itself) if there is. The module performs a dry-run to determine whether any of the spellcheckers it can will use work on the current system. You can use this to skip tests if there is no spellchecker. Note that "all_pod_files_spelling_ok" will do this for you. A full list of spellcheckers which this method might test can be found in the source of the "spellchecker_candidates" method. pod_file_spelling_ok pod_file_spelling_ok('/path/to/Foo.pm'); pod_file_spelling_ok('/path/to/Foo.pm', 'Foo is well spelled!'); "pod_file_spelling_ok" will test that the given "POD" file has no spelling errors. When it fails, "pod_file_spelling_ok" will show any spelling errors as diagnostics. The optional second argument is the name of the test. If it is omitted, "pod_file_spelling_ok" chooses a default test name "POD spelling for $filename". * NOTE: This only tests using bytes. This is not decoded content, etc. Do not expect this to work with Unicode content, for example. This uses an open with no layers and no decoding. set_pod_file_filter # code ref set_pod_file_filter(sub { my $filename = shift; return 0 if $filename =~ /_ja.pod$/; # skip Japanese translations return 1; }); If your project has "POD" documents written in languages other than English, then obviously you don't want to be running a spellchecker on every Perl file. "set_pod_file_filter" lets you filter out files returned from "all_pod_files" (and hence, the documents tested by "all_pod_files_spelling_ok"). set_pod_parser my $object = Pod::Spell->new(); set_pod_parser($object); By default Pod::Spell is used to generate text suitable for spellchecking from the input POD. If you want to use a different parser, perhaps a customized subclass of Pod::Spell, call "set_pod_parser" with an object that is-a Pod::Parser. Be sure to create a fresh parser object for each file (don't use this with "all_pod_files_spelling_ok"). set_spell_cmd set_spell_cmd('hunspell -l'); # current preferred set_spell_cmd('aspell list'); set_spell_cmd('spell'); set_spell_cmd('ispell -l'); If you want to force this module to use a particular spellchecker, then you can specify which one with "set_spell_cmd". This is useful to ensure a more consistent lexicon between developers, or if you have an unusual environment. Any command that takes text from standard input and prints a list of misspelled words, one per line, to standard output will do. SEE ALSO Pod::Spell AUTHOR Ivan Tubert-Brohman "" Heavily based on Test::Pod by Andy Lester and brian d foy. COPYRIGHT & LICENSE Copyright 2005, Ivan Tubert-Brohman, All Rights Reserved. You may use, modify, and distribute this package under the same terms as Perl itself. Test-Spelling-0.25/META.json0000644000175000017500000004464413473356055016344 0ustar cwhitenercwhitener{ "abstract" : "Check for spelling errors in POD files", "author" : [ "Ivan Tubert-Brohman " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 6.012, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : 2 }, "name" : "Test-Spelling", "no_index" : { "directory" : [ "eg", "examples", "inc", "share", "t", "xt" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" }, "suggests" : { "JSON::PP" : "2.27300" } }, "develop" : { "requires" : { "Dist::Zilla" : "0", "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Pod::Coverage::TrustPod" : "0", "Test::CPAN::Changes" : "0.4", "Test::CheckManifest" : "1.29", "Test::Kwalitee" : "1.22", "Test::More" : "0.88", "Test::Pod" : "1.41", "Test::Pod::Coverage" : "1.08", "Test::Pod::Spelling::CommonMistakes" : "1.000", "Test::Spelling" : "0.12", "Test::Version" : "1" } }, "runtime" : { "requires" : { "Exporter" : "5.57", "File::Spec" : "0", "IPC::Run3" : "0", "Pod::Spell" : "0", "Symbol" : "0", "Test::Builder" : "0", "Text::Wrap" : "0", "perl" : "5.008", "strict" : "0", "warnings" : "0" } }, "test" : { "recommends" : { "CPAN::Meta" : "2.120900" }, "requires" : { "ExtUtils::MakeMaker" : "0", "File::Spec" : "0", "Test::More" : "0.88", "Test::Tester" : "0", "strict" : "0", "utf8" : "0", "warnings" : "0" } } }, "provides" : { "Test::Spelling" : { "file" : "lib/Test/Spelling.pm", "version" : "0.25" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/genio/test-spelling/issues" }, "homepage" : "https://github.com/genio/test-spelling", "repository" : { "type" : "git", "url" : "https://github.com/genio/test-spelling.git", "web" : "https://github.com/genio/test-spelling" } }, "version" : "0.25", "x_Dist_Zilla" : { "perl" : { "version" : "5.026001" }, "plugins" : [ { "class" : "Dist::Zilla::Plugin::Git::GatherDir", "config" : { "Dist::Zilla::Plugin::GatherDir" : { "exclude_filename" : [ "LICENSE", "META.json", "Makefile.PL", "README.md", "t/00-report-prereqs.t" ], "exclude_match" : [], "follow_symlinks" : 0, "include_dotfiles" : 0, "prefix" : "", "prune_directory" : [], "root" : "." }, "Dist::Zilla::Plugin::Git::GatherDir" : { "include_untracked" : 0 } }, "name" : "Git::GatherDir", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::MetaYAML", "name" : "@Starter/MetaYAML", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaJSON", "name" : "@Starter/MetaJSON", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::License", "name" : "@Starter/License", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Pod2Readme", "name" : "@Starter/Pod2Readme", "version" : "0.004" }, { "class" : "Dist::Zilla::Plugin::PodSyntaxTests", "name" : "@Starter/PodSyntaxTests", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::Test::ReportPrereqs", "name" : "@Starter/Test::ReportPrereqs", "version" : "0.027" }, { "class" : "Dist::Zilla::Plugin::Test::Compile", "config" : { "Dist::Zilla::Plugin::Test::Compile" : { "bail_out_on_fail" : 0, "fail_on_warning" : "author", "fake_home" : 0, "filename" : "xt/author/00-compile.t", "module_finder" : [ ":InstallModules" ], "needs_display" : 0, "phase" : "develop", "script_finder" : [ ":PerlExecFiles" ], "skips" : [], "switch" : [] } }, "name" : "@Starter/Test::Compile", "version" : "2.058" }, { "class" : "Dist::Zilla::Plugin::MakeMaker::Awesome", "config" : { "Dist::Zilla::Plugin::MakeMaker" : { "make_path" : "make", "version" : "6.012" }, "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1, "version" : "6.012" } }, "name" : "@Starter/MakeMaker::Awesome", "version" : "0.48" }, { "class" : "Dist::Zilla::Plugin::Manifest", "name" : "@Starter/Manifest", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::PruneCruft", "name" : "@Starter/PruneCruft", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ManifestSkip", "name" : "@Starter/ManifestSkip", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::RunExtraTests", "config" : { "Dist::Zilla::Role::TestRunner" : { "default_jobs" : 1 } }, "name" : "@Starter/RunExtraTests", "version" : "0.029" }, { "class" : "Dist::Zilla::Plugin::RewriteVersion", "config" : { "Dist::Zilla::Plugin::RewriteVersion" : { "add_tarball_name" : 0, "finders" : [ ":ExecFiles", ":InstallModules" ], "global" : 1, "skip_version_provider" : 0 } }, "name" : "@Starter/RewriteVersion", "version" : "0.018" }, { "class" : "Dist::Zilla::Plugin::NextRelease", "name" : "@Starter/NextRelease", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::BumpVersionAfterRelease", "config" : { "Dist::Zilla::Plugin::BumpVersionAfterRelease" : { "finders" : [ ":ExecFiles", ":InstallModules" ], "global" : 0, "munge_makefile_pl" : 1 } }, "name" : "@Starter/BumpVersionAfterRelease", "version" : "0.018" }, { "class" : "Dist::Zilla::Plugin::TestRelease", "name" : "@Starter/TestRelease", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ConfirmRelease", "name" : "@Starter/ConfirmRelease", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::UploadToCPAN", "name" : "@Starter/UploadToCPAN", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaConfig", "name" : "@Starter/MetaConfig", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaNoIndex", "name" : "@Starter/MetaNoIndex", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::MetaProvides::Package", "config" : { "Dist::Zilla::Plugin::MetaProvides::Package" : { "finder_objects" : [ { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@Starter/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.012" } ], "include_underscores" : 0 }, "Dist::Zilla::Role::MetaProvider::Provider" : { "$Dist::Zilla::Role::MetaProvider::Provider::VERSION" : "2.002004", "inherit_missing" : 1, "inherit_version" : 1, "meta_noindex" : 1 }, "Dist::Zilla::Role::ModuleMetadata" : { "Module::Metadata" : "1.000036", "version" : "0.006" } }, "name" : "@Starter/MetaProvides::Package", "version" : "2.004003" }, { "class" : "Dist::Zilla::Plugin::ShareDir", "name" : "@Starter/ShareDir", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ExecDir", "name" : "@Starter/ExecDir", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::ReadmeAnyFromPod", "config" : { "Dist::Zilla::Role::FileWatcher" : { "version" : "0.006" } }, "name" : "Markdown_Readme", "version" : "0.163250" }, { "class" : "Dist::Zilla::Plugin::Prereqs::FromCPANfile", "name" : "Prereqs::FromCPANfile", "version" : "0.08" }, { "class" : "Dist::Zilla::Plugin::Git::Contributors", "config" : { "Dist::Zilla::Plugin::Git::Contributors" : { "git_version" : "2.20.1", "include_authors" : 0, "include_releaser" : 1, "order_by" : "name", "paths" : [] } }, "name" : "Git::Contributors", "version" : "0.035" }, { "class" : "Dist::Zilla::Plugin::GithubMeta", "name" : "GithubMeta", "version" : "0.58" }, { "class" : "Dist::Zilla::Plugin::Git::Check", "config" : { "Dist::Zilla::Plugin::Git::Check" : { "untracked_files" : "die" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "dist.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.20.1", "repo_root" : "." } }, "name" : "@Git/Check", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::Git::Commit", "config" : { "Dist::Zilla::Plugin::Git::Commit" : { "add_files_in" : [], "commit_msg" : "v%V%n%n%c" }, "Dist::Zilla::Role::Git::DirtyFiles" : { "allow_dirty" : [ "Changes", "dist.ini" ], "allow_dirty_match" : [], "changelog" : "Changes" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.20.1", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@Git/Commit", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::Git::Tag", "config" : { "Dist::Zilla::Plugin::Git::Tag" : { "branch" : null, "changelog" : "Changes", "signed" : 0, "tag" : "v0.25", "tag_format" : "v%V", "tag_message" : "v%V" }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.20.1", "repo_root" : "." }, "Dist::Zilla::Role::Git::StringFormatter" : { "time_zone" : "local" } }, "name" : "@Git/Tag", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::Git::Push", "config" : { "Dist::Zilla::Plugin::Git::Push" : { "push_to" : [ "origin" ], "remotes_must_exist" : 1 }, "Dist::Zilla::Role::Git::Repo" : { "git_version" : "2.20.1", "repo_root" : "." } }, "name" : "@Git/Push", "version" : "2.046" }, { "class" : "Dist::Zilla::Plugin::CheckChangeLog", "name" : "CheckChangeLog", "version" : "0.05" }, { "class" : "Dist::Zilla::Plugin::CheckChangesHasContent", "name" : "CheckChangesHasContent", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::Test::ChangesHasContent", "name" : "Test::ChangesHasContent", "version" : "0.011" }, { "class" : "Dist::Zilla::Plugin::Test::Kwalitee", "config" : { "Dist::Zilla::Plugin::Test::Kwalitee" : { "filename" : "xt/release/kwalitee.t", "skiptest" : [ "no_symlinks" ] } }, "name" : "Test::Kwalitee", "version" : "2.12" }, { "class" : "Dist::Zilla::Plugin::Test::Version", "name" : "Test::Version", "version" : "1.09" }, { "class" : "Dist::Zilla::Plugin::Test::Pod::Coverage::Configurable", "name" : "Test::Pod::Coverage::Configurable", "version" : "0.07" }, { "class" : "Dist::Zilla::Plugin::Test::PodSpelling", "config" : { "Dist::Zilla::Plugin::Test::PodSpelling" : { "directories" : [ "bin", "lib" ], "spell_cmd" : "", "stopwords" : [ "Brohman", "CPAN", "Tubert", "brian", "foy", "github", "preprocessing", "stopwords", "wordlist" ], "wordlist" : "Pod::Wordlist" } }, "name" : "Test::PodSpelling", "version" : "2.007005" }, { "class" : "Dist::Zilla::Plugin::CopyFilesFromBuild", "name" : "CopyFilesFromBuild", "version" : "0.170880" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":InstallModules", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":IncModules", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":TestFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExtraTestFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ExecFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":PerlExecFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":ShareFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":MainModule", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":AllFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : ":NoFiles", "version" : "6.012" }, { "class" : "Dist::Zilla::Plugin::FinderCode", "name" : "@Starter/MetaProvides::Package/AUTOVIV/:InstallModulesPM", "version" : "6.012" } ], "zilla" : { "class" : "Dist::Zilla::Dist::Builder", "config" : { "is_trial" : 0 }, "version" : "6.012" } }, "x_contributors" : [ "Chase Whitener ", "David Golden ", "Karen Etheridge ", "Kent Fredric ", "Kivanc Yazan ", "Mohammad S Anwar ", "Olaf Alders ", "Olivier Mengu\u00e9 ", "Randy Stauner ", "Shawn M Moore ", "Thomas Sibley " ], "x_generated_by_perl" : "v5.26.1", "x_serialization_backend" : "Cpanel::JSON::XS version 4.11" } Test-Spelling-0.25/Makefile.PL0000644000175000017500000000325013473356055016661 0ustar cwhitenercwhitener# This Makefile.PL for Test-Spelling was generated by # Dist::Zilla::Plugin::MakeMaker::Awesome 0.48. # Don't edit it but the dist.ini and plugins used to construct it. use strict; use warnings; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "Check for spelling errors in POD files", "AUTHOR" => "Ivan Tubert-Brohman ", "BUILD_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "Test-Spelling", "LICENSE" => "perl", "NAME" => "Test::Spelling", "PREREQ_PM" => { "Exporter" => "5.57", "File::Spec" => 0, "IPC::Run3" => 0, "Pod::Spell" => 0, "Symbol" => 0, "Test::Builder" => 0, "Text::Wrap" => 0, "strict" => 0, "warnings" => 0 }, "TEST_REQUIRES" => { "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "Test::More" => "0.88", "Test::Tester" => 0, "strict" => 0, "utf8" => 0, "warnings" => 0 }, "VERSION" => "0.25", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Exporter" => "5.57", "ExtUtils::MakeMaker" => 0, "File::Spec" => 0, "IPC::Run3" => 0, "Pod::Spell" => 0, "Symbol" => 0, "Test::Builder" => 0, "Test::More" => "0.88", "Test::Tester" => 0, "Text::Wrap" => 0, "strict" => 0, "utf8" => 0, "warnings" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION('6.63_03') } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); Test-Spelling-0.25/MANIFEST0000644000175000017500000000105313473356055016037 0ustar cwhitenercwhitener# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.012. Changes LICENSE MANIFEST META.json META.yml Makefile.PL README cpanfile dist.ini lib/Test/Spelling.pm t/00-report-prereqs.dd t/00-report-prereqs.t t/basic.t t/corpus/bad-pod.pm t/corpus/good-pod.pm t/corpus/no-pod.pm t/corpus/stopword.pm t/corpus/unicode-pod.pm t/fake_checker.t t/load.t t/stopword.t xt/author/00-compile.t xt/author/pod-coverage.t xt/author/pod-spell.t xt/author/pod-syntax.t xt/author/test-version.t xt/release/changes_has_content.t xt/release/kwalitee.t Test-Spelling-0.25/LICENSE0000644000175000017500000004376213473356055015730 0ustar cwhitenercwhitenerThis software is copyright (c) 2005 by Ivan Tubert-Brohman . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. Terms of the Perl programming language system itself a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" --- The GNU General Public License, Version 1, February 1989 --- This software is Copyright (c) 2005 by Ivan Tubert-Brohman . This is free software, licensed under: The GNU General Public License, Version 1, February 1989 GNU GENERAL PUBLIC LICENSE Version 1, February 1989 Copyright (C) 1989 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The license agreements of most software companies try to keep users at the mercy of those companies. By contrast, our General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. The General Public License applies to the Free Software Foundation's software and to any other program whose authors commit to using it. You can use it for your programs, too. When we speak of free software, we are referring to freedom, not price. Specifically, the General Public License is designed to make sure that you have the freedom to give away or sell copies of free software, that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of a such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must tell them their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any work containing the Program or a portion of it, either verbatim or with modifications. Each licensee is addressed as "you". 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this General Public License and to the absence of any warranty; and give any other recipients of the Program a copy of this General Public License along with the Program. You may charge a fee for the physical act of transferring a copy. 2. You may modify your copy or copies of the Program or any portion of it, and copy and distribute such modifications under the terms of Paragraph 1 above, provided that you also do the following: a) cause the modified files to carry prominent notices stating that you changed the files and the date of any change; and b) cause the whole of any work that you distribute or publish, that in whole or in part contains the Program or any part thereof, either with or without modifications, to be licensed at no charge to all third parties under the terms of this General Public License (except that you may choose to grant warranty protection to some or all third parties, at your option). c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the simplest and most usual way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this General Public License. d) You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. Mere aggregation of another independent work with the Program (or its derivative) on a volume of a storage or distribution medium does not bring the other work under the scope of these terms. 3. You may copy and distribute the Program (or a portion or derivative of it, under Paragraph 2) in object code or executable form under the terms of Paragraphs 1 and 2 above provided that you also do one of the following: a) accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Paragraphs 1 and 2 above; or, b) accompany it with a written offer, valid for at least three years, to give any third party free (except for a nominal charge for the cost of distribution) a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Paragraphs 1 and 2 above; or, c) accompany it with the information you received as to where the corresponding source code may be obtained. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form alone.) Source code for a work means the preferred form of the work for making modifications to it. For an executable file, complete source code means all the source code for all modules it contains; but, as a special exception, it need not include source code for modules which are standard libraries that accompany the operating system on which the executable file runs, or for standard header files or definitions files that accompany that operating system. 4. You may not copy, modify, sublicense, distribute or transfer the Program except as expressly provided under this General Public License. Any attempt otherwise to copy, modify, sublicense, distribute or transfer the Program is void, and will automatically terminate your rights to use the Program under this License. However, parties who have received copies, or rights to use copies, from you under this General Public License will not have their licenses terminated so long as such parties remain in full compliance. 5. By copying, distributing or modifying the Program (or any work based on the Program) you indicate your acceptance of this license to do so, and all its terms and conditions. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. 7. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of the license which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the license, you may choose any version ever published by the Free Software Foundation. 8. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to humanity, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19xx name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (a program to direct compilers to make passes at assemblers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice That's all there is to it! --- The Artistic License 1.0 --- This software is Copyright (c) 2005 by Ivan Tubert-Brohman . This is free software, licensed under: The Artistic License 1.0 The Artistic License Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: - "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. - "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder. - "Copyright Holder" is whoever is named in the copyright or copyrights for the package. - "You" is you, if you're thinking about copying or distributing this Package. - "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) - "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. 7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package. 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End Test-Spelling-0.25/lib/0000755000175000017500000000000013473356055015455 5ustar cwhitenercwhitenerTest-Spelling-0.25/lib/Test/0000755000175000017500000000000013473356055016374 5ustar cwhitenercwhitenerTest-Spelling-0.25/lib/Test/Spelling.pm0000644000175000017500000003503113473356055020511 0ustar cwhitenercwhitenerpackage Test::Spelling; use strict; use warnings; use Exporter qw(import); use Pod::Spell; use Test::Builder; use Text::Wrap; use File::Spec; use IPC::Run3; use Symbol 'gensym'; our $VERSION = '0.25'; our @EXPORT = qw( pod_file_spelling_ok all_pod_files_spelling_ok add_stopwords set_spell_cmd all_pod_files set_pod_file_filter has_working_spellchecker set_pod_parser ); my $TEST = Test::Builder->new; my $SPELLCHECKER; my $FILE_FILTER = sub { 1 }; my $POD_PARSER; our %ALL_WORDS; sub spellchecker_candidates { # if they've specified a spellchecker, use only that one return $SPELLCHECKER if $SPELLCHECKER; return ( 'hunspell -l', # hunspell is now the most common spell checker 'spell', # for back-compat, this is the top candidate ... 'aspell list -l en -p /dev/null', # ... but this should become first soon 'ispell -l', ); } sub has_working_spellchecker { my $dryrun_results = _get_spellcheck_results("dry run", 1); if (ref $dryrun_results) { return; } return $SPELLCHECKER; } sub _get_spellcheck_results { my $document = shift; my $dryrun = shift; my @errors; for my $spellchecker (spellchecker_candidates()) { my @words; my $ok = eval { my ($spellcheck_results, $errors); IPC::Run3::run3($spellchecker, \$document, \$spellcheck_results, \$errors); @words = split /\n/, $spellcheck_results; die "spellchecker had errors: $errors" if length $errors; 1; }; if ($ok) { # remember the one we used, so that it's consistent for all the files # this run, and we don't keep retrying the same spellcheckers that will # never work. also we need to expose the spellchecker we're using in # has_working_spellchecker set_spell_cmd($spellchecker) if !$SPELLCHECKER; return @words; } push @errors, "Unable to run '$spellchecker': $@"; } # no working spellcheckers during a dry run return \"no spellchecker" if $dryrun; # no working spellcheckers; report all the errors require Carp; Carp::croak "Unable to find a working spellchecker:\n" . join("\n", map { " $_\n" } @errors) } sub invalid_words_in { my $file = shift; my $document = ''; open my $handle, '>', \$document; # the UTF-8 parsing seems to have broken many tests #open my $infile, '<:encoding(UTF-8)', $file; # save digested POD to the string $document #get_pod_parser()->parse_from_filehandle($infile, $handle); get_pod_parser()->parse_from_file($file, $handle); my @words = _get_spellcheck_results($document); chomp for @words; return @words; } sub pod_file_spelling_ok { my $file = shift; my $name = shift || "POD spelling for $file"; if (!-r $file) { $TEST->ok(0, $name); $TEST->diag("$file does not exist or is unreadable"); return; } my @words = invalid_words_in($file); # remove stopwords, select unique errors my $WL = \%Pod::Wordlist::Wordlist; @words = grep { !$WL->{$_} && !$WL->{lc $_} } @words; $ALL_WORDS{$_}++ for @words; my %seen; @seen{@words} = (); @words = sort keys %seen; # emit output my $ok = @words == 0; $TEST->ok($ok, "$name"); if (!$ok) { $TEST->diag("Errors:\n" . join '', map { " $_\n" } @words); } return $ok; } sub all_pod_files_spelling_ok { my @files = all_pod_files(@_); local %ALL_WORDS; if (!has_working_spellchecker()) { return $TEST->plan(skip_all => "no working spellchecker found"); } $TEST->plan(tests => scalar @files); my $ok = 1; for my $file (@files) { local $Test::Builder::Level = $Test::Builder::Level + 1; pod_file_spelling_ok($file) or undef $ok; } if ( keys %ALL_WORDS ) { # Invert k => v to v => [ k ] my %values; push @{ $values{ $ALL_WORDS{$_} } }, $_ for keys %ALL_WORDS; my $labelformat = q[%6s: ]; my $indent = q[ ] x 10; $TEST->diag(qq[\nAll incorrect words, by number of occurrences:\n] . join qq[\n], map { wrap( ( sprintf $labelformat, $_ ), $indent, join q[, ], sort @{ $values{$_} } ) } sort { $a <=> $b } keys %values ); } return $ok; } sub all_pod_files { my @queue = @_ ? @_ : _starting_points(); my @pod; while (@queue) { my $file = shift @queue; # recurse into subdirectories if (-d $file) { opendir(my $dirhandle, $file) or next; my @newfiles = readdir($dirhandle); closedir $dirhandle; @newfiles = File::Spec->no_upwards(@newfiles); @newfiles = grep { $_ ne "CVS" && $_ ne ".svn" } @newfiles; push @queue, map "$file/$_", @newfiles; } # add the file if it meets our criteria if (-f $file) { next unless _is_perl($file); next unless $FILE_FILTER->($file); push @pod, $file; } } return @pod; } sub _starting_points { return 'blib' if -d 'blib'; return 'lib'; } sub _is_perl { my $file = shift; return 1 if $file =~ /\.PL$/; return 1 if $file =~ /\.p(l|lx|m|od)$/; return 1 if $file =~ /\.t$/; open my $handle, '<', $file or return; my $first = <$handle>; return 1 if defined $first && ($first =~ /^#!.*perl/); return 0; } sub add_stopwords { for (@_) { # explicit copy so we don't modify constants as in add_stopwords("SQLite") my $word = $_; # XXX: the processing this performs is to support "perl t/spell.t 2>> # t/spell.t" which is bunk. in the near future the processing here will # become more modern $word =~ s/^#?\s*//; $word =~ s/\s+$//; next if $word =~ /\s/ or $word =~ /:/; $Pod::Wordlist::Wordlist{$word} = 1; } } sub set_spell_cmd { $SPELLCHECKER = shift; } sub set_pod_file_filter { $FILE_FILTER = shift; } # A new Pod::Spell object should be used for every file; people # providing custom pod parsers will have to do this themselves sub get_pod_parser { return $POD_PARSER || Pod::Spell->new; } sub set_pod_parser { $POD_PARSER = shift; } 1; __END__ =head1 NAME Test::Spelling - Check for spelling errors in POD files =head1 SYNOPSIS Place a file, C in your distribution's C directory: use strict; use warnings; use Test::More; use Test::Spelling; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok( qw( bin lib ) ); __DATA__ SomeBizarreWord YetAnotherBIzarreWord Or, you can gate the spelling test with the environment variable C: use strict; use warnings; use Test::More; BEGIN { plan skip_all => "Spelling tests only for authors" unless $ENV{AUTHOR_TESTING}; } use Test::Spelling; use Pod::Wordlist; all_pod_files_spelling_ok(); =head1 DESCRIPTION L lets you check the spelling of a C file, and report its results in standard L fashion. This module requires a spellcheck program such as L, F, F, or, F. We suggest using Hunspell. use Test::Spelling; pod_file_spelling_ok('lib/Foo/Bar.pm', 'POD file spelling OK'); Note that it is a bad idea to run spelling tests during an ordinary CPAN distribution install, or in a package that will run in an uncontrolled environment. There is no way of predicting whether the word list or spellcheck program used will give the same results. You B include the test in your distribution, but be sure to run it only for authors of the module by guarding it in a C clause, or by putting the test in your distribution's F directory. Anyway, people installing your module really do not need to run such tests, as it is unlikely that the documentation will acquire typos while in transit. You can add your own stop words, which are words that should be ignored by the spell check, like so: add_stopwords(qw(asdf thiswordiscorrect)); Adding stop words in this fashion affects all files checked for the remainder of the test script. See L (which this module is built upon) for a variety of ways to add per-file stop words to each .pm file. If you have a lot of stop words, it's useful to put them in your test file's C section like so: use strict; use warnings; use Test::More; use Test::Spelling; use Pod::Wordlist; add_stopwords(); all_pod_files_spelling_ok(); __DATA__ folksonomy Jifty Zakirov To maintain backwards compatibility, comment markers and some whitespace are ignored. In the near future, the preprocessing we do on the arguments to L will be changed and documented properly. =head1 FUNCTIONS L makes the following methods available. =head2 add_stopwords add_stopwords(@words); add_stopwords(); # pull in stop words from the DATA section Add words that should be skipped by the spell checker. Note that L already skips words believed to be code, such as everything in verbatim (indented) blocks and code marked up with C<< C<...> >>, as well as some common Perl jargon. =head2 all_pod_files all_pod_files(); all_pod_files(@list_of_directories); Returns a list of all the Perl files in each directory and its subdirectories, recursively. If no directories are passed, it defaults to F if F exists, or else F if not. Skips any files in F or F<.svn> directories. A Perl file is: =over 4 =item * Any file that ends in F<.PL>, F<.pl>, F<.plx>, F<.pm>, F<.pod> or F<.t>. =item * Any file that has a first line with a shebang and "perl" on it. =back Furthermore, files for which the filter set by L return false are skipped. By default, this filter passes everything through. The order of the files returned is machine-dependent. If you want them sorted, you'll have to sort them yourself. =head2 all_pod_files_spelling_ok all_pod_files_spelling_ok(@list_of_files); all_pod_files_spelling_ok(@list_of_directories); Checks all the files for C spelling. It gathers L on each file/directory, and declares a L for you (one test for each file), so you must not call C yourself. If C<@files> is empty, the function finds all C files in the F directory if it exists, or the F directory if it does not. A C file is one that ends with F<.pod>, F<.pl>, F<.plx>, or F<.pm>; or any file where the first line looks like a perl shebang line. If there is no working spellchecker (determined by L), this test will issue a C directive. If you're testing a distribution, just create an F with the code in the L. Returns true if every C file has correct spelling, or false if any of them fail. This function will show any spelling errors as diagnostics. * B This only tests using bytes. This is not decoded content, etc. Do not expect this to work with Unicode content, for example. This uses an open with no layers and no decoding. =head2 get_pod_parser # a Pod::Spell -like object my $object = get_pod_parser(); Get the object we're using to parse the C. A new L object should be used for every file. People providing custom parsers will have to do this themselves. =head2 has_working_spellchecker my $cmd = has_working_spellchecker; C will return C if there is no working spellchecker, or a true value (the spellchecker command itself) if there is. The module performs a dry-run to determine whether any of the spellcheckers it can will use work on the current system. You can use this to skip tests if there is no spellchecker. Note that L will do this for you. A full list of spellcheckers which this method might test can be found in the source of the C method. =head2 pod_file_spelling_ok pod_file_spelling_ok('/path/to/Foo.pm'); pod_file_spelling_ok('/path/to/Foo.pm', 'Foo is well spelled!'); C will test that the given C file has no spelling errors. When it fails, C will show any spelling errors as diagnostics. The optional second argument is the name of the test. If it is omitted, C chooses a default test name C<< POD spelling for $filename >>. * B This only tests using bytes. This is not decoded content, etc. Do not expect this to work with Unicode content, for example. This uses an open with no layers and no decoding. =head2 set_pod_file_filter # code ref set_pod_file_filter(sub { my $filename = shift; return 0 if $filename =~ /_ja.pod$/; # skip Japanese translations return 1; }); If your project has C documents written in languages other than English, then obviously you don't want to be running a spellchecker on every Perl file. C lets you filter out files returned from L (and hence, the documents tested by L). =head2 set_pod_parser my $object = Pod::Spell->new(); set_pod_parser($object); By default L is used to generate text suitable for spellchecking from the input POD. If you want to use a different parser, perhaps a customized subclass of L, call C with an object that is-a L. Be sure to create a fresh parser object for each file (don't use this with L). =head2 set_spell_cmd set_spell_cmd('hunspell -l'); # current preferred set_spell_cmd('aspell list'); set_spell_cmd('spell'); set_spell_cmd('ispell -l'); If you want to force this module to use a particular spellchecker, then you can specify which one with C. This is useful to ensure a more consistent lexicon between developers, or if you have an unusual environment. Any command that takes text from standard input and prints a list of misspelled words, one per line, to standard output will do. =head1 SEE ALSO L =head1 AUTHOR Ivan Tubert-Brohman C<< >> Heavily based on L by Andy Lester and brian d foy. =head1 COPYRIGHT & LICENSE Copyright 2005, Ivan Tubert-Brohman, All Rights Reserved. You may use, modify, and distribute this package under the same terms as Perl itself. =cut Test-Spelling-0.25/dist.ini0000644000175000017500000000257013473356055016357 0ustar cwhitenercwhitenername = Test-Spelling author = Ivan Tubert-Brohman license = Perl_5 copyright_holder = Ivan Tubert-Brohman copyright_year = 2005 ; version = 0.008 ; abstract = check for spelling errors in POD files [Git::GatherDir] exclude_filename = Makefile.PL exclude_filename = META.json exclude_filename = README.md exclude_filename = LICENSE exclude_filename = t/00-report-prereqs.t [@Starter] -remove = GatherDir revision = 3 managed_versions = 1 installer = MakeMaker::Awesome RewriteVersion.global = 1 NextRelease.format = %-9v %{yyyy-MM-dd}d [ReadmeAnyFromPod / Markdown_Readme] type = gfm source_filename = lib/Test/Spelling.pm filename = README.md location = root [Prereqs::FromCPANfile] [Git::Contributors] [GithubMeta] issues = 1 user = genio [@Git] [CheckChangeLog] [CheckChangesHasContent] [Test::ChangesHasContent] [Test::Kwalitee] skiptest = no_symlinks [Test::Version] [Test::Pod::Coverage::Configurable] trustme = Test::Spelling => qr/^(?:invalid_words_in|spellchecker_candidates)$/ [Test::PodSpelling] wordlist = Pod::Wordlist ; spell_cmd = hunspell -l stopword = CPAN stopword = github stopword = stopwords stopword = wordlist stopword = Brohman stopword = Tubert stopword = brian stopword = foy stopword = preprocessing [CopyFilesFromBuild] copy = lib/Test/Spelling.pm copy = Makefile.PL copy = META.json copy = LICENSE copy = t/00-report-prereqs.t Test-Spelling-0.25/Changes0000644000175000017500000000757013473356055016213 0ustar cwhitenercwhitenerRevision history for Test-Spelling 0.25 2019-05-28 - Re-worded the documentation. - Ordered documented function in alphabetical order. - Fixed up the synopsis. - Put function usage examples directly below the function name; this makes it easier to get clickable links for functions in metacpan - Documented get_pod_parser - Moved hunspell up to the preferred checker 0.24 2019-05-24 - Fixup the prereqs some - Revert the unicode support added in the last release as it caused some test breakage 0.23 2019-05-21 - Fixed some documentation errors (Mohammad S Anwar) - Added unicode support (Kivanc Yazan, GH PR#10) - Bump Perl prereq to 5.8 now that we support unicode - Don't inherit from Exporter (Olivier Mengué, GH PR#9) - Bump Exporter prereq to 5.57 0.22 2019-04-24 - Zero-code-change release encompassing everything from 0.21 - Resolves RT#120425 . in @INC should no longer be an issue 0.21 2019-04-19 (TRIAL) - Removed the POD spelling test from /t as it's now in /xt - Forego usage of inc::Module::Install for EU::MM - List out all prereqs individually; provide cpanfile - Use dzil to build the dist - Convert the README to markdown - Add a LICENSE file - Clean up the Changes log 0.20 2014-10-07 - Add a sorted list of your most commonly misspelled words to the end of all_pod_files_spelling_ok to aid stopword list creation and bulk correction. (Kent Fredric) 0.19 2013-05-05 - for more consistent results avoid using the user's local aspell dictionary [rt.cpan.org #84869] (Karen Etheridge) 0.18 2013-04-26 - Work around Pod::Spell limitations (David Golden) - Improve case handling (David Golden) - Improve test failure reporting (Karen Etheridge) - Include more useful info in Test-Spelling's own test suite (Shawn Moore) 0.17 2012-01-27 - Use IPC::Run3 instead of IPC::Open3 Quoth IPC::Open3: If you try to read from the child's stdout writer and their stderr writer, you'll have problems with blocking ... This is very dangerous, as you may block forever. Also the code is nicely shorter. (Randy Stauner) 0.16 2012-12-20 - Allow use of a custom POD parser rather than Pod::Spell using set_pod_parser (Thomas Sibley) 0.15 2011-08-22 - Begin adding actual tests (Hilariously, adding the suggested t/pod-spell.t to this dist to test itself found a typo: "stopwards") 0.14 2011-05-27 - Fix an error when using add_stopwords("constant", "strings") [rt.cpan.org #68471] (reported by Nicholas Bamber) 0.13 2011-04-27 - Make alternatives checking more robust by reading the spellchecker's STDERR 0.12 2011-04-25 - Best Practical has taken over maintainership of this module - Try various spellcheck programs instead of hardcoding the ancient `spell` [rt.cpan.org #56483] (reported by Lars Dɪᴇᴄᴋᴏᴡ, et al) - Remove temporary files more aggressively [rt.cpan.org #41586] (reported by Tokuhiro Matsuno) - fixed by not creating them at all :) instead we now use IPC::Open3 - Remove suggestion to use broken `aspell -l` [rt.cpan.org #28967] (reported by David Hand) - Add set_pod_file_filter for skipping translations, etc. [rt.cpan.org #63755] (reported by me :)) - Skip tests in all_pod_files_spelling_ok if there is no working spellchecker - Provide a has_working_spellchecker so you can skip your own tests if there's no working spellchecker - Switch to Module::Install - Rewrite and modernize a lot of the documentation - Decruftify code, such as by using Exporter and lexical filehandles - Support .plx files (you're welcome Schwern) 0.11 2005-11-15 - Some documentation fixes. - Added note about per-file stopwords by Chris Dolan. - Use a temporary file instead of open2() to solve win32 portability issues. (Thanks to Chris Laco!) 0.10 2005-08-02 - First version Test-Spelling-0.25/cpanfile0000644000175000017500000000153713473356055016421 0ustar cwhitenercwhiteneron 'runtime' => sub { requires 'perl' => '5.008'; requires 'strict'; requires 'warnings'; requires 'Exporter' => '5.57'; requires 'File::Spec'; requires 'IPC::Run3'; requires 'Pod::Spell'; requires 'Symbol'; requires 'Test::Builder'; requires 'Text::Wrap'; }; on 'build' => sub { requires 'ExtUtils::MakeMaker'; }; on 'test' => sub { requires 'strict'; requires 'warnings'; requires 'utf8'; requires 'ExtUtils::MakeMaker'; requires 'File::Spec'; requires 'Test::More' => '0.88'; # already uses done_testing requires 'Test::Tester'; }; on 'develop' => sub { requires 'Dist::Zilla'; requires 'Test::CheckManifest' => '1.29'; requires 'Test::CPAN::Changes' => '0.4'; requires 'Test::Kwalitee' => '1.22'; requires 'Test::Pod::Spelling::CommonMistakes' => '1.000'; };