Skip to content

Conversation

@jmcfarland-figma
Copy link

@jmcfarland-figma jmcfarland-figma commented Oct 18, 2024

What are you trying to accomplish?

Because the PackageTodo class didn't know what files had been supplied it would erroneously suspect files had been deleted if you only passed a single file on the command line.

We do this in a pre-commit hook with bundle exec packwerk check $(git diff --name-only) and it was causing issues; the tool would assert there were stale todos when there are not.

Happy to make any adjustments. This addresses #369

What approach did you choose and why?

This changes the method signature of OffenseFormatter#show_stale_violations to accept a FilesForProcessing instance instead of Set[String] and plumbs the FilesForProcessing through to PackageTodo#stale_violations? so that it can call #files_specified? on it. If there were files specified in the command invocation it skips the #deleted_files_for call.

What should reviewers focus on?

Code style and alternative approaches that could be taken

Type of Change

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

Additional Release Notes

  • Breaking change (fix or feature that would cause existing functionality to change)

I'm not sure. Probably because I've changed the method signature of a public method on OffenseFormatter

Checklist

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

Because the PackageTodo class didn't know what files had been
supplied it would erroneously suspect files had been deleted
if you only passed a single file on the command line.

We do this in a pre-commit hook with `bundle exec packwerk check $(git diff --name-only)`
and it was causing issues; the tool would assert there were stale
todos when there are not.

This changes the method signature of OffenseFormatter.show_stale_violations to
accept a FilesForProcessing instance instead of Set[String] and
plubms the FilesForProcessing through to PackageTodo#stale_violations? so
that it can call #files_specified? on it. If there were files specified
in the command invokation it skips the #deleted_files_for call.

Happy to make any adjustments. This addresses Shopify#369
@jmcfarland-figma jmcfarland-figma requested a review from a team as a code owner October 18, 2024 23:09
@jmcfarland-figma
Copy link
Author

I signed the CLA but I'm not sure how to re-run the test

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.

1 participant