New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
violation source line %r display when blank lines in element #734
Comments
I believe it's the same bug #702 fixes. |
@kryde mhhh? I don't think you wanted to at handle me... |
Sorry about that. It's an artifact of referring to the Perl variable |
@xsawyerx Is this fixed? Is there a test for it? |
@petdance On it. Expect one this evening. |
xsawyerx
added a commit
to xsawyerx/Perl-Critic
that referenced
this issue
May 18, 2017
This test checks a problems with the line tracking for violations. * It doesn't seem to fail on 5.22.1, but it does on 5.18.2. * If you have the policy 'CodeLayout::ProhibitHashBarewords', it will use that for the test. * If you don't, it won't do anything.
Done: #758. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In debian packaged perlcritic 1.126, if an element contains blank lines then the source %r displayed for a violation is wrong. For example perlcritic --severity 1 --verbose=9 foo.pl attached shows
[ValuesAndExpressions::RequireInterpolationOfMetachars] String may require interpolation at line 3, near ''. (Severity: 1)
whereas I hoped it would be "near '@bar'".
Some inputs provoke an unitialized value warning too, for example bar.pl attached run similarly.
In Perl::Critic::Violation I think the split in _line_containing_violation() collapses blank lines since \s* matches newlines. Some of the flags are trying to affect that are they? For the uninitialized I think$inx would be compared to $ #lines not @lines. I get some joy from splitting on newline and trimming leading whitespace later like diff below.
foo.pl.txt
bar.pl.txt
Violation.pm.diff.txt
The text was updated successfully, but these errors were encountered: