-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fingerprint in gitlab report should not use location in code as part of the hashing algorithm #7159
Comments
Thanks for reporting this and linking to an alternative implementation. ESlint's approach is interesting because it provides a more stable result. The only shortcoming that I can think of right now (if I understand it correctly) is that it won't report a lint if an error for the same rule in the same file was fixed but a new (otherwise than the location identical) violation was introduced. But this seems less of an error compared to Ruff over-reporting on newly introduced and fixed diagnostics for every PR. The one thing that's unclear to me as someone who hasn't used GitLab extensively is whether this is a breaking change. I would assume that GitLab will mark ALL diagnostics as changed when upgrading from the current hash function to the new hash function. Do you know if that's correct and how disruptive that would be? |
Depends on your definition of a breaking change. So as for how disruptive? Not more than what I would say was worth it to not have almost every run report on new and fixed errors, that are just results of lines being moved around. |
I have never used Rust, but I am taking a look at it now. |
Happy to help you get started. The relevant code is ruff/crates/ruff/src/message/gitlab.rs Lines 55 to 100 in ea72d5f
Let me know if I can help you in anyway and feel free to ping me on Discord. |
ruff 0.0.287
Using the location in the code file as part of the hashing for the fingerprint causes a comparison between reports to show one issue as fixed, and a new one as having come to, if other parts of a file is changed, causing the line number to change.
As a comparison, this is how eslint-gitlab-reports calculate hashing: https://gitlab.com/remcohaszing/eslint-formatter-gitlab/-/blob/main/index.js?ref_type=heads#L72
In its (ruff) current for, the output in gitlab will show a lot of noise when reporting on code quality if, say, a line is inserted above all the linting issues in a code file, and moving them one line down. They will all get new fingerprints, and the fingerprints that were in the old report will be gone.
The text was updated successfully, but these errors were encountered: