pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
To: Noah Misch <noah@leadboat.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: cleaning perl code
Date: Tue, 14 Apr 2020 11:57:01 -0400
Message-ID: <bac7198f-0b2a-8e93-72b7-8b338636aa1f@2ndQuadrant.com> (raw)
In-Reply-To: <44c13be6-d7a4-dcd3-cff0-c997e8835e5f@2ndQuadrant.com>
References: <e56f6fb6-38d5-8450-577c-24eb5d63f2e1@2ndQuadrant.com>
	<20200411043014.GA590991@rfd.leadboat.com>
	<0a4406d5-b428-4831-8ed9-c36764360f57@2ndQuadrant.com>
	<20200412074245.GB623763@rfd.leadboat.com>
	<44c13be6-d7a4-dcd3-cff0-c997e8835e5f@2ndQuadrant.com>


On 4/13/20 12:47 PM, Andrew Dunstan wrote:
>
> OK, I've committed all that stuff. I think that takes care of the
> non-controversial part of what I proposed :-)
>
>

OK, it seems there is a majority of people commenting in this thread in
favor of not doing more except to reverse the policy of requiring
subroutine returns. I'll do that shortly. In the spirit of David
Steele's contribution, here is a snippet that when added to the
perlcriticrc would allow us to pass at the "brutal" setting (severity
1). But I'm not proposing to add this, it's just here so anyone
interested can see what's involved.

One of the things that's a bit sad is that perlcritic doesn't generally
let you apply policies to a given set of files or files matching some
pattern. It would be nice, for instance, to be able to apply some
additional standards to strategic library files like PostgresNode.pm,
TestLib.pm and Catalog.pm. There are good reasons as suggested upthread
to apply higher standards to library files than to, say, a TAP test
script. The only easy way I can see to do that would be to have two
different perlcriticrc files and adjust pgperlcritic to make two runs.
If people think that's worth it I'll put a little work into it. If not,
I'll just leave things here.


cheers


andrew


-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

perlcritic-brutal (text/plain, 5.4K) download # severity 4 [-BuiltinFunctions::RequireBlockGrep] # 9 occurrences [-BuiltinFunctions::RequireBlockMap] # 1 occurrences [-InputOutput::ProhibitReadlineInForLoop] # 2 occurrences [-InputOutput::RequireBriefOpen] # 83 occurrences [-Modules::ProhibitAutomaticExportation] # 7 occurrences [-Modules::ProhibitMultiplePackages] # 9 occurrences [-Objects::ProhibitIndirectSyntax] # 12 occurrences [-Subroutines::RequireArgUnpacking] # 39 occurrences [-TestingAndDebugging::ProhibitNoWarnings] # 6 occurrences [-TestingAndDebugging::ProhibitProlongedStrictureOverride] # 2 occurrences [-ValuesAndExpressions::ProhibitCommaSeparatedStatements] # 4 occurrences [-ValuesAndExpressions::ProhibitConstantPragma] # 2 occurrences [-ValuesAndExpressions::ProhibitMixedBooleanOperators] # 2 occurrences [-Variables::RequireLocalizedPunctuationVars] # 72 occurrences # severity 3 [-BuiltinFunctions::ProhibitComplexMappings] # 2 occurrences [-BuiltinFunctions::ProhibitLvalueSubstr] # 1 occurrences [-BuiltinFunctions::ProhibitVoidMap] # 1 occurrences [-BuiltinFunctions::RequireSimpleSortBlock] # 1 occurrences [-ClassHierarchies::ProhibitExplicitISA] # 10 occurrences [-CodeLayout::ProhibitHardTabs] # 172 occurrences [-ControlStructures::ProhibitCascadingIfElse] # 15 occurrences [-ControlStructures::ProhibitDeepNests] # 1 occurrences [-ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions] # 5 occurrences [-ErrorHandling::RequireCarping] # 284 occurrences [-ErrorHandling::RequireCheckingReturnValueOfEval] # 11 occurrences [-InputOutput::ProhibitBacktickOperators] # 13 occurrences [-InputOutput::ProhibitJoinedReadline] # 1 occurrences [-InputOutput::RequireCheckedOpen] # 24 occurrences [-Miscellanea::ProhibitUnrestrictedNoCritic] # 12 occurrences [-Modules::ProhibitConditionalUseStatements] # 1 occurrences [-Modules::ProhibitExcessMainComplexity] # 15 occurrences [-NamingConventions::ProhibitAmbiguousNames] # 3 occurrences [-RegularExpressions::ProhibitCaptureWithoutTest] # 30 occurrences [-RegularExpressions::ProhibitComplexRegexes] # 267 occurrences [-RegularExpressions::ProhibitUnusedCapture] # 11 occurrences [-RegularExpressions::RequireExtendedFormatting] # 1048 occurrences [-Subroutines::ProhibitExcessComplexity] # 13 occurrences [-Subroutines::ProhibitManyArgs] # 9 occurrences [-Subroutines::ProhibitUnusedPrivateSubroutines] # 3 occurrences [-TestingAndDebugging::RequireTestLabels] # 4 occurrences [-ValuesAndExpressions::ProhibitImplicitNewlines] # 312 occurrences [-ValuesAndExpressions::ProhibitMismatchedOperators] # 11 occurrences [-ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters] # 2 occurrences [-ValuesAndExpressions::ProhibitVersionStrings] # 1 occurrences [-ValuesAndExpressions::RequireQuotedHeredocTerminator] # 98 occurrences [-Variables::ProhibitPackageVars] # 79 occurrences [-Variables::ProhibitReusedNames] # 14 occurrences [-Variables::ProhibitUnusedVariables] # 8 occurrences [-Variables::RequireInitializationForLocalVars] # 3 occurrences # severity 2 [-BuiltinFunctions::ProhibitBooleanGrep] # 14 occurrences [-BuiltinFunctions::ProhibitStringySplit] # 8 occurrences [-BuiltinFunctions::ProhibitUselessTopic] # 4 occurrences [-CodeLayout::ProhibitQuotedWordLists] # 13 occurrences [-ControlStructures::ProhibitCStyleForLoops] # 26 occurrences [-ControlStructures::ProhibitPostfixControls] # 325 occurrences [-ControlStructures::ProhibitUnlessBlocks] # 12 occurrences [-Documentation::RequirePodSections] # 51 occurrences [-InputOutput::RequireCheckedClose] # 140 occurrences [-Miscellanea::ProhibitTies] # 3 occurrences [-Miscellanea::ProhibitUselessNoCritic] # 2 occurrences [-Modules::RequireVersionVar] # 180 occurrences [-References::ProhibitDoubleSigils] # 85 occurrences [-RegularExpressions::ProhibitFixedStringMatches] # 33 occurrences [-RegularExpressions::ProhibitUselessTopic] # 4 occurrences [-RegularExpressions::RequireDotMatchAnything] # 1327 occurrences [-RegularExpressions::RequireLineBoundaryMatching] # 1074 occurrences [-Subroutines::ProhibitAmpersandSigils] # 13 occurrences [-ValuesAndExpressions::ProhibitEmptyQuotes] # 267 occurrences [-ValuesAndExpressions::ProhibitEscapedCharacters] # 9 occurrences [-ValuesAndExpressions::ProhibitMagicNumbers] # 331 occurrences [-ValuesAndExpressions::ProhibitNoisyQuotes] # 170 occurrences [-ValuesAndExpressions::RequireNumberSeparators] # 60 occurrences [-Variables::ProhibitPunctuationVars] # 257 occurrences # severity 1 [-BuiltinFunctions::ProhibitReverseSortBlock] # 1 occurrences [-CodeLayout::ProhibitParensWithBuiltins] # 568 occurrences [-CodeLayout::ProhibitTrailingWhitespace] # 1 occurrences [-CodeLayout::RequireTidyCode] # 173 occurrences [-CodeLayout::RequireTrailingCommas] # 32 occurrences [-Documentation::PodSpelling] # 4 occurrences [-Documentation::RequirePodAtEnd] # 5 occurrences [-InputOutput::RequireBracedFileHandleWithPrint] # 352 occurrences [-InputOutput::RequireCheckedSyscalls] # 688 occurrences [-NamingConventions::Capitalization] # 122 occurrences [-RegularExpressions::ProhibitEnumeratedClasses] # 33 occurrences [-RegularExpressions::ProhibitEscapedMetacharacters] # 237 occurrences [-RegularExpressions::ProhibitSingleCharAlternation] # 3 occurrences [-RegularExpressions::ProhibitUnusualDelimiters] # 71 occurrences [-RegularExpressions::RequireBracesForMultiline] # 165 occurrences [-ValuesAndExpressions::ProhibitInterpolationOfLiterals] # 1951 occurrences [-ValuesAndExpressions::RequireInterpolationOfMetachars] # 79 occurrences

view thread (34+ messages)  latest in thread

Message-ID: <bac7198f-0b2a-8e93-72b7-8b338636aa1f@2ndQuadrant.com>
Permalink:  ../bac7198f-0b2a-8e93-72b7-8b338636aa1f@2ndQuadrant.com/
Also on:    postgresql.org/message-id/bac7198f-0b2a-8e93-72b7-8b338636aa1f@2ndQuadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: andrew.dunstan@2ndquadrant.com, noah@leadboat.com
  Subject: Re: cleaning perl code
  In-Reply-To: <bac7198f-0b2a-8e93-72b7-8b338636aa1f@2ndQuadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox