-
Notifications
You must be signed in to change notification settings - Fork 117
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
Filter custom paths according to include #194
Conversation
Custom paths are already filtered by the `exclude` option, but this commit ensures that the `include` option is respected too. This is particularly useful for the `packwerk-vscode` extension, which attempts to run `packwerk check $filename` on save. For example: ``` include: - a/**/*.rb - b/**/*.rb ``` I would expect `packwerk check c/some/file.rb` to show the "No files found or given" message, as it would if `exclude` was set. This commit ensures that happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rubocop works like this when applying cops to a list of specific files, so I think it is acceptable to assume Packwerk should too. 👍
It is a breaking change IMO, so at least we should bump the version accordingly. @alexevanczuk @mclark Would this cause any problems at Gusto or Github? |
I tried this on Gusto's codebase and Note Gusto is also not yet on the version of sorbet that packwerk 2.1.1 requires, but to test this on our codebase, I just pulled this branch locally and made some small tweaks. Wanted to include what I did in case GitHub or Shopify needs to do the same. In
|
@thomasmarshall I needed to merge Thanks for the fix @thomasmarshall! 👍 |
This is still a breaking change, but I think it is a good change. The next release will have to be Thanks!! |
What are you trying to accomplish?
Custom paths are already filtered by the
exclude
option, but this commit ensures that theinclude
option is respected too. This is particularly useful for thepackwerk-vscode
extension, which attempts to runpackwerk check $filename
on save.For example:
I would expect
packwerk check c/some/file.rb
to show the "No files found or given" message, as it would ifexclude
was set. This commit ensures that happens.What approach did you choose and why?
I chose to always filter custom paths according to the
include
option, because that seemed to mirror the behaviour of theexclude
option. However, there might be valid use-cases forpackwerk check some/not/included/file.rb
that I haven't considered. If that's a common use-case, maybe I should approach this differently? Maybe thepackwerk-vscode
extension should be making decisions about when to runpackwerk check
instead?What should reviewers focus on?
Are there common/valid use-cases for
packwerk check
that I am making impossible with this change? I guess if someone is relying on the existing behaviour then this might be a breaking change?Type of Change
Additional Release Notes
Include any notes here to include in the release description. For example, if you selected "breaking change" above, leave notes on how users can transition to this version.
If no additional notes are necessary, delete this section or leave it unchanged.
Checklist