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

Packages with no violations should have their files removed #249

Merged
merged 1 commit into from
Nov 3, 2022

Conversation

gmcgibbon
Copy link
Member

@gmcgibbon gmcgibbon commented Nov 1, 2022

What are you trying to accomplish?

Packages with TODOs that are done should have their files deleted once no more violations remain.

What approach did you choose and why?

Dif the package set in the run context from the one in the offense collection and delete any that shouldn't have TODOs but do.

What should reviewers focus on?

Does this approach make sense?

Type of Change

  • Bugfix
  • New feature
  • Non-breaking change (a change that doesn't alter functionality - i.e., code refactor, configs, etc.)

Checklist

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • It is safe to rollback this change.

@gmcgibbon gmcgibbon marked this pull request as ready for review November 1, 2022 22:56
@gmcgibbon gmcgibbon requested a review from a team as a code owner November 1, 2022 22:56
Copy link
Contributor

@alexevanczuk alexevanczuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me! A couple of small questions, but otherwise I think the approach makes sense. The only tradeoff I see here is that bin/packwerk update-todo path/to/specific/file.rb will produce unexpected results if path/to/specific/file.rb has no offenses, since presumably that would mean no TODO would be registered, meaning we'd delete the containing pack's TODO file.

I think that's fine because I think running update-todo on specific files is not really supported -- only running on the whole codebase or specific packs is supported.

lib/packwerk/parse_run.rb Outdated Show resolved Hide resolved
lib/packwerk/run_context.rb Outdated Show resolved Hide resolved
@gmcgibbon gmcgibbon force-pushed the clean_up_old_todo_files branch 2 times, most recently from bf48975 to 08ea540 Compare November 2, 2022 22:29
@gmcgibbon
Copy link
Member Author

The only tradeoff I see here is that bin/packwerk update-todo path/to/specific/file.rb will produce unexpected results if path/to/specific/file.rb has no offenses, since presumably that would mean no TODO would be registered, meaning we'd delete the containing pack's TODO file.

I think that's fine because I think running update-todo on specific files is not really supported -- only running on the whole codebase or specific packs is supported.

Agree. Maybe we should make the command not work with a file, or warn and run with . automatically.

@gmcgibbon gmcgibbon force-pushed the clean_up_old_todo_files branch 2 times, most recently from 64717de to 0b94eaf Compare November 2, 2022 22:33
@gmcgibbon gmcgibbon merged commit 9ddcbf8 into main Nov 3, 2022
@gmcgibbon gmcgibbon deleted the clean_up_old_todo_files branch November 3, 2022 17:57
@rafaelfranca rafaelfranca added the backport Changes to backport label Nov 7, 2022
gmcgibbon added a commit that referenced this pull request Nov 7, 2022
Packages with no violations should have their files removed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Changes to backport
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants