FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

SwiftLint doesn't compile on Swift 5.8 · Issue #2835 · pre-commit/pre-commit · GitHub

Repository navigation

SwiftLint doesn't compile on Swift 5.8 #2835

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.

Activity

  1. asottile commented on Apr 3, 2023

    Member

    this feels to me like a regression in swift itself -- can you report a bug against them? in the meantime I'd recommend using swift 5.7.x

  2. kgrobelny-intive commented on Apr 3, 2023

    Author

    @asottile it is not swift doing wrong things, but pre-commit or SwiftLint calling the latest swift improperly.
    Don't know which is to be blamed though.

  3. asottile commented on Apr 3, 2023

    Member

    it worked fine before, something changed without notice in swift which broke it

  4. edelabar commented on Apr 3, 2023

    Contributor

    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 -C command line option.

    If I switch back to swift 5.7.2 (from Xcode 14.2) I get this from the command line:

    $ swift build -C 
    error: Missing value for '-C <_deprecated_chdir>'
    Help:  -C <_deprecated_chdir>  
    Usage: swift build <options>
      See 'build -help' for more information.
    

    Some Googling finds this: exercism/swift#319 which seems to indicate that -C is deprecated and --package-path is the new option.

  5. asottile commented on Apr 3, 2023

    Member

    is there some changelog that mentions this? I can't find anything about this ever being announced as a deprecation or a removal

  6. edelabar commented on Apr 3, 2023

    Contributor

    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.

  7. asottile commented on Apr 3, 2023

    Member

    via #2836

  8. edelabar commented on Apr 4, 2023

    Contributor

    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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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


      Back | FazBrowse Home | New Git URL