diff --git a/0001-Change-default-spell-check-tool-from-aspell-to-hunsp.patch b/0001-Change-default-spell-check-tool-from-aspell-to-hunsp.patch new file mode 100644 index 0000000..1a03836 --- /dev/null +++ b/0001-Change-default-spell-check-tool-from-aspell-to-hunsp.patch @@ -0,0 +1,341 @@ +From 3fe891edfb8957d6f89f16cb9bca7e72a7811572 Mon Sep 17 00:00:00 2001 +From: Paul Howarth +Date: Fri, 21 Jul 2017 11:50:35 +0100 +Subject: [PATCH] Change default spell check tool from aspell to hunspell + +This is on the basis that most downstream users are already doing +or have migrated from aspell to hunspell due to hunspell being +actively maintained, unlike aspell. + +https://wiki.ubuntu.com/ConsolidateSpellingLibs +https://wiki.gnome.org/Initiatives/SpellChecking +https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=860895 +https://fedoraproject.org/wiki/Releases/FeatureDictionary + +Unfortunately, hunspell prior to about version 1.2.12 (2010) had +problems with ASCII apostrophes, thus flagging errors for words +like "doesn't", "isn't" etc., which makes 1.2.12 pretty much a +minimum version requirement if incorporating this change. +--- + bin/perlcritic | 2 +- + .../BuiltinFunctions/ProhibitBooleanGrep.pm | 2 ++ + .../BuiltinFunctions/ProhibitLvalueSubstr.pm | 2 +- + .../Policy/Documentation/PodSpelling.pm | 20 +++++++++---------- + .../RequireCheckingReturnValueOfEval.pm | 2 +- + .../Policy/Modules/RequireBarewordIncludes.pm | 2 ++ + .../ProhibitCaptureWithoutTest.pm | 2 ++ + .../ProhibitComplexRegexes.pm | 2 +- + .../ProhibitFixedStringMatches.pm | 2 ++ + .../ProhibitSingleCharAlternation.pm | 2 ++ + .../ProhibitUnusedCapture.pm | 2 +- + .../ProhibitUnusualDelimiters.pm | 2 ++ + .../RequireBracesForMultiline.pm | 2 ++ + .../Variables/ProhibitPunctuationVars.pm | 2 ++ + .../Variables/RequireLexicalLoopIterators.pm | 2 +- + lib/Perl/Critic/Utils.pm | 2 ++ + lib/Perl/Critic/Utils/PPI.pm | 2 +- + t/20_policy_pod_spelling.t | 4 ++-- + xt/40_perlcriticrc-code | 2 +- + 19 files changed, 38 insertions(+), 20 deletions(-) + +diff --git a/bin/perlcritic b/bin/perlcritic +index e96ca78c..ddc73558 100644 +--- a/bin/perlcritic ++++ b/bin/perlcritic +@@ -30,7 +30,7 @@ __END__ + + =for stopwords DGR INI-style vim-fu minibuffer -noprofile API + -profileproto -profile-proto ben Jore formatter Peshak pbp Komodo +-screenshots tty emacs gVIM plugin Perlish templating ActivePerl ++screenshots tty emacs grep gVIM plugin Perlish templating ActivePerl + ActiveState Twitter + + =head1 NAME +diff --git a/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitBooleanGrep.pm b/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitBooleanGrep.pm +index c39ecd6e..32312c12 100644 +--- a/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitBooleanGrep.pm ++++ b/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitBooleanGrep.pm +@@ -86,6 +86,8 @@ __END__ + + =pod + ++=for stopwords grep ++ + =head1 NAME + + Perl::Critic::Policy::BuiltinFunctions::ProhibitBooleanGrep - Use C instead of C in boolean context. +diff --git a/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitLvalueSubstr.pm b/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitLvalueSubstr.pm +index 0a77ff00..ddba991d 100644 +--- a/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitLvalueSubstr.pm ++++ b/lib/Perl/Critic/Policy/BuiltinFunctions/ProhibitLvalueSubstr.pm +@@ -64,7 +64,7 @@ __END__ + + =pod + +-=for stopwords perlfunc substr 4th ++=for stopwords perl5005delta perlfunc substr 4th + + =head1 NAME + +diff --git a/lib/Perl/Critic/Policy/Documentation/PodSpelling.pm b/lib/Perl/Critic/Policy/Documentation/PodSpelling.pm +index 0e133176..98e39f21 100644 +--- a/lib/Perl/Critic/Policy/Documentation/PodSpelling.pm ++++ b/lib/Perl/Critic/Policy/Documentation/PodSpelling.pm +@@ -39,7 +39,7 @@ sub supported_parameters { + { + name => 'spell_command', + description => 'The command to invoke to check spelling.', +- default_string => 'aspell list', ++ default_string => 'hunspell -l', + behavior => 'string', + }, + { +@@ -202,11 +202,11 @@ sub _run_spell_command { + # run spell command and fetch output + local $SIG{PIPE} = sub { $got_sigpipe = 1; }; + my $command_line = join $SPACE, @{$self->_get_spell_command_line()}; +- open my $aspell_out_fh, q{-|}, "$command_line < $outfile" ## Is this portable?? ++ open my $speller_out_fh, q{-|}, "$command_line < $outfile" ## Is this portable?? + or throw_generic "Failed to open handle to spelling program: $OS_ERROR"; + +- @words = uniq( <$aspell_out_fh> ); +- close $aspell_out_fh ++ @words = uniq( <$speller_out_fh> ); ++ close $speller_out_fh + or throw_generic "Failed to close handle to spelling program: $OS_ERROR"; + + chomp @words; +@@ -324,11 +324,11 @@ set a global list of spelling exceptions. To do this, put entries in + a F<.perlcriticrc> file like this: + + [Documentation::PodSpelling] +- spell_command = aspell list ++ spell_command = hunspell -l + stop_words = gibbles foobar + stop_words_file = some/path/with/stop/words.txt + +-The default spell command is C and it is interpreted as a ++The default spell command is C and it is interpreted as a + shell command. We parse the individual arguments via + L so feel free to use quotes around + your arguments. If the executable path is an absolute file name, it +@@ -358,13 +358,13 @@ together into a single list of exemptions. + + A spell checking program is not included with Perl::Critic. + +-The results of failures for this policy can be confusing when F ++The results of failures for this policy can be confusing when F + complains about words containing punctuation such as hyphens and apostrophes. +-In this situation F will often only emit part of the word that it +-thinks is misspelled. For example, if you ask F to check ++In this situation F will often only emit part of the word that it ++thinks is misspelled. For example, if you ask F to check + "foobie-bletch", the output only complains about "foobie". Unfortunately, + you'll have to look through your POD to figure out what the real word that +-F is complaining about is. One thing to try is looking at the output ++F is complaining about is. One thing to try is looking at the output + of C<< perl -MPod::Spell -e 'print + Pod::Spell->new()->parse_from_file("lib/Your/Module.pm")' >> to see what is + actually being checked for spelling. +diff --git a/lib/Perl/Critic/Policy/ErrorHandling/RequireCheckingReturnValueOfEval.pm b/lib/Perl/Critic/Policy/ErrorHandling/RequireCheckingReturnValueOfEval.pm +index 1144d6b0..924bfe2c 100644 +--- a/lib/Perl/Critic/Policy/ErrorHandling/RequireCheckingReturnValueOfEval.pm ++++ b/lib/Perl/Critic/Policy/ErrorHandling/RequireCheckingReturnValueOfEval.pm +@@ -317,7 +317,7 @@ __END__ + + =pod + +-=for stopwords destructors ++=for stopwords destructors perl5 + + =head1 NAME + +diff --git a/lib/Perl/Critic/Policy/Modules/RequireBarewordIncludes.pm b/lib/Perl/Critic/Policy/Modules/RequireBarewordIncludes.pm +index d570f207..934964b6 100644 +--- a/lib/Perl/Critic/Policy/Modules/RequireBarewordIncludes.pm ++++ b/lib/Perl/Critic/Policy/Modules/RequireBarewordIncludes.pm +@@ -46,6 +46,8 @@ __END__ + + =pod + ++=for stopwords Perl4 ++ + =head1 NAME + + Perl::Critic::Policy::Modules::RequireBarewordIncludes - Write C instead of C. +diff --git a/lib/Perl/Critic/Policy/RegularExpressions/ProhibitCaptureWithoutTest.pm b/lib/Perl/Critic/Policy/RegularExpressions/ProhibitCaptureWithoutTest.pm +index 8dc04937..5d971e1a 100644 +--- a/lib/Perl/Critic/Policy/RegularExpressions/ProhibitCaptureWithoutTest.pm ++++ b/lib/Perl/Critic/Policy/RegularExpressions/ProhibitCaptureWithoutTest.pm +@@ -307,6 +307,8 @@ __END__ + + =pod + ++=for stopwords regexp ++ + =head1 NAME + + Perl::Critic::Policy::RegularExpressions::ProhibitCaptureWithoutTest - Capture variable used outside conditional. +diff --git a/lib/Perl/Critic/Policy/RegularExpressions/ProhibitComplexRegexes.pm b/lib/Perl/Critic/Policy/RegularExpressions/ProhibitComplexRegexes.pm +index 647ffb4a..a6ce7af6 100644 +--- a/lib/Perl/Critic/Policy/RegularExpressions/ProhibitComplexRegexes.pm ++++ b/lib/Perl/Critic/Policy/RegularExpressions/ProhibitComplexRegexes.pm +@@ -99,7 +99,7 @@ __END__ + + =pod + +-=for stopwords BNF Tatsuhiko Miyagawa ++=for stopwords BNF regexp RFC822 Tatsuhiko Miyagawa + + =head1 NAME + +diff --git a/lib/Perl/Critic/Policy/RegularExpressions/ProhibitFixedStringMatches.pm b/lib/Perl/Critic/Policy/RegularExpressions/ProhibitFixedStringMatches.pm +index 63704bad..dc9e1778 100644 +--- a/lib/Perl/Critic/Policy/RegularExpressions/ProhibitFixedStringMatches.pm ++++ b/lib/Perl/Critic/Policy/RegularExpressions/ProhibitFixedStringMatches.pm +@@ -82,6 +82,8 @@ __END__ + + =pod + ++=for stopwords regexp ++ + =head1 NAME + + Perl::Critic::Policy::RegularExpressions::ProhibitFixedStringMatches - Use C or hash instead of fixed-pattern regexps. +diff --git a/lib/Perl/Critic/Policy/RegularExpressions/ProhibitSingleCharAlternation.pm b/lib/Perl/Critic/Policy/RegularExpressions/ProhibitSingleCharAlternation.pm +index e1d8ee51..6bc416d7 100644 +--- a/lib/Perl/Critic/Policy/RegularExpressions/ProhibitSingleCharAlternation.pm ++++ b/lib/Perl/Critic/Policy/RegularExpressions/ProhibitSingleCharAlternation.pm +@@ -82,6 +82,8 @@ __END__ + + =pod + ++=for stopwords regexp ++ + =head1 NAME + + Perl::Critic::Policy::RegularExpressions::ProhibitSingleCharAlternation - Use C<[abc]> instead of C. +diff --git a/lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusedCapture.pm b/lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusedCapture.pm +index 5cecad63..4a357ebd 100644 +--- a/lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusedCapture.pm ++++ b/lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusedCapture.pm +@@ -715,7 +715,7 @@ __END__ + + =pod + +-=for stopwords refactored ++=for stopwords refactored regexp + + =head1 NAME + +diff --git a/lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusualDelimiters.pm b/lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusualDelimiters.pm +index cfdce6be..a69e064c 100644 +--- a/lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusualDelimiters.pm ++++ b/lib/Perl/Critic/Policy/RegularExpressions/ProhibitUnusualDelimiters.pm +@@ -77,6 +77,8 @@ __END__ + + =pod + ++=for stopwords regexp ++ + =head1 NAME + + Perl::Critic::Policy::RegularExpressions::ProhibitUnusualDelimiters - Use only C or C<{}> to delimit regexps. +diff --git a/lib/Perl/Critic/Policy/RegularExpressions/RequireBracesForMultiline.pm b/lib/Perl/Critic/Policy/RegularExpressions/RequireBracesForMultiline.pm +index c3a063ca..ac8344f3 100644 +--- a/lib/Perl/Critic/Policy/RegularExpressions/RequireBracesForMultiline.pm ++++ b/lib/Perl/Critic/Policy/RegularExpressions/RequireBracesForMultiline.pm +@@ -77,6 +77,8 @@ __END__ + + =pod + ++=for stopwords regexp ++ + =head1 NAME + + Perl::Critic::Policy::RegularExpressions::RequireBracesForMultiline - Use C<{> and C<}> to delimit multi-line regexps. +diff --git a/lib/Perl/Critic/Policy/Variables/ProhibitPunctuationVars.pm b/lib/Perl/Critic/Policy/Variables/ProhibitPunctuationVars.pm +index f136daf8..953ddd6c 100644 +--- a/lib/Perl/Critic/Policy/Variables/ProhibitPunctuationVars.pm ++++ b/lib/Perl/Critic/Policy/Variables/ProhibitPunctuationVars.pm +@@ -367,6 +367,8 @@ __END__ + + =pod + ++=for stopwords regexp ++ + =head1 NAME + + Perl::Critic::Policy::Variables::ProhibitPunctuationVars - Write C<$EVAL_ERROR> instead of C<$@>. +diff --git a/lib/Perl/Critic/Policy/Variables/RequireLexicalLoopIterators.pm b/lib/Perl/Critic/Policy/Variables/RequireLexicalLoopIterators.pm +index 6c3b0842..3be56443 100644 +--- a/lib/Perl/Critic/Policy/Variables/RequireLexicalLoopIterators.pm ++++ b/lib/Perl/Critic/Policy/Variables/RequireLexicalLoopIterators.pm +@@ -66,7 +66,7 @@ __END__ + + =pod + +-=for stopwords foreach perlsyn ++=for stopwords foreach perl5004delta perlsyn + + =head1 NAME + +diff --git a/lib/Perl/Critic/Utils.pm b/lib/Perl/Critic/Utils.pm +index 43833170..ef023c82 100644 +--- a/lib/Perl/Critic/Utils.pm ++++ b/lib/Perl/Critic/Utils.pm +@@ -1397,6 +1397,8 @@ __END__ + + =pod + ++=for stopwords foo ++ + =head1 NAME + + Perl::Critic::Utils - General utility subroutines and constants for Perl::Critic and derivative distributions. +diff --git a/lib/Perl/Critic/Utils/PPI.pm b/lib/Perl/Critic/Utils/PPI.pm +index 5700d3f4..aeb31cf4 100644 +--- a/lib/Perl/Critic/Utils/PPI.pm ++++ b/lib/Perl/Critic/Utils/PPI.pm +@@ -235,7 +235,7 @@ __END__ + + =pod + +-=for stopwords ++=for stopwords FOO + + =head1 NAME + +diff --git a/t/20_policy_pod_spelling.t b/t/20_policy_pod_spelling.t +index 3d97d80c..a3bbf72c 100644 +--- a/t/20_policy_pod_spelling.t ++++ b/t/20_policy_pod_spelling.t +@@ -58,10 +58,10 @@ $code = <<'END_PERL'; + =cut + END_PERL + +-# Sorry about the double negative. The idea is that if aspell fails (say, ++# Sorry about the double negative. The idea is that if hunspell fails (say, + # because it can not find the right dictionary) or pcritique returns a + # non-zero number we want to skip. We have to negate the eval to catch the +-# aspell failure, and then negate pcritique because we negated the eval. ++# hunspell failure, and then negate pcritique because we negated the eval. + # Clearer code welcome. + if ( ! eval { ! pcritique($policy, \$code) } ) { + skip 'Test environment is not English', $NUMBER_OF_TESTS; +diff --git a/xt/40_perlcriticrc-code b/xt/40_perlcriticrc-code +index c63df2ca..b0df69f9 100644 +--- a/xt/40_perlcriticrc-code ++++ b/xt/40_perlcriticrc-code +@@ -17,7 +17,7 @@ strict = 1 + [-CodeLayout::RequireTidyCode] + + [Documentation::PodSpelling] +-spell_command = aspell list -l en_US ++spell_command = hunspell -l -d en_US + stop_words_file = xt/40_stop_words + + [Documentation::RequirePodSections] +-- +2.30.2 + diff --git a/Perl-Critic-1.136-ppidump-shellbang.patch b/Perl-Critic-1.136-ppidump-shellbang.patch new file mode 100644 index 0000000..1975bde --- /dev/null +++ b/Perl-Critic-1.136-ppidump-shellbang.patch @@ -0,0 +1,8 @@ +--- tools/ppidump ++++ tools/ppidump +@@ -1,4 +1,4 @@ +-#!/usr/bin/env perl ++#!/usr/bin/perl + + use strict; + use warnings; diff --git a/Perl-Critic-1.140.tar.gz b/Perl-Critic-1.140.tar.gz new file mode 100644 index 0000000..5a736a5 Binary files /dev/null and b/Perl-Critic-1.140.tar.gz differ diff --git a/perl-Perl-Critic.spec b/perl-Perl-Critic.spec new file mode 100644 index 0000000..9c81722 --- /dev/null +++ b/perl-Perl-Critic.spec @@ -0,0 +1,156 @@ +%bcond_with perl_Perl_Critic_enables_extra_test + +Name: perl-Perl-Critic +Version: 1.140 +Release: 1 +Summary: Critique Perl source code for best-practices +License: GPL+ or Artistic +URL: https://metacpan.org/release/Perl-Critic +Source0: https://cpan.metacpan.org/modules/by-module/Perl/Perl-Critic-%{version}.tar.gz +Patch0: 0001-Change-default-spell-check-tool-from-aspell-to-hunsp.patch +Patch3: Perl-Critic-1.136-ppidump-shellbang.patch +BuildArch: noarch + +# Build process +BuildRequires: coreutils +BuildRequires: findutils +BuildRequires: perl-generators +BuildRequires: perl-interpreter +BuildRequires: perl(lib) +BuildRequires: perl(Module::Build) >= 0.42 +BuildRequires: perl(Task::Weaken) +# Module requirements +BuildRequires: hunspell >= 1.2.12 +BuildRequires: hunspell-en +BuildRequires: perl(B::Keywords) >= 1.05 +BuildRequires: perl(base) +BuildRequires: perl(Carp) +BuildRequires: perl(Config::Tiny) >= 2 +BuildRequires: perl(English) +BuildRequires: perl(Exception::Class) >= 1.23 +BuildRequires: perl(Exporter) >= 5.58 +BuildRequires: perl(File::Find) +BuildRequires: perl(File::Path) +BuildRequires: perl(File::Spec) +BuildRequires: perl(File::Spec::Unix) +BuildRequires: perl(File::Temp) +BuildRequires: perl(File::Which) +BuildRequires: perl(Getopt::Long) +BuildRequires: perl(IO::String) +BuildRequires: perl(List::MoreUtils) >= 0.19 +BuildRequires: perl(List::Util) +BuildRequires: perl(Module::Pluggable) >= 3.1 +BuildRequires: perl(Perl::Tidy) +BuildRequires: perl(Pod::Parser) +BuildRequires: perl(Pod::PlainText) +BuildRequires: perl(Pod::Select) +BuildRequires: perl(Pod::Spell) >= 1 +BuildRequires: perl(Pod::Usage) +BuildRequires: perl(PPI) >= 1.265 +BuildRequires: perl(PPIx::QuoteLike) +BuildRequires: perl(PPIx::Regexp) >= 0.010 +BuildRequires: perl(PPIx::Regexp::Util) >= 0.068 +BuildRequires: perl(PPIx::Utilities::Node) +BuildRequires: perl(PPIx::Utilities::Statement) >= 1.001 +BuildRequires: perl(Readonly) >= 2 +BuildRequires: perl(Scalar::Util) +BuildRequires: perl(strict) +BuildRequires: perl(String::Format) >= 1.18 +BuildRequires: perl(Term::ANSIColor) >= 2.02 +BuildRequires: perl(Test::Builder) >= 0.92 +BuildRequires: perl(Text::ParseWords) >= 3 +BuildRequires: perl(version) >= 0.77 +BuildRequires: perl(warnings) +# Main test suite +BuildRequires: glibc-langpack-en +BuildRequires: perl(Fatal) +BuildRequires: perl(File::Spec::Functions) +BuildRequires: perl(Test::Deep) +BuildRequires: perl(Test::Memory::Cycle) +BuildRequires: perl(Test::More) +# Optional test suite +%if %{with perl_Perl_Critic_enables_extra_test} +BuildRequires: perl(Devel::EnforceEncapsulation) +BuildRequires: perl(Perl::Critic::Policy::Editor::RequireEmacsFileVariables) +BuildRequires: perl(Perl::Critic::Policy::ErrorHandling::RequireUseOfExceptions) +BuildRequires: perl(Perl::Critic::Policy::Miscellanea::RequireRcsKeywords) +BuildRequires: perl(Test::Kwalitee) >= 1.15 +BuildRequires: perl(Test::Perl::Critic) +BuildRequires: perl(Test::Pod) >= 1.00 +BuildRequires: perl(Test::Pod::Coverage) >= 1.04 +BuildRequires: perl(Test::Without::Module) +%endif + +# Optional/not automatically detected runtime dependencies +Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) +Requires: hunspell >= 1.2.12 +Requires: perl(File::Which) +Requires: perl(Module::Pluggable) >= 3.1 +Requires: perl(Pod::Parser) +Requires: perl(PPI) >= 1.265 +Requires: perl(Term::ANSIColor) >= 2.02 + +%description +Perl::Critic is an extensible framework for creating and applying coding +standards to Perl source code. Essentially, it is a static source code +analysis engine. Perl::Critic is distributed with a number of +Perl::Critic::Policy modules that attempt to enforce various coding +guidelines. Most Policy modules are based on Damian Conway's book Perl +Best Practices. However, Perl::Critic is not limited to PBP and will +even support Policies that contradict Conway. You can enable, disable, +and customize those Polices through the Perl::Critic interface. You can +also create new Policy modules that suit your own tastes. + +%package -n perl-Test-Perl-Critic-Policy +Summary: A framework for testing your custom Policies +License: GPL+ or Artistic +Requires: perl(Test::Builder) >= 0.92 + +%description -n perl-Test-Perl-Critic-Policy +This module provides a framework for function-testing your custom +Perl::Critic::Policy modules. Policy testing usually involves feeding it a +string of Perl code and checking its behavior. In the old days, those strings +of Perl code were mixed directly in the test script. That sucked. + +%prep +%setup -q -n Perl-Critic-%{version} + +# Switch spell checker tool from aspell to hunspell +%patch0 -p1 + +# Fix shellbang in ppidump tool +%patch3 + +# Drop exec bits from samples/docs to avoid dependency bloat +find tools examples -type f -exec chmod -c -x {} ';' + +%build +perl Build.PL --installdirs=vendor +./Build + +%install +./Build install --destdir=%{buildroot} --create_packlist=0 +%{_fixperms} -c %{buildroot} + +%check +%if %{with perl_Perl_Critic_enables_extra_test} +LC_ALL=en_US ./Build authortest +%else +LC_ALL=en_US ./Build test +%endif + +%files +%license LICENSE +%doc Changes CONTRIBUTING.md README TODO.pod examples/ extras/ tools/ +%{_bindir}/perlcritic +%{perl_vendorlib}/Perl/ +%{_mandir}/man1/perlcritic.1* +%{_mandir}/man3/Perl::Critic*.3* + +%files -n perl-Test-Perl-Critic-Policy +%{perl_vendorlib}/Test/ +%{_mandir}/man3/Test::Perl::Critic::Policy.3* + +%changelog +* Wed Jul 06 2022 misaka00251 - 1.140-1 +- Init package (Thanks to fedora team)