SwiftLint icon indicating copy to clipboard operation
SwiftLint copied to clipboard

Refactor Exclude by behavior into a Strategy pattern

Open rlf-doordash opened this issue 6 months ago • 6 comments

Right now there are only 2 ways of excluding files managed by an enum. The logic deciding between those 2 is split along several places of code, which makes it difficult to standardize between them and pose a scalability challenge if we were to add new options.

This PR creates a common protocol among those 2 options (by prefix and by expanding subpaths) and refactors them so their logic can be called generically instead of exposing inner implementation details in different places of code

rlf-doordash avatar Jul 18 '25 00:07 rlf-doordash

1 Warning
:warning: If this is a user-facing change, please include a CHANGELOG entry to credit yourself!
You can find it at CHANGELOG.md.
18 Messages
:book: Building this branch resulted in a binary size of 25468.62 KiB vs 25468.68 KiB when built on main (-1% smaller).
:book: Linting Aerial with this PR took 1.05 s vs 1.06 s on main (0% faster).
:book: Linting Alamofire with this PR took 1.41 s vs 1.41 s on main (0% slower).
:book: Linting Brave with this PR took 9.52 s vs 9.53 s on main (0% faster).
:book: Linting DuckDuckGo with this PR took 27.78 s vs 27.81 s on main (0% faster).
:book: Linting Firefox with this PR took 14.66 s vs 14.68 s on main (0% faster).
:book: Linting Kickstarter with this PR took 10.81 s vs 10.8 s on main (0% slower).
:book: Linting Moya with this PR took 0.56 s vs 0.56 s on main (0% slower).
:book: Linting NetNewsWire with this PR took 3.22 s vs 3.23 s on main (0% faster).
:book: Linting Nimble with this PR took 0.85 s vs 0.85 s on main (0% slower).
:book: Linting PocketCasts with this PR took 9.4 s vs 9.56 s on main (1% faster).
:book: Linting Quick with this PR took 0.49 s vs 0.49 s on main (0% slower).
:book: Linting Realm with this PR took 4.9 s vs 4.89 s on main (0% slower).
:book: Linting Sourcery with this PR took 2.47 s vs 2.5 s on main (1% faster).
:book: Linting Swift with this PR took 5.71 s vs 5.73 s on main (0% faster).
:book: Linting VLC with this PR took 1.53 s vs 1.52 s on main (0% slower).
:book: Linting Wire with this PR took 23.09 s vs 23.05 s on main (0% slower).
:book: Linting WordPress with this PR took 15.55 s vs 15.55 s on main (0% slower).

Here's an example of your CHANGELOG entry:

* Refactor Exclude by behavior into a Strategy pattern.  
  [rlf-doordash](https://github.com/rlf-doordash)
  [#issue_number](https://github.com/realm/SwiftLint/issues/issue_number)

note: There are two invisible spaces after the entry's text.

Generated by :no_entry_sign: Danger

SwiftLintBot avatar Jul 18 '25 00:07 SwiftLintBot

@SimplyDanny Do you happen to know how to get a review on proposed changes?

rlf-doordash avatar Jul 18 '25 23:07 rlf-doordash

@SimplyDanny Do you happen to know how to get a review on proposed changes?

I can have a look. But it'll take a while.

SimplyDanny avatar Jul 23 '25 20:07 SimplyDanny

@SimplyDanny Do you happen to know how to get a review on proposed changes?

I can have a look. But it'll take a while.

Sounds good, would appreciate it. This is part of a larger improvement I have prepared to allow faster parsing of large codebases :D

rlf-doordash avatar Jul 23 '25 20:07 rlf-doordash

@SimplyDanny Do you happen to know how to get a review on proposed changes?

I can have a look. But it'll take a while.

Sounds good, would appreciate it. This is part of a larger improvement I have prepared to allow faster parsing of large codebases :D

That motivated me come back to this PR faster. 😉

SimplyDanny avatar Jul 23 '25 21:07 SimplyDanny

@SimplyDanny Do you happen to know how to get a review on proposed changes?

I can have a look. But it'll take a while.

Sounds good, would appreciate it. This is part of a larger improvement I have prepared to allow faster parsing of large codebases :D

That motivated me come back to this PR faster. 😉

Sorry, I was out and it has taken a while to get back on this :( I am expectin g to be able to put some time into this for the next couple of weeks tho!

rlf-doordash avatar Sep 03 '25 09:09 rlf-doordash