wbraswell / rperl

RPerl Compiler
Other
277 stars 34 forks source link

CPAN Testers: Perl::Critic Extra Policy Failures #28

Open wbraswell opened 9 years ago

wbraswell commented 9 years ago

http://www.cpantesters.org/cpan/report/5302da84-d0c4-11e6-89d0-b4ed048701ac

Failed test 'Program or module parses without errors: blib/lib/RPerl/Test/ArrayDereference/program_00_good.pl' at t/12_parse.t line 166.

and so on...

eserte commented 7 years ago

I put a warn $@ if $@ after the eval which gives me perlcritic errors:

ERROR ECOPAPC02, RPERL PARSER, PERL CRITIC VIOLATION
Failed Perl::Critic brutal review with the following information:

    File Name:    blib/lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl
    Line number:  1
    Policy:       Perl::Critic::Policy::Documentation::RequirePod
    Description:  file requires POD
    Explanation:  Missing POD in the current file

    File Name:    blib/lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl
    Line number:  10
    Policy:       Perl::Critic::Policy::Compatibility::PerlMinimumVersionAndWhy
    Description:  _perl_5006_pragmas requires 5.006
    Explanation:

    File Name:    blib/lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl
    Line number:  11
    Policy:       Perl::Critic::Policy::Compatibility::PerlMinimumVersionAndWhy
    Description:  _any_our_variables requires 5.006
    Explanation:

    File Name:    blib/lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl
    Line number:  19
    Policy:       Perl::Critic::Policy::Compatibility::PerlMinimumVersionAndWhy
    Description:  _Pulp__for_loop_variable_using_my requires 5.004
    Explanation:

    File Name:    blib/lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl
    Line number:  19
    Policy:       Perl::Critic::Policy::Perlsecret
    Description:  Perlsecret risk. Baby Cart
    Explanation:  Perlsecret detected

ok 1 - Program or module parses with expected error(s):  blib/lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl

and so on...

wbraswell commented 7 years ago

@eserte Okay great, thanks for the debugging info! :-)

This is strange, because my perlcritic says the file "lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl" is okay on brutal:

$ perlcritic --brutal lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl source OK

Could it be perhaps that somehow your "blib/" copy of the file is changed?

Can you please run the same perlcritic --brutal command on both the "lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl" and "blib/lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl" files?

eserte commented 7 years ago

I think it fails on my smoker because I have more perlcritic policies installed, e.g. https://metacpan.org/release/Perl-Critic-Policy-Perlsecret

eserte commented 7 years ago
$ /opt/perl-5.18.2/bin/perlcritic --brutal lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl
lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl: file requires POD at line 1, column 1.  Missing POD in the current file.  (Severity: 2)
lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl: _perl_5006_pragmas requires 5.006 at line 10, column 1.  (no explanation).  (Severity: 2)
lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl: _any_our_variables requires 5.006 at line 11, column 1.  (no explanation).  (Severity: 2)
lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl: _Pulp__for_loop_variable_using_my requires 5.004 at line 19, column 1.  (no explanation).  (Severity: 2)
lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl: Perlsecret risk. Baby Cart  at line 19, column 25.  Perlsecret detected.  (Severity: 5)
lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl: file requires POD at line 1, column 1.  Missing POD in the current file.  (Severity: 2)
lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl: _perl_5006_pragmas requires 5.006 at line 10, column 1.  (no explanation).  (Severity: 2)
lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl: _any_our_variables requires 5.006 at line 11, column 1.  (no explanation).  (Severity: 2)
lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl: _Pulp__for_loop_variable_using_my requires 5.004 at line 19, column 1.  (no explanation).  (Severity: 2)
lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl: Perlsecret risk. Baby Cart  at line 19, column 25.  Perlsecret detected.  (Severity: 5)
wbraswell commented 7 years ago

@eserte Okay yes I think it is because of your extra perlcritic policies, how can I fix this in RPerl so that it disables all extra policies?

eserte commented 7 years ago

Well, I never use perlcritic myself. The manpage suggests to use the --theme option like this:

$ /opt/perl-5.18.2/bin/perlcritic --theme core --brutal blib/lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl; echo $?
file requires POD at line 1, column 1.  Missing POD in the current file.  (Severity: 2)
2

Better, but still one violation.

wbraswell commented 7 years ago

@eserte The RequirePod policy is also not part of the core Perl::Critic distribution: https://metacpan.org/pod/Perl::Critic::Policy::Documentation::RequirePod vs https://metacpan.org/pod/Perl::Critic So apparently --theme core did not actually disable all non-core policies?

wbraswell commented 7 years ago

I believe this is a bug in Perl::Critic, I have filed an issue here: https://github.com/Perl-Critic/Perl-Critic/issues/712

Please try it again with this as a temporary work-around: perlcritic --theme core --brutal --exclude=RequirePod blib/lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl; echo $?

eserte commented 7 years ago

Now it's OK, as expected:

$ /opt/perl-5.18.2/bin/perlcritic --theme core --brutal --exclude=RequirePod blib/lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl; echo $?  
blib/lib/RPerl/Test/ArrayDereference/program_00_bad_00.pl source OK
0
wbraswell commented 7 years ago

This is a bug with RequirePod, I have filed a new issue: https://github.com/autinitysystems/Perl-Critic-Policy-Documentation-RequirePod/issues/1

I will wait to see if they submit a fix soon, otherwise I will have to make a hard-coded work-around in RPerl itself, which is less preferable of course.

wbraswell commented 7 years ago

@eserte I have made a hard-coded work around in RPerl v2.403, which seems to have (hopefully) fixed some of the issues... However now I think I see more failures which may also be related to extra perlcritic policies being installed? http://www.cpantesters.org/cpan/report/692d51de-d7ce-11e6-b28d-bd5b93b6c75c Please tell me the output of this command: `perlcritic --theme core --brutal --exclude=RequirePod blib/lib/RPerl/Test/Operator05BitwiseNegation/program_00_good.pl; echo $?

eserte commented 7 years ago
$ /opt/perl-5.22.2/bin/perlcritic --theme core --brutal --exclude=RequirePod blib/lib/RPerl/Test/Operator05BitwiseNegation/program_00_good.pl; echo $?
Code is not tidy at line 1, column 1.  See page 33 of PBP.  (Severity: 1)
Use of bitwise operator at line 16, column 28.  Use of bitwise operator "~".  (Severity: 5)
Use of bitwise operator at line 17, column 28.  Use of bitwise operator "~".  (Severity: 5)
Use of bitwise operator at line 26, column 8.  Use of bitwise operator "~".  (Severity: 5)
Use of bitwise operator at line 27, column 8.  Use of bitwise operator "~".  (Severity: 5)
Use of bitwise operator at line 28, column 28.  Use of bitwise operator "~".  (Severity: 5)
Use of bitwise operator at line 28, column 30.  Use of bitwise operator "~".  (Severity: 5)
2
eserte commented 7 years ago

Two more policies have to be excluded:

$ /opt/perl-5.22.2/bin/perlcritic --theme core --brutal --exclude=RequirePod --exclude=ProhibitBitwiseOperators --exclude=RequireTidyCode blib/lib/RPerl/Test/Operator05BitwiseNegation/program_00_good.pl; echo $?
blib/lib/RPerl/Test/Operator05BitwiseNegation/program_00_good.pl source OK
0

See:

wbraswell commented 7 years ago

@eserte Okay great input, thanks! We are already excluding RequireTidyCode, so I will add the proper exclusions for ProhibitBitwiseOperators shortly.

wbraswell commented 7 years ago

Similar to last time, this is actually a bug in Perl::Critic::Bangs:

https://github.com/petdance/perl-critic-bangs/issues/16

wbraswell commented 7 years ago

@eserte Oops, I found another different CPAN Tester machine of yours, with different failures which, again, seem to be from extra Perl::Critic policies:

http://www.cpantesters.org/cpan/report/5bb55a7c-d82f-11e6-9216-c9c0b51183f6

As before, please run this command and let me know which policies are triggered:

perlcritic --theme core --brutal --exclude=RequirePod blib/lib/RPerl/Test/ArrayDereference/program_00_good.pl; echo $?

wbraswell commented 7 years ago

@eserte

We are still experiencing this on the latest RPerl v2.410 release:

http://www.cpantesters.org/cpan/report/3074b92a-d9ba-11e6-8e65-b5c5bf2eb607

Please run this command and let me know which Perl::Critic policies are triggered:

perlcritic --theme core --brutal --exclude=RequirePod blib/lib/RPerl/Test/ArrayDereference/program_00_good.pl; echo $?

Then please do the same for the following 3 files: blib/lib/RPerl/Test/Operator01NamedExp/program_00_good.pl blib/lib/RPerl/Test/Operator10NamedUnaryLog/program_00_good.pl blib/lib/RPerl/Test/Operator10NamedUnarySquareRoot/program_00_good.pl

eserte commented 7 years ago

Sorry, I missed the last request.

I checked now with the current release 2.450000, and only Operator10NamedUnaryLog/program_00_good.pl is failing so far:

$ /opt/perl-5.12.5/bin/perlcritic --theme core --brutal --exclude=RequirePod  blib/lib/RPerl/Test/Operator10NamedUnaryLog/program_00_good.pl; echo $?
Code is not tidy at line 1, column 1.  See page 33 of PBP.  (Severity: 1)
2
wbraswell commented 7 years ago

@eserte Thank you for your reply! :-)

RPerl automatically disables the RequireTidyCode policy, please try running this command:

perlcritic --theme core --brutal --exclude=RequirePod --exclude=RequireTidyCode  blib/lib/RPerl/Test/Operator10NamedUnaryLog/program_00_good.pl; echo $?

It passes on my system, hopefully it will give us more info about your system failure:

$ perlcritic --theme core --brutal --exclude=RequirePod --exclude=RequireTidyCode  lib/RPerl/Test/Operator10NamedUnaryLog/program_00_good.pl; echo $?
lib/RPerl/Test/Operator10NamedUnaryLog/program_00_good.pl source OK
0