-
Notifications
You must be signed in to change notification settings - Fork 719
Add a soundness plugin #2242
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 a soundness plugin #2242
Conversation
Motivation: We have a handful of scripts which are cargo-culted across the NIO repos. This includes the soundness script for checking license headers and unacceptable language. As regex was added to Swift 5.7 we can use it to replace the bash in the existing script and provide a product which can be used in the other NIO repos. Modifications: - Add a 'nio-soundness' product which can check for unacceptable language and valid license headers. - The CLI is hand rolled to avoid bringing in a dependency on swift-argument-parser. - Update the soudness script to use the new tool. - Update the soudness script to use zsh instead of bash as the bash shipped on macOS is old and doesn't support globbing '**'. Result: Less bash, more Swift.
|
We'll have to update our soundness job to use 5.7 once it's released if we want to use this.
|
I mean... I love zsh as any other person; but it's not a great idea to require it for scripts like this, why the requirement? |
|
Very nice by the way, would love to share this implementation and not have to copy paste the plugin into all other repos... |
| done | ||
|
|
||
| rm "$tmp" | ||
| swift package plugin check-nio-soundness check-language \ |
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.
FYI you don't need the "plugin", can be swift package check-nio-soundness
I'd love to make this a plugin we can share within our projects tbh, lots of projects, not just nio, use those scripts -- we could make it swift package soundness check-language etc
| struct Soundness: CommandPlugin { | ||
| func performCommand(context: PackagePlugin.PluginContext, arguments: [String]) async throws { | ||
| // Check for help first. | ||
| if arguments.contains("--help") { |
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.
SwiftPM plugin APIs include a simple argument parser that can help make these tasks easier.
cc @abertelrud
Motivation:
We have a handful of scripts which are cargo-culted across the NIO
repos. This includes the soundness script for checking license headers
and unacceptable language. As regex was added to Swift 5.7 we can use it
to replace the bash in the existing script and provide a product which
can be used in the other NIO repos.
Modifications:
language and valid license headers.
swift-argument-parser.
shipped on macOS is old and doesn't support globbing '**'.
Result:
Less bash, more Swift.