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

Allow matching at granularity > 1 line #14

Open
vfaronov opened this issue Jan 7, 2019 · 0 comments
Open

Allow matching at granularity > 1 line #14

vfaronov opened this issue Jan 7, 2019 · 0 comments

Comments

@vfaronov
Copy link

vfaronov commented Jan 7, 2019

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])+:() (.+)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant