-
Notifications
You must be signed in to change notification settings - Fork 67
Check if swiftformat is installed in scripts/soundness.sh #134
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
Check if swiftformat is installed in scripts/soundness.sh #134
Conversation
Hmmm, I'm surprised we don't fail but it seems we don't WDYT @tomerd worth adding this or setting |
I just realized that:
Perhaps that soundness check could be extracted into a separate GitHub action, and used across repos, so we're sure the same checks are running? |
We'd love to have a swiftpm plugin which does the job of the script and then share that actually; I think someone was working on that @FranzBusch do you remember maybe? |
@glbrntt prototyped something a while ago apple/swift-nio#2242. There are a bunch of open questions like where should it live, how configurable it should be, etc. . |
Looks like apple/swift-nio#2242 focuses on licenses, and doesn't explicitly address formatting (NIO does not have I just realized there's On it's own, moving one check from Would it be a better idea to:
How does that sound? (no pun intended). |
Something that does all of our soundness features in one would be great. However, we do have problem where we should put such a thing. We can't add arbitrary dependencies to NIO and our other repositories. That's also the reason why the current effort was put on hold. |
@FranzBusch, understood. I see that NIO has a very minimal list of dependencies, limited to infrastructure packages (atomics and collections). There are also Would it be a good idea to have a special little repo with that plugin, say I'd assume the problem is not so much in writing the plugin initially, but in figuring out who should own maintenance and future improvements for it, and who should support all other libraries switching to it? /cc @ktoso |
@natikgadzhi You are correct in that the problem is not about writing the actual plugin but actually where to put it and if and how we can depend on it from the other repos. This is something we have to figure out internally and until then we have to live with the current shell scripts. Once, we have a solution for the organisational problems we can move forward with this. This is not blocking this PR here though! |
@FranzBusch, thank you for the explanation! Yep, then the question is, should we also add I think
And so on. My take is that this level of output is too verbose, and makes it hard to read. |
66fd3b4
to
13ea1fe
Compare
PR welcome |
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.
@tomerd here it is.
Want me to walk over other repos and do the same? I can batch the list of PRs and send them your way, so you can review and merge them in a single pass.
@@ -27,7 +27,7 @@ | |||
## | |||
##===----------------------------------------------------------------------===## | |||
|
|||
set -eu | |||
set -euo pipefail |
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.
Fail on errors encountered in subshell commands.
@@ -67,7 +67,7 @@ printf "=> Checking format... " | |||
|
|||
if [[ ! -x $(which swiftformat) ]]; then | |||
printf "\033[0;31mswiftformat not found!\033[0m\n" | |||
exit 1 | |||
exit 127 |
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.
Exit with the correct code for "command not found".
This pull request adds a check for
swiftformat
executable inscripts/soundness.sh
so that it doesn't fail silently if the system does not haveswiftformat
installed.Motivation:
I was working on #133 and noticed that
soundness
passes locally, but fails on CI. Turned out, it just didn't work locally because I didn't haveswiftformat
installed.This pull request adds a check that would
exit 1
from soundness ifswiftformat
is not an executable. /cc @ktoso