mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
fix a number of uncaught colon spacing violations
This commit is contained in:
@@ -73,7 +73,7 @@ public struct ClosureEndIndentationRule: ASTRule, OptInRule, ConfigurationProvid
|
||||
case let nameEndPosition = nameOffset + nameLength,
|
||||
let (bodyOffsetLine, _) = contents.lineAndCharacter(forByteOffset: nameEndPosition),
|
||||
startLine != endLine, bodyOffsetLine != endLine,
|
||||
!containsSingleLineClosure(dictionary: dictionary, endPosition: endOffset, file:file) else {
|
||||
!containsSingleLineClosure(dictionary: dictionary, endPosition: endOffset, file: file) else {
|
||||
return []
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public struct ClosureSpacingRule: CorrectableRule, ConfigurationProviderRule, Op
|
||||
to: foundRange.lowerBound)
|
||||
let location = validBraces[startIndex].location
|
||||
let length = validBraces[startIndex + 1 ].location + 1 - location
|
||||
ranges.append(NSRange(location:location, length: length))
|
||||
ranges.append(NSRange(location: location, length: length))
|
||||
bracesAsString.replaceSubrange(foundRange, with: "")
|
||||
validBraces.removeSubrange(startIndex...startIndex + 1)
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public struct LeadingWhitespaceRule: CorrectableRule, ConfigurationProviderRule,
|
||||
|
||||
let indexEnd = file.contents.index(
|
||||
file.contents.startIndex,
|
||||
offsetBy:spaceCount,
|
||||
offsetBy: spaceCount,
|
||||
limitedBy: file.contents.endIndex) ?? file.contents.endIndex
|
||||
file.write(file.contents.substring(from: indexEnd))
|
||||
let location = Location(file: file.path, line: max(file.lines.count, 1))
|
||||
|
||||
@@ -66,7 +66,7 @@ public struct PrivateOverFilePrivateRule: Rule, ConfigurationProviderRule, Corre
|
||||
let parts = syntaxTokens.prefix { offset > $0.offset }
|
||||
guard let lastKind = parts.last,
|
||||
SyntaxKind(rawValue: lastKind.type) == .attributeBuiltin,
|
||||
let aclName = contents.substringWithByteRange(start:lastKind.offset, length: lastKind.length),
|
||||
let aclName = contents.substringWithByteRange(start: lastKind.offset, length: lastKind.length),
|
||||
AccessControlLevel(description: aclName) == .fileprivate,
|
||||
let range = contents.byteRangeToNSRange(start: lastKind.offset, length: lastKind.length) else {
|
||||
return nil
|
||||
|
||||
+1
-1
@@ -62,7 +62,7 @@ public struct CyclomaticComplexityConfiguration: RuleConfiguration, Equatable {
|
||||
length = SeverityLevelsConfiguration(warning: warning, error: error)
|
||||
} else if let configDict = configuration as? [String: Any], !configDict.isEmpty {
|
||||
for (string, value) in configDict {
|
||||
guard let key = ConfigurationKey(rawValue:string) else {
|
||||
guard let key = ConfigurationKey(rawValue: string) else {
|
||||
throw ConfigurationError.unknownConfiguration
|
||||
}
|
||||
switch (key, value) {
|
||||
|
||||
Reference in New Issue
Block a user