From 0cab41862684eb040978fcf475f84086f9bf40d8 Mon Sep 17 00:00:00 2001 From: Brad Clawsie Date: Mon, 16 Jan 2023 16:19:17 -0600 Subject: [PATCH] critic --- .perlcritic | 37 +++++++++++++++++++++++-------------- lib/Lang/Go/Mod.pm | 14 +++++++------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/.perlcritic b/.perlcritic index 682365f..29c528a 100644 --- a/.perlcritic +++ b/.perlcritic @@ -1,28 +1,37 @@ severity = 1 +[-RegularExpressions::RequireLineBoundaryMatching] [-RegularExpressions::RequireDotMatchAnything] -[ControlStructures::ProhibitPostfixControls] -allow = for if unless +[-Community::PreferredAlternatives] +[-Community::DiscouragedModules] +[-Freenode::PreferredAlternatives] +[-Freenode::DiscouragedModules] [-CodeLayout::RequireTidyCode] -[ValuesAndExpressions::RequireInterpolationOfMetachars] -[ValuesAndExpressions::ProhibitLongChainsOfMethodCalls] -[Subroutines::ProhibitBuiltinHomonyms] +[-Subroutines::RequireFinalReturn] +[-Subroutines::ProhibitBuiltinHomonyms] [-Subroutines::ProhibitSubroutinePrototypes] -[ValuesAndExpressions::ProhibitMagicNumbers] -allowed_values = -1000..1000 -[NamingConventions::ProhibitAmbiguousNames] -forbid = abstract bases close contract last left no record right second -[Subroutines::ProhibitUnusedPrivateSubroutines] -allow = _update_status -[Subroutines::ProhibitManyArgs] +[-Subroutines::ProhibitExplicitReturnUndef] +[-Subroutines::ProhibitCallsToUndeclaredSubs] +[-Subroutines::ProhibitCallsToUnexportedSubs] [-Documentation::RequirePodSections] [-Compatibility::PodMinimumVersion] [-TooMuchCode::ProhibitDuplicateLiteral] [-ControlStructures::ProhibitUnlessBlocks] [-ControlStructures::ProhibitCascadingIfElse] +[-Modules::RequireExplicitInclusion] +[-CodeLayout::RequireFinalSemicolon] +[-Bangs::ProhibitNumberedNames] +[ControlStructures::ProhibitPostfixControls] +allow = for if unless +[ValuesAndExpressions::ProhibitMagicNumbers] +allowed_values = -1000..1000 +[NamingConventions::ProhibitAmbiguousNames] +forbid = abstract bases close contract last left no record right second [InputOutput::RequireCheckedSyscalls] functions = :builtins exclude_functions = print [Modules::ProhibitExcessMainComplexity] - max_mccabe = 40 +max_mccabe = 50 [Subroutines::ProhibitExcessComplexity] -max_mccabe = 40 +max_mccabe = 50 +[-BuiltinFunctions::ProhibitUniversalIsa] +[-CodeLayout::ProhibitParensWithBuiltins] diff --git a/lib/Lang/Go/Mod.pm b/lib/Lang/Go/Mod.pm index f873b36..ad25a25 100644 --- a/lib/Lang/Go/Mod.pm +++ b/lib/Lang/Go/Mod.pm @@ -193,18 +193,18 @@ sub _parse_retract { my $rest = $2; # trim whitespace from range - $range =~ s/\s+//g; - my @versions = split( /,/, $range ); + $range =~ s/\s+//gx; + my @versions = split( /,/x, $range ); my $count = 0; for my $version (@versions) { - return unless ( $version =~ /\S+/ox ); + return undef unless ( $version =~ /\S+/ox ); $count++; } - return if ( $count != 2 ); + return undef if ( $count != 2 ); # if there is a comment, it must be properly formatted if ( $rest =~ /\S/x ) { - return unless ( $rest =~ m|^\s+//|ox ); + return undef unless ( $rest =~ m{^\s+//}ox ); } return '[' . $range . ']'; } @@ -214,13 +214,13 @@ sub _parse_retract { # if there is a comment, it must be properly formatted if ( $rest =~ /\S/x ) { - return unless ( $rest =~ m|^\s+//|ox ); + return undef unless ( $rest =~ m{^\s+//}ox ); } return $version; } # unparseable retract string - return; + return undef; } 1; -- 2.45.2