InfiniteLoop has asked for the wisdom of the Perl Monks concerning the following question:
Greetings Monks,
and the perlcritic.conf:
and the perltidy.conf
and one of the test commits had the following code:
update: changed the title
Recently I have setup a subversion per-commit hook to check perl source code for certain coding standards, via Perl::Critic. One of the option is to check if the code has been run thru Perl::Tidy (Perl::Critic::Policy::CodeLayout::RequireTidyCode). Im using Perl::Critic thusly ...
#internal method to get file content of this commit my $content = read_file_content($file_name); my @violations = critique({-profile => 'perlcritic.conf'} , \$content); # report violations foreach my $crit (@violations){ print STDERR "[$file_name] " . $crit->to_string . "\tsource: " . $crit->source . "\n"; }
and the perlcritic.conf:
[CodeLayout::RequireTidyCode] perltidyrc = /svn/hooks/perltidy.conf
and the perltidy.conf
-bl # braces on new lines -l=80 #80 col width -i=4 #4 char per indent -ce # cuddled else
and one of the test commits had the following code:
among other violations, such as unindented code and code crossing 80 columns etc..... if(1) { print "1"; } else { print "2"; } ...
I have read the perldocs and was sure this case would be reported as an violation, however it didn't. How do I configure the Perl::Critic's profile to report violations on code that fail Perl::Tidy ?
Back to
Seekers of Perl Wisdom