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

Differentiate between new lines and modified lines #31

Open
jayvdb opened this issue Dec 8, 2015 · 7 comments
Open

Differentiate between new lines and modified lines #31

jayvdb opened this issue Dec 8, 2015 · 7 comments

Comments

@jayvdb
Copy link

jayvdb commented Dec 8, 2015

When working on a codebase which has violations which are baked in, such as CamelCase method names, modifications of those lines are not new violations, and 'fixing' them would create new bugs part of any release other than a major release.

It would be nice if there was an option to omit modified lines from the reported errors.

@miki725
Copy link
Contributor

miki725 commented Dec 8, 2015

What do you mean "omit modified lines from the reported errors"? The purpose of flake8-diff is to output errors only for the modified lines. Are you trying to do something else?

@jayvdb
Copy link
Author

jayvdb commented Dec 8, 2015

I'd like an option to only report errors in chunks of lines that are added ; i.e. the vcs diff program is not able to match the lines with lines in the pre-existing code.

@miki725
Copy link
Contributor

miki725 commented Dec 8, 2015

can you give an example?

@jayvdb
Copy link
Author

jayvdb commented Dec 8, 2015

I'd like it to skip checking modified line in the following, and report errors in the two new lines.

-old line
+modified line

+new line 1
+new line 2

@miki725
Copy link
Contributor

miki725 commented Dec 8, 2015

This can be customized for git in https://github.com/dealertrack/flake8-diff/blob/master/flake8diff/vcs/git.py#L67 although not sure what the parameter should be. Also not sure how it would be implemented for other backends like hg which does not have equivalent implementation. Instead it manually finds the changed files. https://github.com/dealertrack/flake8-diff/blob/master/flake8diff/vcs/hg.py#L57-L69

@jayvdb
Copy link
Author

jayvdb commented Dec 21, 2015

The git diff --diff-filter supports listing only added files, but it does not support listing only files with lines added.

If I was implementing this, I would not be looking at modify changed_files.

Instead I would be modifying changed_lines to only list lines added. This would mean that some files listed by changed_files would not have any lines added, as they only had lines modified. Is that approach reasonable? If this sounds like a feature you'd be willing to accept, I am happy to have a go at coding it, as I would like to use this feature for https://github.com/wikimedia/pywikibot-core (pending change https://gerrit.wikimedia.org/r/#/c/257537/).

@miki725
Copy link
Contributor

miki725 commented Dec 21, 2015

sounds reasonable to me. just to clarify - you would like to ignore modified lines however Im not sure how would that work on a file where both lines are added and modified. either way you are more then welcome to try to implement this. having some concrete example might help with figuring out all the edge cases

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

2 participants