Skip to content

SwiftLint doesn't compile on Swift 5.8 #2835

@kgrobelny-intive

Description

@kgrobelny-intive

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions