无法让策略 Perl::Critic::Policy::Tics::ProhibitLongLines 工作

发布于 2025-01-05 01:07:46 字数 1658 浏览 1 评论 0 原文

我有:

  • Ubuntu 10.04
  • Perlbrew 0.39
  • 切换到 Perl 5.12.3。使用 perlbrew
  • 安装 Perl::Critic 和 Perl::Critic::Tics 并使用 cpanm

我的 .perlcriticrc 文件:

severity = 1
only= 1

[CodeLayout::ProhibitHardTabs]
allow_leading_tabs = 0

[Perl::Critic::Policy::CodeLayout::RequireConsistentNewlines]

[Perl::Critic::Policy::Tics::ProhibitLongLines]
base_max = 120
hard_max = 130
pct_allowed = 5

[Perl::Critic::Policy::OTRS::RequireCamelCase]

其他策略按预期运行,但每当一行超过由 Hard_max 定义的长度时,我收到警告消息:

Use of uninitialized value $min_width in numeric gt (>) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 51.
Use of uninitialized value $replength in numeric gt (>) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 51.
Use of uninitialized value $max_width in numeric gt (>) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 56.
Use of uninitialized value $replength in numeric gt (>) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 56.
Use of uninitialized value $replength in subtraction (-) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 67.
Use of uninitialized value $min_width in subtraction (-) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 67.
Use of uninitialized value $replacement in concatenation (.) or string at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 67.

I have:

  • Ubuntu 10.04
  • Perlbrew 0.39
  • Switched to Perl 5.12.3. with perlbrew
  • Installed Perl::Critic and Perl::Critic::Tics with cpanm

My .perlcriticrc file:

severity = 1
only= 1

[CodeLayout::ProhibitHardTabs]
allow_leading_tabs = 0

[Perl::Critic::Policy::CodeLayout::RequireConsistentNewlines]

[Perl::Critic::Policy::Tics::ProhibitLongLines]
base_max = 120
hard_max = 130
pct_allowed = 5

[Perl::Critic::Policy::OTRS::RequireCamelCase]

The other policies function as expected, but whenever a line is over the length defined by hard_max, I get the warning messages:

Use of uninitialized value $min_width in numeric gt (>) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 51.
Use of uninitialized value $replength in numeric gt (>) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 51.
Use of uninitialized value $max_width in numeric gt (>) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 56.
Use of uninitialized value $replength in numeric gt (>) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 56.
Use of uninitialized value $replength in subtraction (-) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 67.
Use of uninitialized value $min_width in subtraction (-) at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 67.
Use of uninitialized value $replacement in concatenation (.) or string at /home/birdy/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/String/Format.pm line 67.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

坠似风落 2025-01-12 01:07:46

这对我来说似乎是一个错误。即使我完全忽略我的 .perlcriticrc 文件,我也会收到相同的警告:

perlcritic -1 --noprofile mycode.pl

我使用的是 perl 5.12.2。

您应该针对 href="http://search.cpan.org/perldoc?Perl%3a%3aCritic%3a%3aTics" rel="nofollow">Perl::Critic::Tics。我已经检查了 TicsPerl::Critic,但我没有找到任何与 String::Format 相关的内容。确保您拥有最新版本的 CriticTics。我有当前的 Tics (0.006),但我的 Critic 有点过时 (1.111)。

This seems like a bug to me. I get the same warnings even if I completely ignore my .perlcriticrc file:

perlcritic -1 --noprofile mycode.pl

I am on perl 5.12.2.

You should submit a bug report against Perl::Critic::Tics. I have checked the Changes files for both Tics and Perl::Critic, but I did not find anything relevant to String::Format. Make sure you have recent versions of Critic and Tics. I have the current Tics (0.006), but my Critic is a little outdated (1.111).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文