Skip to content
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

SwiftLint v0.50.0 fails to be installed with pre-commit #4559

Closed
2 tasks done
koikos opened this issue Nov 18, 2022 · 2 comments · Fixed by #4563
Closed
2 tasks done

SwiftLint v0.50.0 fails to be installed with pre-commit #4559

koikos opened this issue Nov 18, 2022 · 2 comments · Fixed by #4563

Comments

@koikos
Copy link

koikos commented Nov 18, 2022

New Issue Checklist

Describe the bug

I've added SwiftLint to .pre-commit-config.yaml and run pre-commit install, then pre-commit run --all-files. Pre-commit clones the SwiftLint repo, but installation fails.

Complete output when running SwiftLint pre-commit, including the stack trace and command used
$ pre-commit install         
pre-commit installed at .git/hooks/pre-commit
$ pre-commit run --all-files 
[INFO] Initializing environment for https://github.com/realm/SwiftLint.
[INFO] Installing environment for https://github.com/realm/SwiftLint.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/swift', 'build', '-C', '/Users/mikozik/.cache/pre-commit/repognosv8l2', '-c', 'release', '--build-path', '/Users/mikozik/.cache/pre-commit/repognosv8l2/swift_env-default/.build')
return code: 1
expected return code: 0
stdout:
    Compiling plugin GenerateManualPlugin...
    Compiling plugin SwiftLintPlugin...
    Building for production...
    [0/14] Compiling SourceKit SourceKit.c
    [1/14] Compiling Clang_C Clang_C.c
    remark: Incremental compilation has been disabled: it is not compatible with whole module optimizationremark: Incremental compilation has been disabled: it is not compatible with whole module optimizationremark: Incremental compilation has been disabled: it is not compatible with whole module optimizationremark: Incremental compilation has been disabled: it is not compatible with whole module optimizationremark: Incremental compilation has been disabled: it is not compatible with whole module optimization[2/19] Compiling reader.c
    [3/19] Compiling parser.c
    [4/19] Compiling writer.c
    [5/19] Compiling api.c
    [7/19] Compiling CollectionConcurrencyKit CollectionConcurrencyKit.swift
    [7/19] Compiling emitter.c
    [8/19] Compiling scanner.c
    remark: Incremental compilation has been disabled: it is not compatible with whole module optimization[10/20] Compiling ArgumentParserToolInfo ToolInfo.swift
    remark: Incremental compilation has been disabled: it is not compatible with whole module optimization[11/21] Compiling SwiftyTextTable TextTable.swift
    [12/21] Compiling SWXMLHash XMLAttributeDeserializable.swift
    [13/21] Compiling Yams Constructor.swift
    remark: Incremental compilation has been disabled: it is not compatible with whole module optimization[14/22] Compiling ArgumentParser BashCompletionsGenerator.swift
    [15/22] Compiling SourceKittenFramework ByteCount.swift
    [16/22] Compiling SwiftSyntax AbsolutePosition.swift
    remark: Incremental compilation has been disabled: it is not compatible with whole module optimizationremark: Incremental compilation has been disabled: it is not compatible with whole module optimizationremark: Incremental compilation has been disabled: it is not compatible with whole module optimization[16/25] Archiving libSwiftSyntax.a
    [18/25] Compiling SwiftBasicFormat SyntaxProtocol+Formatted.swift
    [19/25] Compiling IDEUtils Syntax+Classifications.swift
    [19/25] Archiving libIDEUtils.a
    [21/25] Compiling SwiftDiagnostics Diagnostic.swift
    remark: Incremental compilation has been disabled: it is not compatible with whole module optimization[22/26] Compiling SwiftParser Attributes.swift
    remark: Incremental compilation has been disabled: it is not compatible with whole module optimizationremark: Incremental compilation has been disabled: it is not compatible with whole module optimization[22/28] Archiving libSwiftParser.a
    [24/28] Compiling SwiftOperators Operator.swift
    [24/28] Archiving libSwiftOperators.a
    [26/28] Compiling SwiftParserDiagnostics DiagnosticExtensions.swift
    remark: Incremental compilation has been disabled: it is not compatible with whole module optimization[27/29] Compiling SwiftSyntaxBuilder ConvenienceInitializers.swift
    remark: Incremental compilation has been disabled: it is not compatible with whole module optimization[27/29] Archiving libSwiftSyntaxBuilder.a
    [29/30] Compiling SwiftLintFramework RuleDocumentation.swift
    remark: Incremental compilation has been disabled: it is not compatible with whole module optimizationremark: Incremental compilation has been disabled: it is not compatible with whole module optimization[30/32] Compiling swiftlint Analyze.swift
    [31/32] Compiling SwiftLintTestHelpers RuleDescription+Examples.swift
    /Users/mikozik/.cache/pre-commit/repognosv8l2/Tests/SwiftLintTestHelpers/TestHelpers.swift:3:18: error: module 'SwiftLintFramework' was not compiled for testing
    @testable import SwiftLintFramework
    ~~~~~~~~~~       ^
    swift_driver/main.swift:42: Fatal error: Invalid state, could not kill process
    [31/32] Linking swiftlint
    
