{"id":3389,"date":"2014-02-27T20:00:23","date_gmt":"2014-02-27T19:00:23","guid":{"rendered":"http:\/\/www.b.shuttle.de\/hayek\/Hayek\/Jochen\/wp\/blog-en\/?p=3389"},"modified":"2014-02-27T20:00:23","modified_gmt":"2014-02-27T19:00:23","slug":"running-perlcritic-on-legacy-perl-code","status":"publish","type":"post","link":"https:\/\/wp.jochen.hayek.name\/blog-en\/2014\/02\/27\/running-perlcritic-on-legacy-perl-code\/","title":{"rendered":"running perlcritic on legacy Perl code"},"content":{"rendered":"<p>\t\t\t\tI got asked &#8220;at work&#8221; to run perlcritic on some legacy Perl code, and I got flooded with complaints. So I invested a little time in finding out, how to switch certain checks off. This is my perlcritic command line:<\/p>\n<pre>$ perlcritic --theme=core --exclude=NamingConventions::Capitalization --exclude=ControlStructures::ProhibitPostfixControls --exclude=Documentation::RequirePodAtEnd --exclude=Subroutines::RequireArgUnpacking --exclude=Variables::ProhibitPunctuationVars ...<\/pre>\n<p>Using all these command line switches you can somehow restrict the endless complaints about the code in question. But that did not remove all relevant classes of complaints, so I also had to pipe resp. filter through a couple of cascaded &#8220;<em>fgrep -v &#8216;&#8230;<\/em>&#8216;&#8221;.<\/p>\n<p>Actually I really liked implementing some of the rules expressed in PBP (&#8220;Perl Best Practices&#8221; &#8212; and perlcritic basically is a &#8220;PBP checker&#8221;) like:<\/p>\n<ul>\n<li>avoid statement modifiers<\/li>\n<li>avoid &#8220;unless&#8221; &#8212; as soon as it&#8217;s around a non-trivial expression, it&#8217;s just getting weird<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>I got asked &#8220;at work&#8221; to run perlcritic on some legacy Perl code, and I got flooded with complaints. So I invested a little time in finding out, how to switch certain checks off. This is my perlcritic command line: $ perlcritic &#8211;theme=core &#8211;exclude=NamingConventions::Capitalization &#8211;exclude=ControlStructures::ProhibitPostfixControls &#8211;exclude=Documentation::RequirePodAtEnd &#8211;exclude=Subroutines::RequireArgUnpacking &#8211;exclude=Variables::ProhibitPunctuationVars &#8230; Using all these command line switches [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_share_on_mastodon":"0"},"categories":[666],"tags":[1221],"class_list":["post-3389","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-perlcritic"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paO0kP-SF","jetpack_likes_enabled":true,"amp_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/3389","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/comments?post=3389"}],"version-history":[{"count":0,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/posts\/3389\/revisions"}],"wp:attachment":[{"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/media?parent=3389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/categories?post=3389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.jochen.hayek.name\/blog-en\/wp-json\/wp\/v2\/tags?post=3389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}