Skip to content

Check filtered finding when error is on another line than git diff #187

@ruudk

Description

@ruudk

I'm trying out to create a PHP Linter.

I have a file like this:

public function create()
{
    // i make a mistake below by forgetting the trailing ;  line 33
    blaat()  // <-- line 34
}

My php linter gives the following error:

src/AdminBundle/Job/PostAdminMessageToSlackJob.php:35: PHP Parse error: syntax error, unexpected '$job' (T_VARIABLE)

And Reviewdog marks this finding as filtered:

Findings (0)
Filtered Findings (1)
src/AdminBundle/Job/PostAdminMessageToSlackJob.php:35: PHP Parse error: syntax error, unexpected '$job' (T_VARIABLE)

That's because Reviewdog does a strict lookup for the given row number in the git diff. But in PHP the error will sometimes be on the next line.

Any idea how to solve this?

Doesn't Github allow for adding checks to lines that didn't change? It always shows ±5 lines before and after right? Maybe we can take that margin into account here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions