Created
February 5, 2022 00:08
-
-
Save markeissler/bcc99d4e7b3e59be5e57c67ebbf77251 to your computer and use it in GitHub Desktop.
SwiftLintAppCodeWrapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Workaround for SwiftLintAppCode plugin hanging while calling swiftlint. | |
# | |
# 1. Drop this into /usr/local/bin/swiftlint-wrapper.sh or some other handy spot. | |
# 2. Set exec permissions: chmod 0755 /usr/local/bin/swiftlint-wrapper.sh | |
# 3. Update AppCode SwiftLint settings to point to the wrapper. | |
# | |
# This wrapper supports a single file only as an argument. It supports linting | |
# once a file has been saved (auto trigger) or if specifying the file from the | |
# `Inspect code...` dialog. | |
# | |
lint_command="/usr/local/bin/swiftlint" | |
lint_args="$(echo "$@" | sed -E 's/([a-zA-Z0-9/ .-]+)(--path )([a-zA-Z0-9/.-]+)/\1 --quiet --use-stdin/')" | |
pipe_command="$(echo "$@" | sed -E 's/([a-zA-Z0-9/ .-]+)(--path )([a-zA-Z0-9/.-]+)/cat \3/')" | |
${pipe_command} | ${lint_command} ${lint_args} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment