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

Add SwiftLint support #191

Open
1 of 2 tasks
mhdostal opened this issue Nov 29, 2022 · 6 comments
Open
1 of 2 tasks

Add SwiftLint support #191

mhdostal opened this issue Nov 29, 2022 · 6 comments

Comments

@mhdostal
Copy link
Member

mhdostal commented Nov 29, 2022

The v100.x Toolkit had a SwiftLint build phase. We should add SwiftLint to the Toolkit, Example, and AuthenticatorExample projects (the Authenticator Example is essentially static and unchanging, so we're not going to lint that). The Samples team has already done this for the Swift Samples, so follow that pattern.

  • Add to Example App via Run Script Build Phase
  • Add to Toolkit Package via SwiftLint SPM Plug-in.
@mhdostal
Copy link
Member Author

We should also explore swift-format

@dfeinzimer
Copy link
Collaborator

dfeinzimer commented Mar 30, 2024

Note: Swift lint is being added at the SDK level in 200.5 as a plugin. Ref Swift 2836. cc @zkline101 @mhdostal

@zkline101
Copy link
Contributor

Add to Example App via Run Script Build Phase

You may want to change this because once your Examples project is updated to the Xcode 15 recommended changes (it may already be upgraded), it will break that build phase. This is because Xcode will automatically change ENABLE_USER_SCRIPT_SANDBOXING = YES which prevents swift lint from being run. So it would be worth changing your swift lint in your examples app to a build tool plugin which you can find the directions in the SwiftLint repo.

@dfeinzimer
Copy link
Collaborator

Note that we ended up adding SwiftLint as a custom package rather than a plugin. See Swift 5164.

@yo1995
Copy link
Contributor

yo1995 commented Apr 5, 2024

In today's discussion on using SwiftLint build tool plugin, there are some concerns about adding the plugin to the toolkit Swift Package

  • For public facing products such as the toolkit Swift package and Samples app, because there are more people download and use them, than pull and contribute to them, adding it as a plugin will be an unnecessary overhead for their usage
    • We might consider how to limit the SwiftLint tool to our contributors, so that users don't need to download them when they use the products (as a dependency)
    • Using build phase script is viable for Samples as it doesn't force a user to install the program, but not viable for the toolkit
    • Maybe there is a way like the environment variable in Consider ways to use local Swift SDK package in toolkit #275, so that the toolkit can set an env, and only contributors will download the SwiftLint build tool plugin when develop and compile the Swift package
  • For internal-use product, such as the Swift API source code package, Swift API examples app, (maybe?) toolkit examples apps, we can use the build tool plugin as it can provide the convenience for everyone who has or doesn't have SwiftLint as a program installed on their machine.

The benefits of SwiftLint build tool plugin as of today (200.4)

@dfeinzimer
Copy link
Collaborator

dfeinzimer commented Apr 16, 2024

Esri fork of SwiftLint -> https://github.com/Esri/SwiftLint

There're some blockers to integrating the plugin at this time (ref Swift 5176)

Update: This can be consumed as a package plugin to lint package sources. The Toolkit example projects can add it as a package dependency $PROJECT -> Package Dependencies and then add a build tool plugin step under $TARGET -> Run Build Tool Plug-ins

Once this work is done we should carry out #698

Edit: Possible new issue with the SwiftLint SPM plug-in that should be resolved first @ Swift 5296

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

No branches or pull requests

4 participants