'Is there any way to apply SwiftLint to SwiftPackages
I'm struggling to find a way to apply SwiftLint to my swift packages.
But after searching a lot, I couldn't find any way.
I use micro application architecture, which leads me to many micro packages. I am looking for a way to use SwiftLint for my swift packages.
Solution 1:[1]
I have the same problem. The current version of SPM does not support Run Scripts so you can't run SwiftLint in a way like on the main project. But future versions of SPM will support it.
Currently, I use the command line to find all the issues. This is not very convenient but something.
In the package folder:
swiftlint --config [path to swiftlint.yml] > [path to file to save a report]
e.g.
swiftlint --config ~/Desktop/swiftlint.yml > ~/Desktop/swiftlintreport.txt
Solution 2:[2]
When I'm working on a SPM package I usually create an Xcode project that locally imports the package and use that project to work on the project.
This allows me to run stuff like SwiftLint. It's also handy to remember to use the correct access control modifiers.
You can see an example in this project of mine.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mojtaba Hosseini |
| Solution 2 | EmilioPelaez |
