| 1 | package App::genstopwords; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use version; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 1 | our $VERSION = qv('v0.0.1'); | |
| 8 | 1 | our $AUTHORITY = 'cpan:MANWAR'; | |
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | App::genstopwords - Generate a .stopwords file for POD spell-checking | ||
| 13 | |||
| 14 | =head1 VERSION | ||
| 15 | |||
| 16 | Version v0.0.1 | ||
| 17 | |||
| 18 | =head1 SYNOPSIS | ||
| 19 | |||
| 20 | gen-stopwords [OPTIONS] | ||
| 21 | |||
| 22 | # Basic usage (scans current directory, writes .stopwords) | ||
| 23 | gen-stopwords | ||
| 24 | |||
| 25 | # Specify language and output file | ||
| 26 | gen-stopwords --lang en_US --output t/.stopwords | ||
| 27 | |||
| 28 | # Scan specific directories | ||
| 29 | gen-stopwords --dir lib --dir bin --dir t | ||
| 30 | |||
| 31 | # Preview without writing | ||
| 32 | gen-stopwords --dry-run --verbose | ||
| 33 | |||
| 34 | # Show this help | ||
| 35 | gen-stopwords --help | ||
| 36 | |||
| 37 | =head1 DESCRIPTION | ||
| 38 | |||
| 39 | Scans Perl source files (F<.pm>, F<.pl>, F<.pod>, F<.t>) and uses B<aspell> | ||
| 40 | to identify words that are not in the standard dictionary. Those words are | ||
| 41 | collected into a F<.stopwords> file that your spelling test (e.g. | ||
| 42 | C<Test::Spelling>) can use to suppress false positives. | ||
| 43 | |||
| 44 | The generator: | ||
| 45 | |||
| 46 | =over 4 | ||
| 47 | |||
| 48 | =item * Strips POD formatting codes (C<E<gt>>, C<L<...>>, C<C<...>>, etc.) | ||
| 49 | before passing lines to aspell, preventing artefacts like C<Egt>. | ||
| 50 | |||
| 51 | =item * Uses C<--run-together> so compound identifiers such as C<ResultSet> | ||
| 52 | and C<PendingChange> are handled correctly. | ||
| 53 | |||
| 54 | =item * Optionally seeds the list from your personal aspell wordlist | ||
| 55 | (F<~/.aspell.en.pws>) so project-specific words already known to you are | ||
| 56 | included automatically. | ||
| 57 | |||
| 58 | =item * Skips build/vendor directories (F<.git>, F<blib>, F<local>, etc.) | ||
| 59 | to keep the output clean. | ||
| 60 | |||
| 61 | =back | ||
| 62 | |||
| 63 | =head1 OPTIONS | ||
| 64 | |||
| 65 | =over 4 | ||
| 66 | |||
| 67 | =item B<-l>, B<--lang> I<LANG> | ||
| 68 | |||
| 69 | Aspell language code to use. Defaults to C<en_GB>. | ||
| 70 | |||
| 71 | =item B<-o>, B<--output> I<FILE> | ||
| 72 | |||
| 73 | Path of the stopwords file to write. Defaults to C<.stopwords> in the | ||
| 74 | current directory. | ||
| 75 | |||
| 76 | =item B<-p>, B<--pws> I<FILE> | ||
| 77 | |||
| 78 | Path to your personal aspell wordlist. Defaults to | ||
| 79 | F<~/.aspell.en.pws>. Use C<--no-global> to skip this entirely. | ||
| 80 | |||
| 81 | =item B<-d>, B<--dir> I<DIR> | ||
| 82 | |||
| 83 | Directory to scan. May be specified multiple times. Defaults to C<.> | ||
| 84 | (current directory). | ||
| 85 | |||
| 86 | =item B<-m>, B<--min-len> I<N> | ||
| 87 | |||
| 88 | Minimum word length to include. Defaults to C<2>. | ||
| 89 | |||
| 90 | =item B<-v>, B<--verbose> | ||
| 91 | |||
| 92 | Print the name of every file processed and extra detail. | ||
| 93 | |||
| 94 | =item B<-q>, B<--quiet> | ||
| 95 | |||
| 96 | Suppress all non-error output. | ||
| 97 | |||
| 98 | =item B<-n>, B<--dry-run> | ||
| 99 | |||
| 100 | Show what would be written without actually creating or modifying the | ||
| 101 | output file. | ||
| 102 | |||
| 103 | =item B<--no-global> | ||
| 104 | |||
| 105 | Do not load words from the personal aspell wordlist. | ||
| 106 | |||
| 107 | =item B<-V>, B<--version> | ||
| 108 | |||
| 109 | Print the version and exit. | ||
| 110 | |||
| 111 | =item B<-h>, B<--help> | ||
| 112 | |||
| 113 | Print this help message and exit. | ||
| 114 | |||
| 115 | =back | ||
| 116 | |||
| 117 | =head1 REQUIREMENTS | ||
| 118 | |||
| 119 | =over 4 | ||
| 120 | |||
| 121 | =item * Perl 5.10+ | ||
| 122 | |||
| 123 | =item * B<aspell> must be installed and on C<$PATH>. | ||
| 124 | |||
| 125 | =back | ||
| 126 | |||
| 127 | =head1 EXIT STATUS | ||
| 128 | |||
| 129 | Exits C<0> on success, C<1> on usage error, and dies with a descriptive | ||
| 130 | message on fatal errors (missing aspell, unwritable output, etc.). | ||
| 131 | |||
| 132 | =head1 WORKFLOW | ||
| 133 | |||
| 134 | # 1. Generate (or regenerate after editing source files) | ||
| 135 | gen-stopwords | ||
| 136 | |||
| 137 | # 2. Run your spelling test | ||
| 138 | AUTHOR_TESTING=1 perl spelling.t | ||
| 139 | |||
| 140 | Your spelling test should warn you when source files are newer than | ||
| 141 | F<.stopwords>, prompting you to re-run this script. | ||
| 142 | |||
| 143 | =head1 AUTHOR | ||
| 144 | |||
| 145 | Mohammad Sajid Anwar, C<< <mohammad.anwar at yahoo.com> >> | ||
| 146 | |||
| 147 | =head1 REPOSITORY | ||
| 148 | |||
| 149 | L<https://github.com/manwar/App-genstopwords> | ||
| 150 | |||
| 151 | =head1 BUGS | ||
| 152 | |||
| 153 | Please report any bugs or feature requests through the web interface at L<https://github.com/manwar/App-genstopwords/issues>. | ||
| 154 | I will be notified and then you'll automatically be notified of progress on your | ||
| 155 | bug as I make changes. | ||
| 156 | |||
| 157 | =head1 SUPPORT | ||
| 158 | |||
| 159 | You can find documentation for this module with the perldoc command. | ||
| 160 | |||
| 161 | perldoc App::genstopwords | ||
| 162 | |||
| 163 | You can also look for information at: | ||
| 164 | |||
| 165 | =over 4 | ||
| 166 | |||
| 167 | =item * BUG Report | ||
| 168 | |||
| 169 | L<https://github.com/manwar/App-genstopwords/issues> | ||
| 170 | |||
| 171 | =item * CPAN Ratings | ||
| 172 | |||
| 173 | L<http://cpanratings.perl.org/d/App-genstopwords> | ||
| 174 | |||
| 175 | =item * Search MetaCPAN | ||
| 176 | |||
| 177 | L<https://metacpan.org/dist/App-genstopwords/> | ||
| 178 | |||
| 179 | =back | ||
| 180 | |||
| 181 | =head1 LICENSE AND COPYRIGHT | ||
| 182 | |||
| 183 | Copyright (C) 2026 Mohammad Sajid Anwar. | ||
| 184 | |||
| 185 | This program is free software; you can redistribute it and / or modify it under | ||
| 186 | the terms of the the Artistic License (2.0). You may obtain a copy of the full | ||
| 187 | license at: | ||
| 188 | |||
| 189 | L<http://www.perlfoundation.org/artistic_license_2_0> | ||
| 190 | |||
| 191 | Any use, modification, and distribution of the Standard or Modified Versions is | ||
| 192 | governed by this Artistic License.By using, modifying or distributing the Package, | ||
| 193 | you accept this license. Do not use, modify, or distribute the Package, if you do | ||
| 194 | not accept this license. | ||
| 195 | If your Modified Version has been derived from a Modified Version made by someone | ||
| 196 | other than you,you are nevertheless required to ensure that your Modified Version | ||
| 197 | complies with the requirements of this license. | ||
| 198 | This license does not grant you the right to use any trademark, service mark, | ||
| 199 | tradename, or logo of the Copyright Holder. | ||
| 200 | This license includes the non-exclusive, worldwide, free-of-charge patent license | ||
| 201 | to make, have made, use, offer to sell, sell, import and otherwise transfer the | ||
| 202 | Package with respect to any patent claims licensable by the Copyright Holder that | ||
| 203 | are necessarily infringed by the Package. If you institute patent litigation | ||
| 204 | (including a cross-claim or counterclaim) against any party alleging that the | ||
| 205 | Package constitutes direct or contributory patent infringement,then this Artistic | ||
| 206 | License to you shall terminate on the date that such litigation is filed. | ||
| 207 | Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND | ||
| 208 | CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED | ||
| 209 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR | ||
| 210 | NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS | ||
| 211 | REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, | ||
| 212 | INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE | ||
| 213 | OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 214 | |||
| 215 | =cut | ||
| 216 | |||
| 217 | 1 | 1; # End of App::genstopwords | |