stderr:
    warning: '--build-path' option is deprecated; use '--scratch-path' instead
    warning: '--chdir/-C' option is deprecated; use '--package-path' instead
    Fetching https://github.com/apple/swift-syntax.git from cache
    Fetched https://github.com/apple/swift-syntax.git (1.13s)
    Fetching https://github.com/jpsim/SourceKitten.git from cache
    Fetched https://github.com/jpsim/SourceKitten.git (0.75s)
    Fetching https://github.com/apple/swift-argument-parser.git from cache
    Fetching https://github.com/JohnSundell/CollectionConcurrencyKit.git from cache
    Fetching https://github.com/scottrhoyt/SwiftyTextTable.git from cache
    Fetched https://github.com/apple/swift-argument-parser.git (0.79s)
    Fetching https://github.com/drmohundro/SWXMLHash.git from cache
    Fetched https://github.com/scottrhoyt/SwiftyTextTable.git (0.79s)
    Fetching https://github.com/jpsim/Yams.git from cache
    Fetched https://github.com/JohnSundell/CollectionConcurrencyKit.git (0.79s)
    Fetched https://github.com/drmohundro/SWXMLHash.git (0.80s)
    Fetched https://github.com/jpsim/Yams.git (0.80s)
    Computing version for https://github.com/jpsim/Yams.git
    Computed https://github.com/jpsim/Yams.git at 5.0.1 (0.86s)
    Computing version for https://github.com/drmohundro/SWXMLHash.git
    Computed https://github.com/drmohundro/SWXMLHash.git at 7.0.1 (0.81s)
    Computing version for https://github.com/apple/swift-argument-parser.git
    Computed https://github.com/apple/swift-argument-parser.git at 1.1.4 (0.93s)
    Computing version for https://github.com/JohnSundell/CollectionConcurrencyKit.git
    Computed https://github.com/JohnSundell/CollectionConcurrencyKit.git at 0.2.0 (0.88s)
    Computing version for https://github.com/scottrhoyt/SwiftyTextTable.git
    Computed https://github.com/scottrhoyt/SwiftyTextTable.git at 0.9.0 (0.92s)
    Creating working copy for https://github.com/apple/swift-syntax.git
    Working copy of https://github.com/apple/swift-syntax.git resolved at b0b5f8d73ff5ddc0c1d6ececcc094995e8bf57dd
    Creating working copy for https://github.com/apple/swift-argument-parser.git
    Working copy of https://github.com/apple/swift-argument-parser.git resolved at 1.1.4
    Creating working copy for https://github.com/JohnSundell/CollectionConcurrencyKit.git
    Working copy of https://github.com/JohnSundell/CollectionConcurrencyKit.git resolved at 0.2.0
    Creating working copy for https://github.com/jpsim/SourceKitten.git
    Working copy of https://github.com/jpsim/SourceKitten.git resolved at a9e6df65d8e31e0fa6e8a05ffe40ecd54a645871
    Creating working copy for https://github.com/scottrhoyt/SwiftyTextTable.git
    Working copy of https://github.com/scottrhoyt/SwiftyTextTable.git resolved at 0.9.0
    Creating working copy for https://github.com/jpsim/Yams.git
    Working copy of https://github.com/jpsim/Yams.git resolved at 5.0.1
    Creating working copy for https://github.com/drmohundro/SWXMLHash.git
    Working copy of https://github.com/drmohundro/SWXMLHash.git resolved at 7.0.1

Environment

  • SwiftLint version (run swiftlint version to be sure)?
    • 0.50.0
  • Installation method used (Homebrew, CocoaPods, building from source, etc)?
    • pre-commit
  • Paste your configuration file:
repos:
-   repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v3.2.0
    hooks:
    -   id: trailing-whitespace
    -   id: end-of-file-fixer
    -   id: check-yaml
    -   id: check-added-large-files
-   repo: https://github.com/realm/SwiftLint
    rev: 0.50.0
    hooks:
    -   id: swiftlint
  • Are you using nested configurations?
    • No
  • Which Xcode version are you using (check xcodebuild -version)?
    • Xcode 14.1 Build version 14B47b
  • Do you have a sample that shows the issue?
    • No

Other:

  • I switched to SwiftLint 0.49.0 and it installed flawlessly.
@jpsim
Copy link
Collaborator

jpsim commented Nov 19, 2022

Please only build the CLI with swift build -c release --product swiftlint instead of everything, including the test helper module introduced in 0.50.0, as is done with swift build -c release

@jpsim
Copy link
Collaborator

jpsim commented Nov 20, 2022

Should be fixed by #4563.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants