-
-
Notifications
You must be signed in to change notification settings - Fork 135
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
Swiftlint should consider excluded paths in config file #180
Conversation
There are some tests that needs to be updated and maybe created (I would like to keep the swiftlint code well tested), but in general looks good 👍 |
Yeah, I will fix the tests for Swiftlint 👍 Gonna be interesting, because the tests heavily rely on the command just being swiftlint (or the swiftlintPath). But I suffixed the command with the Environment variables 😬 I'm thinking of extending the ShellExecutor protocol to support environment variables, as this would ease up a lot of the issues that we have with the tests 😉
You mean, because only one instance of Swiftlint is started, instead of one per file? 😄 |
Yes :) |
@absolute-heike if i understood your problem correctly I suppose you can use contains instead of == to find the command and then check that the final string is prefixed with the correct variables, something like command == "SCRIPT_INPUT_FILE_COUNT=2 SCRIPT_INPUT_FILE_0=\"expectedFile0\" SCRIPT_INPUT_FILE_0=\"expectedFile1\" swiftlint" |
Yes I could do that. Do you prefer this approach? The change to ShellExecutor would look kinda like this:
|
Yep, cool :) |
…ftlint_exludes # Conflicts: # CHANGELOG.md
|
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.
One minor comment, but looks good 👍
Found a bug. When there is no file to lint (e.g. you didn't change a swift file), Swiftlint is still executed and prints
|
I would suggest to not execute it in that case, we run on CI then we aim to be as fast as possible. |
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.
Just removing the approval because of the bug :)
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.
Nice!
merge on green |
Right now changes in e.g. Pods folder are also checked by Swiftlint, even though they are excluded in the local
swiftlint.yml
config file. This bug was fixed 8 days ago in realm/SwiftLint#2574 (version 0.30.1).This PR changes the handling to pass the filelist to
swiftlint
as an array and set--force-exclude
so the config exludes are adhered to.Calls to Swiftlint should look like this:
SCRIPT_INPUT_FILE_COUNT=2 SCRIPT_INPUT_FILE_0="Source/File1.swift" SCRIPT_INPUT_FILE_1="Source/File2.swift" swiftlint lint --quiet --use-script-input-files --force-exclude --reporter json