Skip to content
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

Expand the view of the source when reviewing violations #27

Open
stevan opened this issue Sep 4, 2016 · 5 comments
Open

Expand the view of the source when reviewing violations #27

stevan opened this issue Sep 4, 2016 · 5 comments

Comments

@stevan
Copy link
Owner

stevan commented Sep 4, 2016

As discussed in #22 we should show +/- 5 lines of source around the actual violation when reviewing them. Maybe even make the number of +/- lines a configuration variable.

@stuartskelton
Copy link
Contributor

stuartskelton commented Sep 4, 2016

I wonder if we could put a PR into Path::Tiny to extend the lines, to have a start_at option.

my $start = $violation_line - $config_plus_minus;
@violation_area = $file->lines(
    {
        start_at => $start < 0 ? 0 : $start,
        count    => ($config_plus_minus * 2) + 1
    }
);

Other wise we'll just have to make out own file splice subroutine.
(sorry for the edit spam)

@stuartskelton
Copy link
Contributor

Or thinking about it, File::Tie could be an option.

@stevan
Copy link
Owner Author

stevan commented Sep 5, 2016

Actually I was thinking I could use the PPI nodes to get the info. Traverse up to the parent node, note the line number, render the parent node and trim the resulting string appropriately.

That said, I've not tried to do this yet :)

On Sep 4, 2016, at 22:39, Stuart Skelton notifications@github.com wrote:

Or thinking about it, File::Tie could be an option.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.

@stuartskelton
Copy link
Contributor

I look forward to seeing that commit chain.

On 5 Sep 2016 8:35 a.m., "Stevan Little" notifications@github.com wrote:

Actually I was thinking I could use the PPI nodes to get the info.
Traverse up to the parent node, note the line number, render the parent
node and trim the resulting string appropriately.

That said, I've not tried to do this yet :)

On Sep 4, 2016, at 22:39, Stuart Skelton notifications@github.com
wrote:

Or thinking about it, File::Tie could be an option.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#27 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAc1FnhhxWD964OTbjQqEcLtG9RgCgc6ks5qm8Y5gaJpZM4J0l37
.

@stevan
Copy link
Owner Author

stevan commented Sep 5, 2016

Haha, me too ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants