Skip to content

Allow matching at granularity > 1 line #14

@vfaronov

Description

@vfaronov

Hi, and thanks for revgrep. I’ve long wanted a tool like this.

It’s not unusual for changes on one line to cause issues on other (often nearby) lines. Currently, revgrep will filter them out. I wish it had an option to match not “same file and line” but at a larger granularity. “Same file” would be a good start, but “within ±n lines” or “same directory k levels up” might be useful, too.

Example:

Begin with the following example.py:

"""Example module."""

import sys

def say_hello():
    """Greet the world."""
    sys.stdout.write('hello world')

Commit it, then change the last line to read:

    print('hello world')

Now Pylint (the usual linter in Python land) complains:

$ pylint -f parseable -s no example.py 
************* Module example
example.py:3: [W0611(unused-import), ] Unused import sys

But revgrep filters it out, because it’s not on the changed line:

$ pylint -f parseable -s no example.py |& revgrep -regexp '([a-z.]+):([0-9])+:() (.+)'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions