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

Running SwiftLint across all projects/targets in a workspace #802

Closed
rajohns08 opened this issue Sep 1, 2016 · 4 comments
Closed

Running SwiftLint across all projects/targets in a workspace #802

rajohns08 opened this issue Sep 1, 2016 · 4 comments
Labels

Comments

@rajohns08
Copy link

rajohns08 commented Sep 1, 2016

I have a workspace with multiple sibling projects that I maintain in a single workspace.

I have set up a run script phase for the target of every project.

Is there a way to avoid swapping targets and building for every target to see the SwiftLint warnings for that target? I would like to build for a single target and see SwiftLint warnings across all of my projects/targets.

@jpsim jpsim added the question label Sep 1, 2016
@rajohns08
Copy link
Author

note to self: maybe there is a way to specify multiple paths to run swiftlint on - in that case only one project would need to have the run script which could run the lint command on all projects. Or maybe even just specify one path to run on but specify the path of the parent directory of the project.

@norio-nomura
Copy link
Collaborator

I created https://github.com/norio-nomura/ExtraBuildPhase as Xcode plugin for such purpose.
But, we can't use that with Xcode 8 anymore.

@rajohns08
Copy link
Author

My solution that seems to work fine is to pick whichever target I will normally be building and only put the run script for that target, but make the run script specify the --path to be one directory up.

swiftlint lint --path "$SRCROOT"/..

@nharbo
Copy link

nharbo commented Jan 15, 2021

if which swiftlint >/dev/null; then
swiftlint autocorrect
swiftlint --path
echo "Linting"
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi

Worked for me :) Thanks for the hint!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants