Compare commits

...

5 Commits

Author SHA1 Message Date
JP Simard e932b7f692
Migrate SwiftLint commands to SwiftSyntax 2018-11-25 00:22:51 -08:00
JP Simard 32cecf5ece
Fixup 2018-11-24 23:37:58 -08:00
JP Simard 077559c377
Toolchain 2018-11-24 23:29:49 -08:00
JP Simard ed0a7a18f0
Deserialize syntax tree using byte tree 2018-11-24 23:24:37 -08:00
JP Simard d2d154069d
Migrate FallthroughRule to SwiftSyntax [skip ci] 2018-11-24 23:24:37 -08:00
30 changed files with 9738 additions and 2555 deletions

View File

@ -1,2 +1,2 @@
github "jpsim/SourceKitten" ~> 0.21.3
github "jpsim/SourceKitten" "master"
github "scottrhoyt/SwiftyTextTable" ~> 0.8.2

View File

@ -1,7 +1,7 @@
github "Carthage/Commandant" "0.15.0"
github "antitypical/Result" "4.0.0"
github "drmohundro/SWXMLHash" "4.7.4"
github "jpsim/SourceKitten" "0.21.3"
github "jpsim/SourceKitten" "9e922329570adf5ce2ae88d7413eb5148a61e21a"
github "jpsim/Yams" "1.0.1"
github "jspahrsummers/xcconfigs" "0.12"
github "krzyzanowskim/CryptoSwift" "0.13.0"

@ -1 +1 @@
Subproject commit 79ca340f609adee48defa966e6a3dd0e0acbeb08
Subproject commit 9e922329570adf5ce2ae88d7413eb5148a61e21a

View File

@ -50,9 +50,18 @@
"package": "SourceKitten",
"repositoryURL": "https://github.com/jpsim/SourceKitten.git",
"state": {
"branch": null,
"revision": "79ca340f609adee48defa966e6a3dd0e0acbeb08",
"version": "0.21.3"
"branch": "master",
"revision": "b039da63355c73c1351b4552cb7818773376534d",
"version": null
}
},
{
"package": "SwiftSyntax",
"repositoryURL": "https://github.com/jpsim/swift-syntax.git",
"state": {
"branch": "codegen-11-24",
"revision": "f893b851ffa503dac4caf067f133be6afc488398",
"version": null
}
},
{

View File

@ -8,8 +8,9 @@ let package = Package(
.library(name: "SwiftLintFramework", targets: ["SwiftLintFramework"])
],
dependencies: [
.package(url: "https://github.com/jpsim/swift-syntax.git", .branch("codegen-11-24")),
.package(url: "https://github.com/Carthage/Commandant.git", from: "0.15.0"),
.package(url: "https://github.com/jpsim/SourceKitten.git", from: "0.21.3"),
.package(url: "https://github.com/jpsim/SourceKitten.git", .branch("master")),
.package(url: "https://github.com/jpsim/Yams.git", from: "1.0.1"),
.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", from: "0.13.0"),
.package(url: "https://github.com/scottrhoyt/SwiftyTextTable.git", from: "0.8.2"),
@ -28,6 +29,7 @@ let package = Package(
dependencies: [
"CryptoSwift",
"SourceKittenFramework",
"SwiftSyntax",
"Yams",
]
),

View File

@ -1,5 +1,6 @@
import Foundation
import SourceKittenFramework
import SwiftSyntax
private var responseCache = Cache({ file -> [String: SourceKitRepresentable]? in
do {
@ -11,6 +12,22 @@ private var responseCache = Cache({ file -> [String: SourceKitRepresentable]? in
return nil
}
})
private var syntaxCache = Cache({ file -> SourceFileSyntax? in
do {
let response = try Request.syntaxTree(file: file, byteTree: true).sendIfNotDisabled()
guard let syntaxTreeData = response["key.serialized_syntax_tree"] as? Data else {
return nil
}
let deserializer = SyntaxTreeDeserializer()
return try deserializer.deserialize(syntaxTreeData, serializationFormat: .byteTree)
} catch let error as Request.Error {
queuedPrintError(error.description)
return nil
} catch {
return nil
}
})
private var structureCache = Cache({ file -> Structure? in
if let structure = responseCache.get(file).map(Structure.init) {
queueForRebuild.append(structure)
@ -98,13 +115,13 @@ extension File {
internal var sourcekitdFailed: Bool {
get {
return responseCache.get(self) == nil
return syntaxCache.get(self) == nil
}
set {
if newValue {
responseCache.set(key: cacheKey, value: nil)
syntaxCache.set(key: cacheKey, value: nil)
} else {
responseCache.unset(key: cacheKey)
syntaxCache.unset(key: cacheKey)
}
}
}
@ -129,6 +146,17 @@ extension File {
return structure
}
internal var syntax: SourceFileSyntax {
guard let syntax = syntaxCache.get(self) else {
if let handler = assertHandler {
handler()
return SourceFileSyntax({ _ in })
}
queuedFatalError("Never call this for file that sourcekitd fails.")
}
return syntax
}
internal var syntaxMap: SyntaxMap {
guard let syntaxMap = syntaxMapCache.get(self) else {
if let handler = assertHandler {
@ -151,7 +179,7 @@ extension File {
return syntaxTokensByLines
}
internal var syntaxKindsByLines: [[SyntaxKind]] {
internal var syntaxKindsByLines: [[SourceKittenFramework.SyntaxKind]] {
guard let syntaxKindsByLines = syntaxKindsByLinesCache.get(self) else {
if let handler = assertHandler {
handler()
@ -164,6 +192,7 @@ extension File {
public func invalidateCache() {
responseCache.invalidate(self)
syntaxCache.invalidate(self)
assertHandlerCache.invalidate(self)
structureCache.invalidate(self)
syntaxMapCache.invalidate(self)
@ -174,6 +203,7 @@ extension File {
internal static func clearCaches() {
queueForRebuild.clear()
responseCache.clear()
syntaxCache.clear()
assertHandlerCache.clear()
structureCache.clear()
syntaxMapCache.clear()

View File

@ -1,5 +1,6 @@
import Foundation
import SourceKittenFramework
import SwiftSyntax
internal func regex(_ pattern: String,
options: NSRegularExpression.Options? = nil) -> NSRegularExpression {
@ -58,14 +59,39 @@ extension File {
if sourcekitdFailed {
return []
}
let contents = self.contents.bridge()
let range = range ?? NSRange(location: 0, length: contents.length)
let pattern = "swiftlint:(enable|disable)(:previous|:this|:next)?\\ [^\\n]+"
return match(pattern: pattern, with: [.comment], range: range).compactMap { range in
return Command(string: contents, range: range)
}.flatMap { command in
return command.expand()
class CommandVisitor: SyntaxVisitor {
var commands = [Command]()
var expandedCommands: [Command] {
return commands.flatMap { $0.expand() }
}
override func visit(_ token: TokenSyntax) -> SyntaxVisitorContinueKind {
for piece in token.leadingTrivia + token.trailingTrivia {
switch piece {
case let .lineComment(text),
let .docLineComment(text),
let .docBlockComment(text),
let .blockComment(text):
if text.contains("swiftlint:"),
case let position = token.positionAfterSkippingLeadingTrivia,
let command = Command(string: text, trailingLine: position.line,
trailingCharacter: position.column) {
commands.append(command)
}
default:
break
}
}
return super.visit(token)
}
}
let visitor = CommandVisitor()
syntax.walk(visitor)
return visitor.expandedCommands
}
fileprivate func endOf(next command: Command?) -> Location {
@ -88,7 +114,8 @@ extension File {
return Location(file: path, line: nextLine, character: nextCharacter)
}
internal func match(pattern: String, with syntaxKinds: [SyntaxKind], range: NSRange? = nil) -> [NSRange] {
internal func match(pattern: String, with syntaxKinds: [SourceKittenFramework.SyntaxKind],
range: NSRange? = nil) -> [NSRange] {
return match(pattern: pattern, range: range)
.filter { $0.1 == syntaxKinds }
.map { $0.0 }
@ -107,8 +134,9 @@ extension File {
}
}
internal func matchesAndSyntaxKinds(matching pattern: String,
range: NSRange? = nil) -> [(NSTextCheckingResult, [SyntaxKind])] {
internal func matchesAndSyntaxKinds(
matching pattern: String,
range: NSRange? = nil) -> [(NSTextCheckingResult, [SourceKittenFramework.SyntaxKind])] {
return matchesAndTokens(matching: pattern, range: range).map { textCheckingResult, tokens in
(textCheckingResult, tokens.compactMap { SyntaxKind(rawValue: $0.type) })
}
@ -119,7 +147,7 @@ extension File {
return matchesAndTokens(matching: pattern, range: range).map { ($0.0.range, $0.1) }
}
internal func match(pattern: String, range: NSRange? = nil) -> [(NSRange, [SyntaxKind])] {
internal func match(pattern: String, range: NSRange? = nil) -> [(NSRange, [SourceKittenFramework.SyntaxKind])] {
return matchesAndSyntaxKinds(matching: pattern, range: range).map { textCheckingResult, syntaxKinds in
(textCheckingResult.range, syntaxKinds)
}
@ -178,7 +206,7 @@ extension File {
return results
}
internal func syntaxKindsByLine() -> [[SyntaxKind]]? {
internal func syntaxKindsByLine() -> [[SourceKittenFramework.SyntaxKind]]? {
guard !sourcekitdFailed, let tokens = syntaxTokensByLine() else {
return nil
}
@ -199,7 +227,7 @@ extension File {
file contents.
*/
internal func match(pattern: String,
excludingSyntaxKinds syntaxKinds: Set<SyntaxKind>,
excludingSyntaxKinds syntaxKinds: Set<SourceKittenFramework.SyntaxKind>,
range: NSRange? = nil) -> [NSRange] {
return match(pattern: pattern, range: range)
.filter { $0.1.filter(syntaxKinds.contains).isEmpty }
@ -210,7 +238,7 @@ extension File {
internal func match(pattern: String,
range: NSRange? = nil,
excludingSyntaxKinds: Set<SyntaxKind>,
excludingSyntaxKinds: Set<SourceKittenFramework.SyntaxKind>,
excludingPattern: String,
exclusionMapping: MatchMapping = { $0.range }) -> [NSRange] {
let matches = match(pattern: pattern, excludingSyntaxKinds: excludingSyntaxKinds)

View File

@ -62,6 +62,39 @@ public struct Command: Equatable {
self.modifier = modifier
}
public init?(string: String, trailingLine: Int, trailingCharacter: Int) {
let scanner = Scanner(string: string)
_ = scanner.scanUpToString("swiftlint:")
_ = scanner.scanString(string: "swiftlint:")
guard let actionAndModifierString = scanner.scanUpToString(" ") else {
return nil
}
let actionAndModifierScanner = Scanner(string: actionAndModifierString)
guard let actionString = actionAndModifierScanner.scanUpToString(":"),
let action = Action(rawValue: actionString)
else {
return nil
}
self.action = action
line = trailingLine
character = trailingCharacter
let ruleTexts = scanner.string.bridge().substring(
from: scanner.scanLocation + 1
).components(separatedBy: .whitespaces).map { $0.trimmingCharacters(in: .whitespacesAndNewlines) }
ruleIdentifiers = Set(ruleTexts.map(RuleIdentifier.init(_:)))
// Modifier
let hasModifier = actionAndModifierScanner.scanString(string: ":") != nil
if hasModifier {
let modifierString = actionAndModifierScanner.string.bridge()
.substring(from: actionAndModifierScanner.scanLocation)
modifier = Modifier(rawValue: modifierString)
} else {
modifier = nil
}
}
public init?(string: NSString, range: NSRange) {
let scanner = Scanner(string: string.substring(with: range))
_ = scanner.scanString(string: "swiftlint:")

View File

@ -1,4 +1,5 @@
import SourceKittenFramework
import SwiftSyntax
public struct FallthroughRule: ConfigurationProviderRule, OptInRule, AutomaticTestableRule {
@ -28,10 +29,32 @@ public struct FallthroughRule: ConfigurationProviderRule, OptInRule, AutomaticTe
)
public func validate(file: File) -> [StyleViolation] {
return file.match(pattern: "fallthrough", with: [.keyword]).map {
StyleViolation(ruleDescription: type(of: self).description,
severity: configuration.severity,
location: Location(file: file, characterOffset: $0.location))
// SourceKitten implementation
// return file.match(pattern: "fallthrough", with: [.keyword]).map {
// StyleViolation(ruleDescription: type(of: self).description,
// severity: configuration.severity,
// location: Location(file: file, characterOffset: $0.location))
// SwiftSyntax implementation
class FallthroughVisitor: SyntaxVisitor {
var positions = [AbsolutePosition]()
override func shouldVisit(_ kind: SwiftSyntax.SyntaxKind) -> Bool {
return kind == .fallthroughStmt
}
override func visit(_ node: FallthroughStmtSyntax) -> SyntaxVisitorContinueKind {
positions.append(node.positionAfterSkippingLeadingTrivia)
return super.visit(node)
}
}
let visitor = FallthroughVisitor()
file.syntax.walk(visitor)
return visitor.positions.map { position in
StyleViolation(ruleDescription: type(of: self).description, severity: configuration.severity,
location: Location(file: file.path, line: position.line, character: position.column))
}
}
}

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

File diff suppressed because it is too large Load Diff

View File

@ -2,6 +2,6 @@
<Workspace
version = "1.0">
<FileRef
location = "self:SwiftLint.xcodeproj">
location = "self:">
</FileRef>
</Workspace>
</Workspace>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>
<false/>
</dict>
</plist>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "9999"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -14,7 +14,7 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0D1216C19E87B05005E4BAA"
BlueprintIdentifier = "SwiftLint::SwiftLintFramework"
BuildableName = "SwiftLintFramework.framework"
BlueprintName = "SwiftLintFramework"
ReferencedContainer = "container:SwiftLint.xcodeproj">
@ -22,15 +22,15 @@
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0D1217619E87B05005E4BAA"
BuildableName = "SwiftLintFrameworkTests.xctest"
BlueprintName = "SwiftLintFrameworkTests"
BlueprintIdentifier = "SwiftLint::swiftlint"
BuildableName = "swiftlint"
BlueprintName = "swiftlint"
ReferencedContainer = "container:SwiftLint.xcodeproj">
</BuildableReference>
</BuildActionEntry>
@ -46,22 +46,13 @@
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0D1217619E87B05005E4BAA"
BlueprintIdentifier = "SwiftLint::SwiftLintFrameworkTests"
BuildableName = "SwiftLintFrameworkTests.xctest"
BlueprintName = "SwiftLintFrameworkTests"
ReferencedContainer = "container:SwiftLint.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0D1216C19E87B05005E4BAA"
BuildableName = "SwiftLintFramework.framework"
BlueprintName = "SwiftLintFramework"
ReferencedContainer = "container:SwiftLint.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
@ -78,7 +69,7 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0D1216C19E87B05005E4BAA"
BlueprintIdentifier = "SwiftLint::SwiftLintFramework"
BuildableName = "SwiftLintFramework.framework"
BlueprintName = "SwiftLintFramework"
ReferencedContainer = "container:SwiftLint.xcodeproj">
@ -88,20 +79,11 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0D1216C19E87B05005E4BAA"
BuildableName = "SwiftLintFramework.framework"
BlueprintName = "SwiftLintFramework"
ReferencedContainer = "container:SwiftLint.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
version = "2.0">
LastUpgradeVersion = "9999"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
@ -14,8 +14,8 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0E7B63119E9C64500EDBA4D"
BuildableName = "swiftlint.app"
BlueprintIdentifier = "SwiftLint::swiftlint"
BuildableName = "swiftlint"
BlueprintName = "swiftlint"
ReferencedContainer = "container:SwiftLint.xcodeproj">
</BuildableReference>
@ -26,41 +26,19 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
onlyGenerateCoverageForSpecifiedTargets = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<CodeCoverageTargets>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0D1216C19E87B05005E4BAA"
BuildableName = "SwiftLintFramework.framework"
BlueprintName = "SwiftLintFramework"
ReferencedContainer = "container:SwiftLint.xcodeproj">
</BuildableReference>
</CodeCoverageTargets>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES"
testExecutionOrdering = "random">
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0D1217619E87B05005E4BAA"
BlueprintIdentifier = "SwiftLint::SwiftLintFrameworkTests"
BuildableName = "SwiftLintFrameworkTests.xctest"
BlueprintName = "SwiftLintFrameworkTests"
ReferencedContainer = "container:SwiftLint.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0E7B63119E9C64500EDBA4D"
BuildableName = "swiftlint.app"
BlueprintName = "swiftlint"
ReferencedContainer = "container:SwiftLint.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
@ -69,38 +47,32 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
useCustomWorkingDirectory = "YES"
customWorkingDirectory = "~/Projects/Lyft-iOS"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "NO"
debugXPCServices = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "NO"
viewDebuggingEnabled = "No">
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0E7B63119E9C64500EDBA4D"
BuildableName = "swiftlint.app"
BlueprintIdentifier = "SwiftLint::swiftlint"
BuildableName = "swiftlint"
BlueprintName = "swiftlint"
ReferencedContainer = "container:SwiftLint.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "lint --no-cache"
argument = "lint --quiet --no-cache"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
<EnvironmentVariables>
<EnvironmentVariable
key = "DEVELOPER_DIR"
value = "${DEVELOPER_DIR}"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "TOOLCHAINS"
value = "${TOOLCHAINS}"
key = "TOOLCHAIN_DIR"
value = "/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2018-11-22-a.xctoolchain"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
@ -108,21 +80,11 @@
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "D0E7B63119E9C64500EDBA4D"
BuildableName = "swiftlint.app"
BlueprintName = "swiftlint"
ReferencedContainer = "container:SwiftLint.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:SwiftLint.xcodeproj">
</FileRef>
<FileRef
location = "group:Carthage/Checkouts/SourceKitten/sourcekitten.xcodeproj">
</FileRef>
<FileRef
location = "group:Carthage/Checkouts/Commandant/Commandant.xcodeproj">
</FileRef>
<FileRef
location = "group:Carthage/Checkouts/Result/Result.xcodeproj">
</FileRef>
<FileRef
location = "group:Carthage/Checkouts/SWXMLHash/SWXMLHash.xcodeproj">
</FileRef>
<FileRef
location = "group:Carthage/Checkouts/SwiftyTextTable/SwiftyTextTable.xcodeproj">
</FileRef>
<FileRef
location = "group:Carthage/Checkouts/Yams/Yams.xcodeproj">
</FileRef>
<FileRef
location = "group:Carthage/Checkouts/CryptoSwift/CryptoSwift.xcodeproj">
</FileRef>
</Workspace>

View File

@ -5,8 +5,7 @@ import XCTest
private extension Command {
init?(string: String) {
let nsString = string.bridge()
self.init(string: nsString, range: NSRange(location: 3, length: nsString.length - 4))
self.init(string: string, trailingLine: 2, trailingCharacter: 1)
}
}
@ -26,7 +25,7 @@ class CommandTests: XCTestCase {
func testDisable() {
let input = "// swiftlint:disable rule_id\n"
let file = File(contents: input)
let expected = Command(action: .disable, ruleIdentifiers: ["rule_id"], line: 1, character: 29, modifier: nil)
let expected = Command(action: .disable, ruleIdentifiers: ["rule_id"], line: 2, character: 1, modifier: nil)
XCTAssertEqual(file.commands(), [expected])
XCTAssertEqual(Command(string: input), expected)
}
@ -34,7 +33,7 @@ class CommandTests: XCTestCase {
func testDisablePrevious() {
let input = "// swiftlint:disable:previous rule_id\n"
let file = File(contents: input)
let expected = Command(action: .disable, ruleIdentifiers: ["rule_id"], line: 1, character: 38,
let expected = Command(action: .disable, ruleIdentifiers: ["rule_id"], line: 2, character: 1,
modifier: .previous)
XCTAssertEqual(file.commands(), expected.expand())
XCTAssertEqual(Command(string: input), expected)
@ -43,7 +42,7 @@ class CommandTests: XCTestCase {
func testDisableThis() {
let input = "// swiftlint:disable:this rule_id\n"
let file = File(contents: input)
let expected = Command(action: .disable, ruleIdentifiers: ["rule_id"], line: 1, character: 34, modifier: .this)
let expected = Command(action: .disable, ruleIdentifiers: ["rule_id"], line: 2, character: 1, modifier: .this)
XCTAssertEqual(file.commands(), expected.expand())
XCTAssertEqual(Command(string: input), expected)
}
@ -51,7 +50,7 @@ class CommandTests: XCTestCase {
func testDisableNext() {
let input = "// swiftlint:disable:next rule_id\n"
let file = File(contents: input)
let expected = Command(action: .disable, ruleIdentifiers: ["rule_id"], line: 1, character: 34, modifier: .next)
let expected = Command(action: .disable, ruleIdentifiers: ["rule_id"], line: 2, character: 1, modifier: .next)
XCTAssertEqual(file.commands(), expected.expand())
XCTAssertEqual(Command(string: input), expected)
}
@ -59,7 +58,7 @@ class CommandTests: XCTestCase {
func testEnable() {
let input = "// swiftlint:enable rule_id\n"
let file = File(contents: input)
let expected = Command(action: .enable, ruleIdentifiers: ["rule_id"], line: 1, character: 28, modifier: nil)
let expected = Command(action: .enable, ruleIdentifiers: ["rule_id"], line: 2, character: 1, modifier: nil)
XCTAssertEqual(file.commands(), [expected])
XCTAssertEqual(Command(string: input), expected)
}
@ -67,7 +66,7 @@ class CommandTests: XCTestCase {
func testEnablePrevious() {
let input = "// swiftlint:enable:previous rule_id\n"
let file = File(contents: input)
let expected = Command(action: .enable, ruleIdentifiers: ["rule_id"], line: 1, character: 37,
let expected = Command(action: .enable, ruleIdentifiers: ["rule_id"], line: 2, character: 1,
modifier: .previous)
XCTAssertEqual(file.commands(), expected.expand())
XCTAssertEqual(Command(string: input), expected)
@ -76,7 +75,7 @@ class CommandTests: XCTestCase {
func testEnableThis() {
let input = "// swiftlint:enable:this rule_id\n"
let file = File(contents: input)
let expected = Command(action: .enable, ruleIdentifiers: ["rule_id"], line: 1, character: 33, modifier: .this)
let expected = Command(action: .enable, ruleIdentifiers: ["rule_id"], line: 2, character: 1, modifier: .this)
XCTAssertEqual(file.commands(), expected.expand())
XCTAssertEqual(Command(string: input), expected)
}
@ -84,7 +83,7 @@ class CommandTests: XCTestCase {
func testEnableNext() {
let input = "// swiftlint:enable:next rule_id\n"
let file = File(contents: input)
let expected = Command(action: .enable, ruleIdentifiers: ["rule_id"], line: 1, character: 33, modifier: .next)
let expected = Command(action: .enable, ruleIdentifiers: ["rule_id"], line: 2, character: 1, modifier: .next)
XCTAssertEqual(file.commands(), expected.expand())
XCTAssertEqual(Command(string: input), expected)
}