-
Notifications
You must be signed in to change notification settings - Fork 942
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
Support option to only report lines that have changed #219
Comments
i thought the |
This will be nearly impossible to achieve as it would be up to the individual lint tools to determine whether there is an issue or not and in order to parse the code and check validity they usually need to read the whole file. Here is an example of why: Original code: if (true) {
console.log("Hello World!");
} New code: if (false) {
console.log("Goodbye World!");
} What has changed above? if (true) {
console.log("Hello World!"); Became if (false) {
console.log("Goodbye World!"); Notice in the changed code we have the opening curly brace |
Oh wait a second ... i didn't had enough coffee this morning. I didn't read that @mehagar was looking to achieve this for the changed lines only. I thought he was looking for a way to lint only the files he had touched with a pull request. That was the reason i was looking for and couldn't get to run. But thanks for the explanation @nemchik 👍 |
|
Interesting! I am not quite sure if i hadn't merged the latest changes from develop into my pull request and therefore got more changes while linting but i changed the |
I understand what you mean. You're right - you would need to lint the entire file. But you could still only report on lines that have linting errors. If the linting tools report a line number, you could only pass that through the Github Linter if the line number was the same as a changed line in the PR. I updated the PR's title to be "report" instead of "check". |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
@mehagar It sounds like your frustration stems from using super-linter on files with lots of issues and fixing them. Imho the best way would be to run a local linter that is integrated into your IDE and makes fixing up multiple issues easy, looking something like this: And use superlinter to assert that all commited code is lint free instead of using it "line-by-line". |
@assignUser , a local linter would be part of the workflow to make it easy to fix issues so they don't get caught by any CI linter. But if a developer is making a one line change to a file, I only want them to have to fix linting issues on that one line. As it is, the super linter would report on the entire file instead of just the one changed line. As an example of what I want, see reviewdog, which by default only reports on the lines that were changed in the PR. |
I see, this would require a lot of changes as the ouput from the linters is not parsed in anyway at the moment. Your suggestion would probably go well with #151 were reviewdog was also referenced. |
It's possibly still more subtle than this @mehagar depending on what you actually want to achieve. If the line you change/remove is the only usage of an import, then the act of changing/removing that line would generate a lint warning at the top of the file about an unused import, but your suggested fix would filter that out. Obviously these are a different class of warnings to be considered. Flagging alerts due to deletions may be rather challenging too, e.g. removing a blank line so there isn't enough whitespace between two functions. Or even inserting a new function in between two existing ones and therefore reducing the amount of whitespace too much. |
This issue has been automatically marked as stale because it has not had recent activity. If you think this issue should stay open, please remove the |
This plugin claims to do what you are asking for. I have not tested it. |
When linting files, it can be frustrating for a developer editing a file to have to fix all linting rules when they just edited one line.
I'd like for there to be an option to only report errors on lines that have changed.
The text was updated successfully, but these errors were encountered: