Re:Perl::Critic - Automatically review your code
by ancarda on Saturday June 29, 2013 @09:07PM
(#5964312)
Please tell me there is something like this for PHP or JS?
[ Parent
| on HN ]
Re:Perl::Critic - Automatically review your code
by dharbin on Saturday June 29, 2013 @09:36PM
(#5964376)
JSHint[1] seems to be the most popular JS linter, although I believe Perl::Critic to be the more powerful of the two tools. I've always appreciated how Perl::Critic allows you to write your own rules, and I wish JSHint was so customizable because I have coding standards I'd like to automate that don't exist in JSHint's options.
Re:Perl::Critic - Automatically review your code
by lazyjones on Sunday June 30, 2013 @07:00AM
(#5965354)
> I believe Perl::Critic to be the more powerful of the two tools.
It is quite limited by Perl's quirky syntax, unfortunately ("only Perl can parse Perl"). Last time I checked, it would miss e.g. all warnings for anonymous subs:
# triggers "Subroutine "foo" does not end with "return" at line 5, column 1. See page 197 of PBP. (Severity: 4)"
sub foo {
my $s=shift;
}
# triggers no warnings
my $x = sub {
my $s=shift;
}
This is a bug/limitation in PPI (which otherwise does a great job with the mess that is Perl syntax) ... I'd assume the various JS analysers can do a more thorough job.
Re:Perl::Critic - Automatically review your code
by rwalker on Saturday June 29, 2013 @09:15PM
(#5964334)
For JavaScript, one option is the Closure Linter
https://developers.google.com/closure/utilities/
(disclaimer: I helped write this when I was working there)
Re:Perl::Critic - Automatically review your code
by shuzchen on Sunday June 30, 2013 @04:29AM
(#5965121)
Inspired by this I wrote https://bitbucket.org/sirpengi/php.critic
Re:Perl::Critic - Automatically review your code
by zzzcpan on Saturday June 29, 2013 @09:13PM
(#5964326)
There is, google for something like php lint or js lint.
Re:Perl::Critic - Automatically review your code
by McGlockenshire on Sunday June 30, 2013 @03:05AM
(#5964981)
For PHP, there's PHP_CodeSniffer, though it's not quite the same thing.