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

Add configuration for only posting warnings to added/modified lines #89

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Phillita
Copy link

@Phillita Phillita commented Mar 28, 2024

First off, thank you for your work on Pronto/Pronto Rubocop!

Problem:

I'm looking to add functionality to this gem that hides the external Rubocop warnings for unchanged lines of code.
This is to help control the intake of warnings that are generated by new code without having to resolve warnings around it.

Example:

The file in question has a "Class has too many lines" Rubocop warning.
Updating a method within this class that didn't cause this warning directly, is now receiving a Github Review comment with this warning.

Solution:

  • Add configuration for "only_patched_lines"
    • enabled: true || false
    • range: n where n is added to the warning start to broaden how many warnings are caught
  • If a warning has been generated by a new addition, it will be included in the review comments
  • If the warning is outside of the new code being added, ignore it for this review
  • If a warning range has been provided, capture warnings that start within that range from the patched lines.

Caveats:

If new code generates a warning that starts outside of the patched lines, and no range has been provided, it will be ignored.
The range option has been added to capture some of these but not all will be caught.

Getting a delta of warnings added before the new code would be the best outcome here, but that seemed non-trivial.

UPDATE - April 18, 2024

We've been running into issues with confusing offences showing up on lines that they are not directly connected to. To handle this, I've added in some messaging to show the line that the message/suggestion applies to. I've also made it so that suggestions will only be given to lines where the offence directly maps to the code line.

@Phillita Phillita requested a review from a team as a code owner March 28, 2024 15:22
@Phillita Phillita marked this pull request as draft March 28, 2024 15:23
Co-authored-by: Bert McCutchen <[email protected]>
@Phillita Phillita marked this pull request as ready for review April 1, 2024 17:21
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

Successfully merging this pull request may close these issues.

2 participants