Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: perlcritic and heredocs

by redtux (Sexton)
on Apr 15, 2020 at 13:09 UTC ( [id://11115567]=note: print w/replies, xml ) Need Help??


in reply to Re: perlcritic and heredocs
in thread perlcritic and heredocs

(my $lintags_inssql = <<~'SQLSTR') =~s/(?:^\t*|\n)/ /gmx; INSERT INTO linktags (filesrc, metadir, tagname, tagvalue, symlink +, filesref, dirtype,status) SELECT a.filesrc, a.metadir, tagname, tagvalue, ## This is line 4486 ## metadir||'/'||tagname||$1||tagvalue||$1 +||filenameparts[1]||'_'||array_to_string(linka[linkano-2:linkano-1] ## line 4486 ## ,'_')||filenameparts[2] symlink ,filesref,dirtype,'new' FROM (SELECT DISTINCT l.filesrc, c.metadir||'/0_meta' metadir, tag +name, tagvalue ,string_to_array(filesrc,$1)linka, cardinality(string_to_array(filesrc,$1)) linkano, regexp_matches(filesrc,'.*/(.*)(\..*)') filenameparts, filesref, dirtype FROM public.linktags l JOIN chkmeta c ON l.filesrc LIKE c.metadir||'%' WHERE (st +atus='new') ) a ON CONFLICT(symlink) DO UPDATE SET dirtype=EXCLUDED.dirtype SQLSTR

perlcritic error

Hard tabs used at line 4486, column 64. See page 20 of PBP. (Severity: 3)
Literal line breaks in a string at line 4486, column 64. See pages 60,61 of PBP.
(Severity: 3)

perlcritic cmd

sudo perlcritic --force -1 /usr/bin/use_videotagspg|grep -i -B2 'hard tabs'

.perlcriticrc

[TestingAndDebugging::ProhibitNoStrict] allow = refs

Replies are listed 'Best First'.
Re^3: perlcritic and heredocs
by choroba (Cardinal) on Apr 15, 2020 at 14:14 UTC
    I downloaded the code, removed the ## comments, included the standard boilerplate for scripts (shebang, strictures, warnings) and run freshly installed perlcritic on it:
    $ perlcritic --force -1 1.pl Code is not tidy at line 1, column 1. See page 33 of PBP. (Severity: + 1) No package-scoped "$VERSION" variable found at line 1, column 1. See +page 404 of PBP. (Severity: 2) Regular expression without "/s" flag at line 6, column 38. See pages +240,241 of PBP. (Severity: 2)

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

      Very tangentially related but: perl (and perlcritic) will honour cpp-style #line filename linenumber directives so you can embed those in disjoint snippets to get line numbers to line up (as it were) with the original full source.

      Update: additionally I get the same output (perlcritic 1.138, perl 5.30.2) albeit with the regex error reported at line 4483 since I diddled in #line 4483 before the first line of code after similar shebang/strict/warnings.

      The cake is a lie.
      The cake is a lie.
      The cake is a lie.

Re^3: perlcritic and heredocs
by haukex (Archbishop) on Apr 15, 2020 at 15:24 UTC

    Like choroba, I also can't reproduce those two policy warnings here either, with versions 1.134 and the latest 1.138. What version of Perl::Critic do you have installed? (perlcritic --version) And do you perhaps have any other Perl::Critic::* add-ons installed?

      1.132 (rpm for fedora 30),Nothing else installed
        1.132 (rpm for fedora 30)

        Support for indented heredocs, like you're using, was added in release 1.134. The best course of action (IMHO) is to upgrade.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11115567]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-26 07:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found