Repository navigation
Closed
Description
search you tried in the issue tracker
unknown option
describe your issue
I've got pre-commit configured with SwiftLint.
Executing pre-commit run --all-files fails due to wrong -C option passed to swift build.
pre-commit --version
3.2.1
.pre-commit-config.yaml
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/nicklockwood/SwiftFormat
rev: 0.51.2
hooks:
- id: swiftformat
- repo: https://github.com/realm/SwiftLint
rev: 0.50.3
hooks:
- id: swiftlint~/.cache/pre-commit/pre-commit.log (if present)
version information
pre-commit version: 3.2.1
git --version: git version 2.39.2 (Apple Git-143)
sys.version:
3.10.9 | packaged by conda-forge | (main, Feb 2 2023, 20:26:08) [Clang 14.0.6 ]
sys.executable: /opt/homebrew/Caskroom/mambaforge/base/envs/torch2/bin/python
os.name: posix
sys.platform: darwin
error information
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/swift', 'build', '-C', '/Users/[REDACTED]/.cache/pre-commit/repoc7zisw50', '-c', 'release', '--build-path', '/Users/[REDACTED]/.cache/pre-commit/repoc7zisw50/swift_env-default/.build')
return code: 64
stdout: (none)
stderr:
error: Unknown option '-C'
Usage: swift build <options>
See 'build -help' for more information.
Traceback (most recent call last):
File "/opt/homebrew/Caskroom/mambaforge/base/envs/torch2/lib/python3.10/site-packages/pre_commit/error_handler.py", line 73, in error_handler
yield
File "/opt/homebrew/Caskroom/mambaforge/base/envs/torch2/lib/python3.10/site-packages/pre_commit/main.py", line 409, in main
return run(args.config, store, args)
File "/opt/homebrew/Caskroom/mambaforge/base/envs/torch2/lib/python3.10/site-packages/pre_commit/commands/run.py", line 442, in run
install_hook_envs(to_install, store)
File "/opt/homebrew/Caskroom/mambaforge/base/envs/torch2/lib/python3.10/site-packages/pre_commit/repository.py", line 248, in install_hook_envs
_hook_install(hook)
File "/opt/homebrew/Caskroom/mambaforge/base/envs/torch2/lib/python3.10/site-packages/pre_commit/repository.py", line 95, in _hook_install
lang.install_environment(
File "/opt/homebrew/Caskroom/mambaforge/base/envs/torch2/lib/python3.10/site-packages/pre_commit/languages/swift.py", line 45, in install_environment
cmd_output_b(
File "/opt/homebrew/Caskroom/mambaforge/base/envs/torch2/lib/python3.10/site-packages/pre_commit/util.py", line 110, in cmd_output_b
raise CalledProcessError(returncode, cmd, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/usr/bin/swift', 'build', '-C', '/Users/[REDACTED]/.cache/pre-commit/repoc7zisw50', '-c', 'release', '--build-path', '/Users/[REDACTED]/.cache/pre-commit/repoc7zisw50/swift_env-default/.build')
return code: 64
stdout: (none)
stderr:
error: Unknown option '-C'
Usage: swift build <options>
See 'build -help' for more information.
Reacted by Eric DeLabar
Metadata
Metadata
Assignees
Labels
No labels
Activity
asottile commentedon Apr 3, 2023
this feels to me like a regression in
swiftitself -- can you report a bug against them? in the meantime I'd recommend using swift 5.7.xkgrobelny-intive commentedon Apr 3, 2023
@asottile it is not
swiftdoing wrong things, butpre-commitorSwiftLintcalling the latestswiftimproperly.Don't know which is to be blamed though.
asottile commentedon Apr 3, 2023
it worked fine before, something changed without notice in swift which broke it
edelabar commentedon Apr 3, 2023
Apple pushed latest Xcode 14.3 to anyone that downloaded Xcode via the App Store over the weekend. This came with Swift 5.8, which doesn't support the
-Ccommand line option.If I switch back to swift 5.7.2 (from Xcode 14.2) I get this from the command line:
Some Googling finds this: exercism/swift#319 which seems to indicate that
-Cis deprecated and--package-pathis the new option.asottile commentedon Apr 3, 2023
is there some changelog that mentions this? I can't find anything about this ever being announced as a deprecation or a removal
edelabar commentedon Apr 3, 2023
I tried to find a change log or a bug or something, all I can find is the output from the swift command line.
#2836 if it helps...
I'll gladly help test in any way if someone can help me get setup to use this from source on my machine. I'm not much of a python dev... I'm currently installed via homebrew.
asottile commentedon Apr 3, 2023
via #2836
edelabar commentedon Apr 4, 2023
Pulled-down v3.2.2 from Homebrew this morning, confirmed it works with Xcode 14.2 (swift 5.7.2) and 14.3 (swift 5.8) command line tools.
Thanks for the help!
chore(deps): update dependency pre-commit to v3 (#2)