perl-critic

Critiquing PHP-code / PerlCritic for PHP?

做~自己de王妃 提交于 2019-12-06 08:13:49
问题 I'm looking for an equivalent of PerlCritic for PHP. PerlCritc is a static source code analyzer that qritiques code and warns about everything from unused variables, to unsafe ways to handle data to almost anything. Is there such a thing for PHP that could (preferably) be run outside of an IDE, so that source code analysis could be automated? 回答1: Not sure I've ever heard about a PHP tool that would do all that... But a couple of existing QA-related tools, that might help you at least a bit,

Perlcritic - Two argument “open” error

久未见 提交于 2019-12-05 11:44:11
I have a script and I am trying to elimate bad practices using perlcritic. One line I have is as follows: open(my($FREESPCHK), $cmdline ) || &zdie($MSG_PASSTHRU,"Error checking free space of file system."); This gives this error: Two-argument "open" used at line xxx, column x. See page 207 of PBP. (Severity: 5) Any ideas on how to fix it? Tudor Constantin To make Perl Critic shut up, but do no real good at all, just modify the code to: open(my $PIPE_FROM_FREESPCHK, "-|", $cmdline) || zdie($MSG_PASSTHRU, "Error checking free space of file system."); Note however that this is absolutely no

Perl::Critic: Life after Moose?

若如初见. 提交于 2019-12-04 17:06:35
问题 I've started a conversion of a project to Moose and the first thing I noticed was that my critic/tidy tests go to hell. Moose, Tidy and Critic don't seem to like each other as much as they used to. Are there docs anywhere on how to make critic/tidy be more appreciative of the Moose dialect? What do most Moose users do? Relax/ditch critic for the more heavy Moose modules? Custom policies? 回答1: Have you seen Perl::Critic::Moose? 回答2: Both of them can be configured into detail. I have no idea

How do I make Perl::Critic show the offending policy in its output?

有些话、适合烂在心里 提交于 2019-12-04 13:50:46
I've been told it's possible to have Perl::Critic show the policy name that is offending in its output. But I can't recall what I have to do to turn this on. How can this be enabled in a perlcritic.rc ? The --verbose command-line option can control this-- if you don't want to specify your own format, try the values 8 or 9 . Both of these built-in formats contain the policy name. If you like one of them, you can add this line to your .perlcriticrc : verbose = 8 (Or 9, if you prefer that format.) Randy verbose = %f line %l col %c\n [%s] %p (%e) = %m\n %r\n Season to taste. You're after %p or

Critiquing PHP-code / PerlCritic for PHP?

只谈情不闲聊 提交于 2019-12-04 13:11:38
I'm looking for an equivalent of PerlCritic for PHP. PerlCritc is a static source code analyzer that qritiques code and warns about everything from unused variables, to unsafe ways to handle data to almost anything. Is there such a thing for PHP that could (preferably) be run outside of an IDE, so that source code analysis could be automated? Not sure I've ever heard about a PHP tool that would do all that... But a couple of existing QA-related tools, that might help you at least a bit, would be : PHPMD - PHP Mess Detector -- might actually be the best choice for you, if you consider the set

Is there a better way to write Perl regexes with /x so the code is still easy to read?

送分小仙女□ 提交于 2019-12-04 03:46:49
I ran Perl::Critic on one of my scripts, and got this message: Regular expression without "/x" flag at line 21, column 26. See page 236 of PBP. I looked up the policy information here , and I understand that writing regular expressions in extended mode will help anyone who is looking at the code. However, I am stuck as how to convert my code to use the /x flag. CPAN Example: # Match a single-quoted string efficiently... m{'[^\\']*(?:\\.[^\\']*)*'}; #Huh? # Same thing with extended format... m{ ' # an opening single quote [^\\'] # any non-special chars (i.e. not backslash or single quote) (?: #

Perl::Critic: Life after Moose?

為{幸葍}努か 提交于 2019-12-03 10:00:19
I've started a conversion of a project to Moose and the first thing I noticed was that my critic/tidy tests go to hell. Moose, Tidy and Critic don't seem to like each other as much as they used to. Are there docs anywhere on how to make critic/tidy be more appreciative of the Moose dialect? What do most Moose users do? Relax/ditch critic for the more heavy Moose modules? Custom policies? Have you seen Perl::Critic::Moose ? Both of them can be configured into detail. I have no idea why perltidy wouldn't like it, it has nothing to do with it . Perltidy only governs style. You can change the

Are there any good automated frameworks for applying coding standards in Perl?

谁说胖子不能爱 提交于 2019-11-30 19:08:47
One I am aware of is Perl::Critic And my googling has resulted in no results on multiple attempts so far. :-( Does anyone have any recommendations here? Any resources to configure Perl::Critic as per our coding standards and run it on code base would be appreciated. In terms of setting up a profile, have you tried perlcritic --profile-proto ? This will emit to stdout all of your installed policies with all their options with descriptions of both, including their default values, in perlcriticrc format. Save and edit to match what you want. Whenever you upgrade Perl::Critic, you may want to run

Are there any good automated frameworks for applying coding standards in Perl?

匆匆过客 提交于 2019-11-30 03:37:46
问题 One I am aware of is Perl::Critic And my googling has resulted in no results on multiple attempts so far. :-( Does anyone have any recommendations here? Any resources to configure Perl::Critic as per our coding standards and run it on code base would be appreciated. 回答1: In terms of setting up a profile, have you tried perlcritic --profile-proto ? This will emit to stdout all of your installed policies with all their options with descriptions of both, including their default values, in