From 20158866b283fa09dcef58e400bb438afda67938 Mon Sep 17 00:00:00 2001 From: "Jose D. Gomez R" Date: Mon, 13 Nov 2023 15:25:31 +0100 Subject: [PATCH] Add signatures to all new code --- lib/OpenQA/Test/TimeLimit.pm | 3 +-- lib/perlcritic/Perl/Critic/Policy/HashKeyQuotes.pm | 4 ++-- tools/perlcritic | 5 ++--- tools/tidyall | 4 ++-- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/OpenQA/Test/TimeLimit.pm b/lib/OpenQA/Test/TimeLimit.pm index 70e349c..ad565ad 100644 --- a/lib/OpenQA/Test/TimeLimit.pm +++ b/lib/OpenQA/Test/TimeLimit.pm @@ -6,8 +6,7 @@ use Test::Most; my $SCALE_FACTOR = $ENV{OPENQA_TEST_TIMEOUT_SCALE_FACTOR} // 1; -sub import { - my ($package, $limit) = @_; +sub import ($package, $limit, @) { die "$package: Need argument on import, e.g. use: use OpenQA::Test::TimeLimit '42';" unless $limit; # disable timeout if requested by ENV variable or running within debugger return if ($ENV{OPENQA_TEST_TIMEOUT_DISABLE} or $INC{'perl5db.pl'}); diff --git a/lib/perlcritic/Perl/Critic/Policy/HashKeyQuotes.pm b/lib/perlcritic/Perl/Critic/Policy/HashKeyQuotes.pm index 29fe0e4..ed8bf20 100644 --- a/lib/perlcritic/Perl/Critic/Policy/HashKeyQuotes.pm +++ b/lib/perlcritic/Perl/Critic/Policy/HashKeyQuotes.pm @@ -5,6 +5,7 @@ package Perl::Critic::Policy::HashKeyQuotes; use strict; use warnings; +use feature 'signatures'; use base 'Perl::Critic::Policy'; use Perl::Critic::Utils qw( :severities :classification :ppi ); @@ -17,8 +18,7 @@ sub applies_to { return qw(PPI::Token::Quote::Single PPI::Token::Quote::Double) # check that hashes are not overly using quotes # (os-autoinst coding style) -sub violates ($elem) { - +sub violates ($self, $elem, $document) { #we only want the check hash keys return if !is_hash_key($elem); diff --git a/tools/perlcritic b/tools/perlcritic index d67bc0a..9c14060 100755 --- a/tools/perlcritic +++ b/tools/perlcritic @@ -5,11 +5,10 @@ # perlcritic with auto-injection of custom perlcritic rules. use strict; use warnings; +use feature 'signatures'; use FindBin '$Bin'; -sub extra_include_paths { - my @extra_paths = @_; - +sub extra_include_paths (@extra_paths) { my @paths = (); foreach my $path (@extra_paths) { push @paths, "$Bin/../$path"; diff --git a/tools/tidyall b/tools/tidyall index ee68877..2cb0f03 100755 --- a/tools/tidyall +++ b/tools/tidyall @@ -14,7 +14,7 @@ Grabs the perltidy version from cpanfile using Module::CPANfile. =cut -sub perltidy_version { +sub perltidy_version() { my $version = Module::CPANfile->load('cpanfile') ->prereq_for_module('Perl::Tidy') ->requirement @@ -26,7 +26,7 @@ sub perltidy_version { return (split ' ', $version)[-1]; } -sub is_force_flag { $_ eq '--force' } +sub is_force_flag() { $_ eq '--force' } my $required_version = perltidy_version(); my $detected_version = $Perl::Tidy::VERSION;