Swiftlint: Adding SwiftLint as an dependency with Swift Package Manager results in build errors

Created on 4 Feb 2020  路  9Comments  路  Source: realm/SwiftLint

New Issue Checklist

Describe the bug

When adding swiftlint as a dependency with SPM it fails to build the executable. Cloning latest and checking out 0.38.2 works and the command 麓swift run swiftlint麓works.

Complete output when running SwiftLint, including the stack trace and command used

麓swift run swiftlint麓

First error:

.build/checkouts/SwiftLint/Source/SwiftLintFramework/Rules/Idiomatic/ConvenienceTypeRule.swift:101:94: error: extra argument 'length' in call
let contents = file.stringView.substringWithByteRange(start: offset, length: length) else {

Environment

Apple Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
Target: x86_64-apple-darwin19.3.0

Most helpful comment

SPM doesn't work with 0.39.2 version either. SourceKittenFramework throws two compile errors.

./Library/Developer/Xcode/DerivedData/project/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/Exec.swift:67:23: Use of unresolved identifier 'Process'

./Library/Developer/Xcode/DerivedData/project/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/JSONOutput.swift:28:41: 'sortedKeys' is only available in iOS 11.0 or newer

All 9 comments

We are experiencing the same issue when including swiftlint as an SPM dependency using the latests release ..., from: "0.38.2", but it works if we use ..., .branch("master")

SPM doesn't work with 0.39.2 version either. SourceKittenFramework throws two compile errors.

./Library/Developer/Xcode/DerivedData/project/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/Exec.swift:67:23: Use of unresolved identifier 'Process'

./Library/Developer/Xcode/DerivedData/project/SourcePackages/checkouts/SourceKitten/Source/SourceKittenFramework/JSONOutput.swift:28:41: 'sortedKeys' is only available in iOS 11.0 or newer

Did anybody maybe find the last release where running the swift run swiftLint command succeeds? I would not build something rather using master.

I have the same issue as @borut-t with 0.39.2 and master

I have the same issue.

I have the same issue. Xcode 12.1

Use of unresolved identifier 'Process'
'sortedKeys' is only available in iOS 11.0 or newer

These indicate to me that SwiftLint is being compiled for an iOS platform target. SwiftLint can only be built on macOS and Linux.

what does it means @jpsim? How can we configure SwiftLint to run with SPM on Xcode12.1. I'm having the same issue with Xcode 12.1 and SwiftLint 0.41.

It works fine on CLI but not integrated to the project as a build phase. How can we fix that?

Please open a new issue with the complete steps you鈥檙e taking to encounter the issue and I might be able to help more.

Was this page helpful?
0 / 5 - 0 ratings