如何修改 perlcritic 中的规则

how to modify rules in perlcritic

嘿,

Perl 评论家(源代码分析器)。 我是新来的 。尽管我已经研究了文档并且知道如何 运行 它(这还不够!)。 我想修改规则(即包括、排除或添加我自己的规则)。 我知道 .perlcriticrc 文件可以做到这一点。 但是我不知道怎么做。

谢谢

根据 Perl::Critic 的文档,您可以使用 add_policy( -policy => $policy_name, -params => \%param_hash ) 方法添加 "policy":

-policy is the name of a Perl::Critic::Policy subclass module. The 'Perl::Critic::Policy' portion of the name can be omitted for brevity. This argument is required.

然后,当您查看子类模块的链接文档时(强调我的);

To work with the Perl::Critic engine, your implementation must behave as described below. For a detailed explanation on how to make new Policy modules, please see the Perl::Critic::DEVELOPER document included in this distribution.

...我们看到有一个完整的文档涵盖了您想要做的事情。

您对文档的哪一部分有疑问?