Add workaround for 'Subroutine name is a homonym for builtin function isa'

https://github.com/Perl-Critic/Perl-Critic/issues/911
https://bugzilla.redhat.com/show_bug.cgi?id=1852437
This commit is contained in:
Paul Howarth 2020-07-11 18:26:45 +01:00
parent f8318c9cce
commit 9008da0245
2 changed files with 31 additions and 1 deletions

View File

@ -0,0 +1,20 @@
This is a workaround for https://github.com/Perl-Critic/Perl-Critic/issues/911
This workaround causes no change in behaviour, but a long-term fix may include
making "isa" a special case like import, AUTOLOAD, and DESTROY, which are
commonly overridden. That would be a behaviour change.
The "## no critic" pragma wouldn't be needed prior to Perl 5.32, hence the
additional reference to Miscellanea::ProhibitUselessNoCritic.
--- lib/Perl/Critic/Document.pm
+++ lib/Perl/Critic/Document.pm
@@ -137,7 +137,7 @@ sub ppi_document {
#-----------------------------------------------------------------------------
-sub isa {
+sub isa { ## no critic (Subroutines::ProhibitBuiltinHomonyms, Miscellanea::ProhibitUselessNoCritic)
my ($self, @args) = @_;
return $self->SUPER::isa(@args)
|| ( (ref $self) && $self->{_doc} && $self->{_doc}->isa(@args) );

View File

@ -7,13 +7,14 @@
Name: perl-Perl-Critic
Version: 1.138
Release: 4%{?dist}
Release: 5%{?dist}
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
Patch4: Perl-Critic-1.138-gh911.patch
BuildArch: noarch
# Build process
@ -132,6 +133,11 @@ of Perl code were mixed directly in the test script. That sucked.
# Fix shellbang in ppidump tool
%patch3
# Workaround for 'Subroutine name is a homonym for builtin function isa'
# https://github.com/Perl-Critic/Perl-Critic/issues/911
# https://bugzilla.redhat.com/show_bug.cgi?id=1852437
%patch4
# Drop exec bits from samples/docs to avoid dependency bloat
find tools examples -type f -exec chmod -c -x {} ';'
@ -167,6 +173,10 @@ LC_ALL=en_US ./Build test
%{_mandir}/man3/Test::Perl::Critic::Policy.3*
%changelog
* Sat Jul 11 2020 Paul Howarth <paul@city-fan.org> - 1.138-5
- Add workaround for 'Subroutine name is a homonym for builtin function isa'
(#1852437, GH#911)
* Fri Jun 26 2020 Jitka Plesnikova <jplesnik@redhat.com> - 1.138-4
- Perl 5.32 re-rebuild of bootstrapped packages