Compare commits
2 Commits
main
...
revert-310
Author | SHA1 | Date |
---|---|---|
![]() |
07824e7106 | |
![]() |
b6c0c7e374 |
|
@ -16,3 +16,6 @@
|
|||
[submodule "Carthage/Checkouts/Yams"]
|
||||
path = Carthage/Checkouts/Yams
|
||||
url = https://github.com/jpsim/Yams.git
|
||||
[submodule "SwiftSyntax"]
|
||||
path = SwiftSyntax
|
||||
url = https://github.com/apple/swift-syntax.git
|
||||
|
|
|
@ -50,6 +50,7 @@ opt_in_rules:
|
|||
- private_action
|
||||
- private_outlet
|
||||
- prohibited_interface_builder
|
||||
- prohibited_nan_comparison
|
||||
- prohibited_super_call
|
||||
- quick_discouraged_call
|
||||
- quick_discouraged_focused_test
|
||||
|
@ -57,12 +58,14 @@ opt_in_rules:
|
|||
- reduce_into
|
||||
- redundant_nil_coalescing
|
||||
- redundant_type_annotation
|
||||
- return_value_from_void_function
|
||||
- single_test_class
|
||||
- sorted_first_last
|
||||
- sorted_imports
|
||||
- static_operator
|
||||
- strong_iboutlet
|
||||
- toggle_bool
|
||||
- tuple_pattern
|
||||
- unavailable_function
|
||||
- unneeded_parentheses_in_closure_argument
|
||||
- unowned_variable_capture
|
||||
|
@ -70,6 +73,7 @@ opt_in_rules:
|
|||
- vertical_parameter_alignment_on_call
|
||||
- vertical_whitespace_closing_braces
|
||||
- vertical_whitespace_opening_braces
|
||||
- void_function_in_ternary
|
||||
- xct_specific_matcher
|
||||
- yoda_condition
|
||||
|
||||
|
|
|
@ -2,14 +2,7 @@
|
|||
|
||||
#### Breaking
|
||||
|
||||
* The new rules introduced in 0.39.0 that depend on SwiftSyntax have been
|
||||
temporarily removed as we work out release packaging issues.
|
||||
* `prohibited_nan_comparison`
|
||||
* `return_value_from_void_function`
|
||||
* `tuple_pattern`
|
||||
* `void_function_in_ternary`
|
||||
[JP Simard](https://github.com/jpsim)
|
||||
[#3105](https://github.com/realm/SwiftLint/issues/3105)
|
||||
* None.
|
||||
|
||||
#### Experimental
|
||||
|
||||
|
|
|
@ -55,6 +55,15 @@
|
|||
"version": "0.29.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "SwiftSyntax",
|
||||
"repositoryURL": "https://github.com/apple/swift-syntax.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "3e3eb191fcdbecc6031522660c4ed6ce25282c25",
|
||||
"version": "0.50100.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "SwiftyTextTable",
|
||||
"repositoryURL": "https://github.com/scottrhoyt/SwiftyTextTable.git",
|
||||
|
|
|
@ -7,8 +7,17 @@ private let addCryptoSwift = false
|
|||
private let addCryptoSwift = true
|
||||
#endif
|
||||
|
||||
#if compiler(>=5.1.0)
|
||||
private let addSwiftSyntax = true
|
||||
#else
|
||||
private let addSwiftSyntax = false
|
||||
#endif
|
||||
|
||||
let package = Package(
|
||||
name: "SwiftLint",
|
||||
platforms: [
|
||||
.macOS(.v10_12)
|
||||
],
|
||||
products: [
|
||||
.executable(name: "swiftlint", targets: ["swiftlint"]),
|
||||
.library(name: "SwiftLintFramework", targets: ["SwiftLintFramework"])
|
||||
|
@ -18,7 +27,8 @@ let package = Package(
|
|||
.package(url: "https://github.com/jpsim/SourceKitten.git", .upToNextMinor(from: "0.29.0")),
|
||||
.package(url: "https://github.com/jpsim/Yams.git", from: "2.0.0"),
|
||||
.package(url: "https://github.com/scottrhoyt/SwiftyTextTable.git", from: "0.9.0"),
|
||||
] + (addCryptoSwift ? [.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", .upToNextMinor(from: "1.0.0"))] : []),
|
||||
] + (addCryptoSwift ? [.package(url: "https://github.com/krzyzanowskim/CryptoSwift.git", .upToNextMinor(from: "1.0.0"))] : []) +
|
||||
(addSwiftSyntax ? [.package(url: "https://github.com/apple/swift-syntax.git", .exact("0.50100.0"))] : []),
|
||||
targets: [
|
||||
.target(
|
||||
name: "swiftlint",
|
||||
|
@ -33,7 +43,8 @@ let package = Package(
|
|||
dependencies: [
|
||||
"SourceKittenFramework",
|
||||
"Yams",
|
||||
] + (addCryptoSwift ? ["CryptoSwift"] : [])
|
||||
] + (addCryptoSwift ? ["CryptoSwift"] : []) +
|
||||
(addSwiftSyntax ? ["SwiftSyntax"] : [])
|
||||
),
|
||||
.testTarget(
|
||||
name: "SwiftLintFrameworkTests",
|
||||
|
|
|
@ -61,7 +61,7 @@ running it.
|
|||
### Compiling from source:
|
||||
|
||||
You can also build from source by cloning this project and running
|
||||
`git submodule update --init --recursive; make install` (Xcode 10.2 or later).
|
||||
`script/bootstrap; make install` (Xcode 11.0 or later).
|
||||
|
||||
### Known Installation Issues On MacOS Before 10.14.4
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import Foundation
|
||||
import SourceKittenFramework
|
||||
#if canImport(SwiftSyntax)
|
||||
import SwiftSyntax
|
||||
#endif
|
||||
|
||||
private typealias FileCacheKey = Int
|
||||
private var responseCache = Cache({ file -> [String: SourceKitRepresentable]? in
|
||||
|
@ -30,6 +33,20 @@ private var syntaxMapCache = Cache({ file in
|
|||
private var syntaxKindsByLinesCache = Cache({ file in file.syntaxKindsByLine() })
|
||||
private var syntaxTokensByLinesCache = Cache({ file in file.syntaxTokensByLine() })
|
||||
|
||||
#if canImport(SwiftSyntax)
|
||||
private var syntaxCache = Cache({ file -> SourceFileSyntax? in
|
||||
do {
|
||||
if let path = file.path {
|
||||
return try SyntaxParser.parse(URL(fileURLWithPath: path))
|
||||
}
|
||||
|
||||
return try SyntaxParser.parse(source: file.contents)
|
||||
} catch {
|
||||
return nil
|
||||
}
|
||||
})
|
||||
#endif
|
||||
|
||||
internal typealias AssertHandler = () -> Void
|
||||
|
||||
private var assertHandlers = [FileCacheKey: AssertHandler]()
|
||||
|
@ -158,6 +175,20 @@ extension SwiftLintFile {
|
|||
return syntaxMap
|
||||
}
|
||||
|
||||
#if canImport(SwiftSyntax)
|
||||
internal var syntax: SourceFileSyntax {
|
||||
initializeSwiftSyntax
|
||||
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
|
||||
}
|
||||
#endif
|
||||
|
||||
internal var syntaxTokensByLines: [[SwiftLintSyntaxToken]] {
|
||||
guard let syntaxTokensByLines = syntaxTokensByLinesCache.get(self) else {
|
||||
if let handler = assertHandler {
|
||||
|
@ -189,6 +220,9 @@ extension SwiftLintFile {
|
|||
syntaxMapCache.invalidate(self)
|
||||
syntaxTokensByLinesCache.invalidate(self)
|
||||
syntaxKindsByLinesCache.invalidate(self)
|
||||
#if canImport(SwiftSyntax)
|
||||
syntaxCache.invalidate(self)
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static func clearCaches() {
|
||||
|
@ -200,5 +234,8 @@ extension SwiftLintFile {
|
|||
syntaxMapCache.clear()
|
||||
syntaxTokensByLinesCache.clear()
|
||||
syntaxKindsByLinesCache.clear()
|
||||
#if canImport(SwiftSyntax)
|
||||
syntaxCache.clear()
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
import Foundation
|
||||
|
||||
/// Namespace for utilities to execute a child process.
|
||||
enum Exec {
|
||||
/// How to handle stderr output from the child process.
|
||||
enum Stderr {
|
||||
/// Treat stderr same as parent process.
|
||||
case inherit
|
||||
/// Send stderr to /dev/null.
|
||||
case discard
|
||||
/// Merge stderr with stdout.
|
||||
case merge
|
||||
}
|
||||
|
||||
/// The result of running the child process.
|
||||
struct Results {
|
||||
/// The process's exit status.
|
||||
let terminationStatus: Int32
|
||||
/// The data from stdout and optionally stderr.
|
||||
let data: Data
|
||||
/// The `data` reinterpreted as a string with whitespace trimmed; `nil` for the empty string.
|
||||
var string: String? {
|
||||
let encoded = String(data: data, encoding: .utf8) ?? ""
|
||||
let trimmed = encoded.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||
return trimmed.isEmpty ? nil : trimmed
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Run a command with arguments and return its output and exit status.
|
||||
|
||||
- parameter command: Absolute path of the command to run.
|
||||
- parameter arguments: Arguments to pass to the command.
|
||||
- parameter currentDirectory: Current directory for the command. By default
|
||||
the parent process's current directory.
|
||||
- parameter stderr: What to do with stderr output from the command. By default
|
||||
whatever the parent process does.
|
||||
*/
|
||||
static func run(_ command: String,
|
||||
_ arguments: String...,
|
||||
currentDirectory: String = FileManager.default.currentDirectoryPath,
|
||||
stderr: Stderr = .inherit) -> Results {
|
||||
return run(command, arguments, currentDirectory: currentDirectory, stderr: stderr)
|
||||
}
|
||||
|
||||
/**
|
||||
Run a command with arguments and return its output and exit status.
|
||||
|
||||
- parameter command: Absolute path of the command to run.
|
||||
- parameter arguments: Arguments to pass to the command.
|
||||
- parameter currentDirectory: Current directory for the command. By default
|
||||
the parent process's current directory.
|
||||
- parameter stderr: What to do with stderr output from the command. By default
|
||||
whatever the parent process does.
|
||||
*/
|
||||
static func run(_ command: String,
|
||||
_ arguments: [String] = [],
|
||||
currentDirectory: String = FileManager.default.currentDirectoryPath,
|
||||
stderr: Stderr = .inherit) -> Results {
|
||||
let process = Process()
|
||||
process.arguments = arguments
|
||||
|
||||
let pipe = Pipe()
|
||||
process.standardOutput = pipe
|
||||
|
||||
switch stderr {
|
||||
case .discard:
|
||||
// FileHandle.nullDevice does not work here, as it consists of an invalid file descriptor,
|
||||
// causing process.launch() to abort with an EBADF.
|
||||
process.standardError = FileHandle(forWritingAtPath: "/dev/null")!
|
||||
case .merge:
|
||||
process.standardError = pipe
|
||||
case .inherit:
|
||||
break
|
||||
}
|
||||
|
||||
do {
|
||||
#if canImport(Darwin)
|
||||
if #available(macOS 10.13, *) {
|
||||
process.executableURL = URL(fileURLWithPath: command)
|
||||
process.currentDirectoryURL = URL(fileURLWithPath: currentDirectory)
|
||||
try process.run()
|
||||
} else {
|
||||
process.launchPath = command
|
||||
process.currentDirectoryPath = currentDirectory
|
||||
process.launch()
|
||||
}
|
||||
#elseif compiler(>=5)
|
||||
process.executableURL = URL(fileURLWithPath: command)
|
||||
process.currentDirectoryURL = URL(fileURLWithPath: currentDirectory)
|
||||
try process.run()
|
||||
#else
|
||||
process.launchPath = command
|
||||
process.currentDirectoryPath = currentDirectory
|
||||
process.launch()
|
||||
#endif
|
||||
} catch {
|
||||
return Results(terminationStatus: -1, data: Data())
|
||||
}
|
||||
|
||||
let file = pipe.fileHandleForReading
|
||||
let data = file.readDataToEndOfFile()
|
||||
process.waitUntilExit()
|
||||
return Results(terminationStatus: process.terminationStatus, data: data)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,195 @@
|
|||
import Foundation
|
||||
|
||||
// MARK: - Shared Types & Functions
|
||||
|
||||
struct DynamicLinkLibrary {
|
||||
fileprivate let handle: UnsafeMutableRawPointer
|
||||
|
||||
func load<T>(symbol: String) -> T {
|
||||
if let sym = dlsym(handle, symbol) {
|
||||
return unsafeBitCast(sym, to: T.self)
|
||||
}
|
||||
let errorString = String(validatingUTF8: dlerror())
|
||||
fatalError("Finding symbol \(symbol) failed: \(errorString ?? "unknown error")")
|
||||
}
|
||||
}
|
||||
|
||||
struct Loader {
|
||||
let searchPaths: [String]
|
||||
|
||||
func load(path: String) -> DynamicLinkLibrary {
|
||||
let fullPaths = searchPaths.map { $0.appending(pathComponent: path) }.filter { $0.isFile }
|
||||
|
||||
// try all fullPaths that contains target file,
|
||||
// then try loading with simple path that depends resolving to DYLD
|
||||
for fullPath in fullPaths + [path] {
|
||||
if let handle = dlopen(fullPath, RTLD_LAZY) {
|
||||
return DynamicLinkLibrary(handle: handle)
|
||||
}
|
||||
}
|
||||
|
||||
fatalError("Loading \(path) failed")
|
||||
}
|
||||
}
|
||||
|
||||
private func env(_ name: String) -> String? {
|
||||
return ProcessInfo.processInfo.environment[name]
|
||||
}
|
||||
|
||||
private extension String {
|
||||
func appending(pathComponent: String) -> String {
|
||||
return URL(fileURLWithPath: self).appendingPathComponent(pathComponent).path
|
||||
}
|
||||
|
||||
func deleting(lastPathComponents numberOfPathComponents: Int) -> String {
|
||||
return (0..<numberOfPathComponents)
|
||||
.reduce(URL(fileURLWithPath: self)) { url, _ in url.deletingLastPathComponent() }
|
||||
.path
|
||||
}
|
||||
}
|
||||
|
||||
#if os(Linux)
|
||||
|
||||
// MARK: - Linux
|
||||
|
||||
/// Returns "LINUX_SOURCEKIT_LIB_PATH" environment variable.
|
||||
internal let linuxSourceKitLibPath = env("LINUX_SOURCEKIT_LIB_PATH")
|
||||
|
||||
/// If available, uses `swiftenv` to determine the user's active Swift root.
|
||||
internal let linuxFindSwiftenvActiveLibPath: String? = {
|
||||
guard let swiftenvPath = Exec.run("/usr/bin/which", "swiftenv").string else {
|
||||
return nil
|
||||
}
|
||||
|
||||
guard let swiftenvRoot = Exec.run(swiftenvPath, "prefix").string else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return swiftenvRoot + "/usr/lib"
|
||||
}()
|
||||
|
||||
/// Attempts to discover the location of libsourcekitdInProc.so by looking at
|
||||
/// the `swift` binary on the path.
|
||||
internal let linuxFindSwiftInstallationLibPath: String? = {
|
||||
guard let swiftPath = Exec.run("/usr/bin/which", "swift").string else {
|
||||
return nil
|
||||
}
|
||||
|
||||
if linuxSourceKitLibPath == nil && linuxFindSwiftenvActiveLibPath == nil &&
|
||||
swiftPath.hasSuffix("/shims/swift") {
|
||||
/// If we hit this path, the user is invoking Swift via swiftenv shims and has not set the
|
||||
/// environment variable; this means we're going to end up trying to load from `/usr/lib`
|
||||
/// which will fail - and instead, we can give a more useful error message.
|
||||
fatalError("Swift is installed via swiftenv but swiftenv is not initialized.")
|
||||
}
|
||||
|
||||
if !swiftPath.hasSuffix("/bin/swift") {
|
||||
return nil
|
||||
}
|
||||
|
||||
/// .../bin/swift -> .../lib
|
||||
return swiftPath.deleting(lastPathComponents: 2).appending(pathComponent: "/lib")
|
||||
}()
|
||||
|
||||
/// Fallback path on Linux if no better option is available.
|
||||
internal let linuxDefaultLibPath = "/usr/lib"
|
||||
|
||||
let toolchainLoader = Loader(searchPaths: [
|
||||
linuxSourceKitLibPath,
|
||||
linuxFindSwiftenvActiveLibPath,
|
||||
linuxFindSwiftInstallationLibPath,
|
||||
linuxDefaultLibPath
|
||||
].compactMap({ $0 }))
|
||||
|
||||
#else
|
||||
|
||||
// MARK: - Darwin
|
||||
|
||||
let toolchainLoader = Loader(searchPaths: [
|
||||
xcodeDefaultToolchainOverride,
|
||||
toolchainDir,
|
||||
xcrunFindPath,
|
||||
/*
|
||||
These search paths are used when `xcode-select -p` points to
|
||||
"Command Line Tools OS X for Xcode", but Xcode.app exists.
|
||||
*/
|
||||
applicationsDir?.xcodeDeveloperDir.toolchainDir,
|
||||
applicationsDir?.xcodeBetaDeveloperDir.toolchainDir,
|
||||
userApplicationsDir?.xcodeDeveloperDir.toolchainDir,
|
||||
userApplicationsDir?.xcodeBetaDeveloperDir.toolchainDir
|
||||
].compactMap { path in
|
||||
if let fullPath = path?.usrLibDir, FileManager.default.fileExists(atPath: fullPath) {
|
||||
return fullPath
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
/// Returns "XCODE_DEFAULT_TOOLCHAIN_OVERRIDE" environment variable
|
||||
///
|
||||
/// `launch-with-toolchain` sets the toolchain path to the
|
||||
/// "XCODE_DEFAULT_TOOLCHAIN_OVERRIDE" environment variable.
|
||||
private let xcodeDefaultToolchainOverride = env("XCODE_DEFAULT_TOOLCHAIN_OVERRIDE")
|
||||
|
||||
/// Returns "TOOLCHAIN_DIR" environment variable
|
||||
///
|
||||
/// `Xcode`/`xcodebuild` sets the toolchain path to the
|
||||
/// "TOOLCHAIN_DIR" environment variable.
|
||||
private let toolchainDir = env("TOOLCHAIN_DIR")
|
||||
|
||||
/// Returns toolchain directory that parsed from result of `xcrun -find swift`
|
||||
///
|
||||
/// This is affected by "DEVELOPER_DIR", "TOOLCHAINS" environment variables.
|
||||
private let xcrunFindPath: String? = {
|
||||
let pathOfXcrun = "/usr/bin/xcrun"
|
||||
|
||||
if !FileManager.default.isExecutableFile(atPath: pathOfXcrun) {
|
||||
return nil
|
||||
}
|
||||
|
||||
guard let output = Exec.run(pathOfXcrun, "-find", "swift").string else {
|
||||
return nil
|
||||
}
|
||||
|
||||
var start = output.startIndex
|
||||
var end = output.startIndex
|
||||
var contentsEnd = output.startIndex
|
||||
output.getLineStart(&start, end: &end, contentsEnd: &contentsEnd, for: start..<start)
|
||||
let xcrunFindSwiftPath = String(output[start..<contentsEnd])
|
||||
guard xcrunFindSwiftPath.hasSuffix("/usr/bin/swift") else {
|
||||
return nil
|
||||
}
|
||||
let xcrunFindPath = xcrunFindSwiftPath.appending(pathComponent: "macosx")
|
||||
// Return nil if xcrunFindPath points to "Command Line Tools OS X for Xcode"
|
||||
// because it doesn't contain `sourcekitd.framework`.
|
||||
if xcrunFindPath.hasPrefix("/Library/Developer/CommandLineTools") {
|
||||
return nil
|
||||
}
|
||||
return xcrunFindPath
|
||||
}()
|
||||
|
||||
private func appDir(mask: FileManager.SearchPathDomainMask) -> String? {
|
||||
return NSSearchPathForDirectoriesInDomains(.applicationDirectory, mask, true).first
|
||||
}
|
||||
|
||||
private let applicationsDir = appDir(mask: .systemDomainMask)
|
||||
|
||||
private let userApplicationsDir = appDir(mask: .userDomainMask)
|
||||
|
||||
private extension String {
|
||||
var toolchainDir: String {
|
||||
return appending(pathComponent: "Toolchains/XcodeDefault.xctoolchain/")
|
||||
}
|
||||
|
||||
var xcodeDeveloperDir: String {
|
||||
return appending(pathComponent: "Xcode.app/Contents/Developer")
|
||||
}
|
||||
|
||||
var xcodeBetaDeveloperDir: String {
|
||||
return appending(pathComponent: "Xcode-beta.app/Contents/Developer")
|
||||
}
|
||||
|
||||
var usrLibDir: String {
|
||||
return appending(pathComponent: "/usr/lib/swift")
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,11 @@
|
|||
import SwiftSyntax
|
||||
|
||||
let initializeSwiftSyntax: Void = {
|
||||
_ = toolchainLoader.load(path: "lib_InternalSwiftSyntaxParser.dylib")
|
||||
do {
|
||||
_ = try SyntaxParser.parse(source: "")
|
||||
} catch ParserError.parserCompatibilityCheckFailed {
|
||||
queuedFatalError("Unable to find appropriate Xcode")
|
||||
} catch {
|
||||
}
|
||||
}()
|
|
@ -121,6 +121,7 @@ public let masterRuleList = RuleList(rules: [
|
|||
OverriddenSuperCallRule.self,
|
||||
OverrideInExtensionRule.self,
|
||||
PatternMatchingKeywordsRule.self,
|
||||
PhohibitedNaNComparisonRule.self,
|
||||
PreferSelfTypeOverTypeOfSelfRule.self,
|
||||
PrefixedTopLevelConstantRule.self,
|
||||
PrivateActionRule.self,
|
||||
|
@ -147,6 +148,7 @@ public let masterRuleList = RuleList(rules: [
|
|||
RequiredDeinitRule.self,
|
||||
RequiredEnumCaseRule.self,
|
||||
ReturnArrowWhitespaceRule.self,
|
||||
ReturnValueFromVoidFunctionRule.self,
|
||||
ShorthandOperatorRule.self,
|
||||
SingleTestClassRule.self,
|
||||
SortedFirstLastRule.self,
|
||||
|
@ -166,6 +168,7 @@ public let masterRuleList = RuleList(rules: [
|
|||
TrailingNewlineRule.self,
|
||||
TrailingSemicolonRule.self,
|
||||
TrailingWhitespaceRule.self,
|
||||
TuplePatternRule.self,
|
||||
TypeBodyLengthRule.self,
|
||||
TypeContentsOrderRule.self,
|
||||
TypeNameRule.self,
|
||||
|
@ -189,6 +192,7 @@ public let masterRuleList = RuleList(rules: [
|
|||
VerticalWhitespaceClosingBracesRule.self,
|
||||
VerticalWhitespaceOpeningBracesRule.self,
|
||||
VerticalWhitespaceRule.self,
|
||||
VoidFunctionInTernaryConditionRule.self,
|
||||
VoidReturnRule.self,
|
||||
WeakDelegateRule.self,
|
||||
XCTFailMessageRule.self,
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
import Foundation
|
||||
#if canImport(SwiftSyntax)
|
||||
import SwiftSyntax
|
||||
#endif
|
||||
|
||||
/// A rule that leverages the SwiftSyntax library.
|
||||
public protocol SyntaxRule: Rule {}
|
||||
|
||||
#if canImport(SwiftSyntax)
|
||||
/// A SwiftSyntax visitor that collects data to provide violations for a specific rule.
|
||||
public protocol SyntaxRuleVisitor: SyntaxVisitor {
|
||||
/// The rule that uses this visitor.
|
||||
associatedtype Rule: SyntaxRule
|
||||
|
||||
/// Returns the violations that should be calculated based on data that was accumulated during the `visit` methods.
|
||||
func violations(for rule: Rule, in file: SwiftLintFile) -> [StyleViolation]
|
||||
}
|
||||
|
||||
public extension SyntaxRule {
|
||||
/// Wraps computation of violations based on a visitor.
|
||||
func validate<Visitor: SyntaxRuleVisitor>(file: SwiftLintFile,
|
||||
visitor: Visitor) -> [StyleViolation] where Visitor.Rule == Self {
|
||||
let lock = NSLock()
|
||||
var visitor = visitor
|
||||
|
||||
// https://bugs.swift.org/browse/SR-11170
|
||||
let work = DispatchWorkItem {
|
||||
lock.lock()
|
||||
file.syntax.walk(&visitor)
|
||||
lock.unlock()
|
||||
}
|
||||
let thread = Thread {
|
||||
work.perform()
|
||||
}
|
||||
thread.stackSize = 8 << 20 // 8 MB.
|
||||
thread.start()
|
||||
work.wait()
|
||||
|
||||
lock.lock()
|
||||
defer { lock.unlock() }
|
||||
return visitor.violations(for: self, in: file)
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,76 @@
|
|||
import SourceKittenFramework
|
||||
#if canImport(SwiftSyntax)
|
||||
import SwiftSyntax
|
||||
#endif
|
||||
|
||||
public struct ReturnValueFromVoidFunctionRule: ConfigurationProviderRule, SyntaxRule, OptInRule,
|
||||
AutomaticTestableRule {
|
||||
public var configuration = SeverityConfiguration(.warning)
|
||||
|
||||
public init() {}
|
||||
|
||||
public static let description = RuleDescription(
|
||||
identifier: "return_value_from_void_function",
|
||||
name: "Return Value from Void Function",
|
||||
description: "Returning values from Void functions should be avoided.",
|
||||
kind: .idiomatic,
|
||||
minSwiftVersion: .fiveDotOne,
|
||||
nonTriggeringExamples: ReturnValueFromVoidFunctionRuleExamples.nonTriggeringExamples,
|
||||
triggeringExamples: ReturnValueFromVoidFunctionRuleExamples.triggeringExamples
|
||||
)
|
||||
|
||||
public func validate(file: SwiftLintFile) -> [StyleViolation] {
|
||||
#if canImport(SwiftSyntax)
|
||||
return validate(file: file, visitor: ReturnVisitor())
|
||||
#else
|
||||
return []
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if canImport(SwiftSyntax)
|
||||
private class ReturnVisitor: SyntaxRuleVisitor {
|
||||
private var positions = [AbsolutePosition]()
|
||||
|
||||
func visit(_ node: ReturnStmtSyntax) -> SyntaxVisitorContinueKind {
|
||||
if node.expression != nil,
|
||||
let functionNode = node.enclosingFunction(),
|
||||
functionNode.returnsVoid {
|
||||
positions.append(node.positionAfterSkippingLeadingTrivia)
|
||||
}
|
||||
return .visitChildren
|
||||
}
|
||||
|
||||
func violations(for rule: ReturnValueFromVoidFunctionRule, in file: SwiftLintFile) -> [StyleViolation] {
|
||||
return positions.map { position in
|
||||
StyleViolation(ruleDescription: type(of: rule).description,
|
||||
severity: rule.configuration.severity,
|
||||
location: Location(file: file, byteOffset: ByteCount(position.utf8Offset)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension Syntax {
|
||||
func enclosingFunction() -> FunctionDeclSyntax? {
|
||||
if let node = self as? FunctionDeclSyntax {
|
||||
return node
|
||||
}
|
||||
|
||||
if self is ClosureExprSyntax || self is VariableDeclSyntax {
|
||||
return nil
|
||||
}
|
||||
|
||||
return parent?.enclosingFunction()
|
||||
}
|
||||
}
|
||||
|
||||
private extension FunctionDeclSyntax {
|
||||
var returnsVoid: Bool {
|
||||
if let type = signature.output?.returnType as? SimpleTypeIdentifierSyntax {
|
||||
return type.name.text == "Void"
|
||||
}
|
||||
|
||||
return signature.output?.returnType == nil
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,234 @@
|
|||
// swiftlint:disable:next type_body_length
|
||||
internal struct ReturnValueFromVoidFunctionRuleExamples {
|
||||
static let nonTriggeringExamples = [
|
||||
Example("""
|
||||
func foo() {
|
||||
return
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func foo() {
|
||||
return /* a comment */
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func foo() -> Int {
|
||||
return 1
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func foo() -> Void {
|
||||
if condition {
|
||||
return
|
||||
}
|
||||
bar()
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func foo() {
|
||||
return;
|
||||
bar()
|
||||
}
|
||||
"""),
|
||||
Example("func test() {}"),
|
||||
Example("""
|
||||
init?() {
|
||||
guard condition else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
init?(arg: String?) {
|
||||
guard arg != nil else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() {
|
||||
guard condition else {
|
||||
return
|
||||
}
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() -> Result<String, Error> {
|
||||
func other() {}
|
||||
func otherVoid() -> Void {}
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() -> Int? {
|
||||
return nil
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() {
|
||||
if bar {
|
||||
print("")
|
||||
return
|
||||
}
|
||||
let foo = [1, 2, 3].filter { return true }
|
||||
return
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() {
|
||||
guard foo else {
|
||||
bar()
|
||||
return
|
||||
}
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func spec() {
|
||||
var foo: Int {
|
||||
return 0
|
||||
}
|
||||
""")
|
||||
]
|
||||
|
||||
static let triggeringExamples = [
|
||||
Example("""
|
||||
func foo() {
|
||||
↓return bar()
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func foo() {
|
||||
↓return self.bar()
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func foo() -> Void {
|
||||
↓return bar()
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func foo() -> Void {
|
||||
↓return /* comment */ bar()
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func foo() {
|
||||
↓return
|
||||
self.bar()
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func foo() {
|
||||
variable += 1
|
||||
↓return
|
||||
variable += 1
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func initThing() {
|
||||
guard foo else {
|
||||
↓return print("")
|
||||
}
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
// Leading comment
|
||||
func test() {
|
||||
guard condition else {
|
||||
↓return assertionfailure("")
|
||||
}
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() -> Result<String, Error> {
|
||||
func other() {
|
||||
guard false else {
|
||||
↓return assertionfailure("")
|
||||
}
|
||||
}
|
||||
func otherVoid() -> Void {}
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() {
|
||||
guard conditionIsTrue else {
|
||||
sideEffects()
|
||||
return // comment
|
||||
}
|
||||
guard otherCondition else {
|
||||
↓return assertionfailure("")
|
||||
}
|
||||
differentSideEffect()
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() {
|
||||
guard otherCondition else {
|
||||
↓return assertionfailure(""); // comment
|
||||
}
|
||||
differentSideEffect()
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() {
|
||||
if x {
|
||||
↓return foo()
|
||||
}
|
||||
bar()
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() {
|
||||
switch x {
|
||||
case .a:
|
||||
↓return foo() // return to skip baz()
|
||||
case .b:
|
||||
bar()
|
||||
}
|
||||
baz()
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() {
|
||||
if check {
|
||||
if otherCheck {
|
||||
↓return foo()
|
||||
}
|
||||
}
|
||||
bar()
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() {
|
||||
↓return foo()
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() {
|
||||
↓return foo({
|
||||
return bar()
|
||||
})
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() {
|
||||
guard x else {
|
||||
↓return foo()
|
||||
}
|
||||
bar()
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
func test() {
|
||||
let closure: () -> () = {
|
||||
return assert()
|
||||
}
|
||||
if check {
|
||||
if otherCheck {
|
||||
return // comments are fine
|
||||
}
|
||||
}
|
||||
↓return foo()
|
||||
}
|
||||
""")
|
||||
]
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
import SourceKittenFramework
|
||||
#if canImport(SwiftSyntax)
|
||||
import SwiftSyntax
|
||||
#endif
|
||||
|
||||
public struct TuplePatternRule: ConfigurationProviderRule, SyntaxRule, OptInRule,
|
||||
AutomaticTestableRule {
|
||||
public var configuration = SeverityConfiguration(.warning)
|
||||
|
||||
public init() {}
|
||||
|
||||
public static let description = RuleDescription(
|
||||
identifier: "tuple_pattern",
|
||||
name: "Tuple Pattern",
|
||||
description: "Assigning variables through a tuple pattern is only permitted if the left-hand side of the " +
|
||||
"assignment is unlabeled.",
|
||||
kind: .idiomatic,
|
||||
minSwiftVersion: .fiveDotOne,
|
||||
nonTriggeringExamples: [
|
||||
Example("let (a, b) = (y: 4, x: 5.0)"),
|
||||
Example("let (a, b) = (4, 5.0)"),
|
||||
Example("let (a, b) = (a: 4, b: 5.0)"),
|
||||
Example("let (a, b) = tuple")
|
||||
],
|
||||
triggeringExamples: [
|
||||
Example("let ↓(x: a, y: b) = (y: 4, x: 5.0)"),
|
||||
Example("let ↓(x: Int, y: Double) = (y: 4, x: 5.0)"),
|
||||
Example("let ↓(x: Int, y: Double) = (y: 4, x: 5.0)")
|
||||
]
|
||||
)
|
||||
|
||||
public func validate(file: SwiftLintFile) -> [StyleViolation] {
|
||||
#if canImport(SwiftSyntax)
|
||||
return validate(file: file, visitor: PatternBindingVisitor())
|
||||
#else
|
||||
return []
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if canImport(SwiftSyntax)
|
||||
private class PatternBindingVisitor: SyntaxRuleVisitor {
|
||||
private var positions = [AbsolutePosition]()
|
||||
|
||||
func visit(_ node: PatternBindingSyntax) -> SyntaxVisitorContinueKind {
|
||||
if let tuplePattern = node.pattern as? TuplePatternSyntax,
|
||||
case let leftSideLabels = tuplePattern.labels,
|
||||
!leftSideLabels.compactMap({ $0 }).isEmpty,
|
||||
let rightSideLabels = node.initializer?.tupleElementList?.labels,
|
||||
leftSideLabels != rightSideLabels {
|
||||
positions.append(node.positionAfterSkippingLeadingTrivia)
|
||||
}
|
||||
return .visitChildren
|
||||
}
|
||||
|
||||
func violations(for rule: TuplePatternRule, in file: SwiftLintFile) -> [StyleViolation] {
|
||||
return positions.map { position in
|
||||
StyleViolation(ruleDescription: type(of: rule).description,
|
||||
severity: rule.configuration.severity,
|
||||
location: Location(file: file, byteOffset: ByteCount(position.utf8Offset)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension TuplePatternSyntax {
|
||||
var labels: [String?] {
|
||||
return elements.map { element in
|
||||
element.labelName?.withoutTrivia().text
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension InitializerClauseSyntax {
|
||||
var tupleElementList: TupleElementListSyntax? {
|
||||
if let expr = value as? TupleExprSyntax {
|
||||
return expr.elementList
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
private extension TupleElementListSyntax {
|
||||
var labels: [String?] {
|
||||
return map { element in
|
||||
element.label?.withoutTrivia().text
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,110 @@
|
|||
import SourceKittenFramework
|
||||
#if canImport(SwiftSyntax)
|
||||
import SwiftSyntax
|
||||
#endif
|
||||
|
||||
public struct VoidFunctionInTernaryConditionRule: ConfigurationProviderRule, SyntaxRule, OptInRule,
|
||||
AutomaticTestableRule {
|
||||
public var configuration = SeverityConfiguration(.warning)
|
||||
|
||||
public init() {}
|
||||
|
||||
public static let description = RuleDescription(
|
||||
identifier: "void_function_in_ternary",
|
||||
name: "Void Function in Ternary",
|
||||
description: "Using ternary to call Void functions should be avoided.",
|
||||
kind: .idiomatic,
|
||||
minSwiftVersion: .fiveDotOne,
|
||||
nonTriggeringExamples: [
|
||||
Example("let result = success ? foo() : bar()"),
|
||||
Example("""
|
||||
if success {
|
||||
askQuestion()
|
||||
} else {
|
||||
exit()
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
var price: Double {
|
||||
return hasDiscount ? calculatePriceWithDiscount() : calculateRegularPrice()
|
||||
}
|
||||
"""),
|
||||
Example("foo(x == 2 ? a() : b())"),
|
||||
Example("""
|
||||
chevronView.image = collapsed ? .icon(.mediumChevronDown) : .icon(.mediumChevronUp)
|
||||
"""),
|
||||
Example("""
|
||||
array.map { elem in
|
||||
elem.isEmpty() ? .emptyValue() : .number(elem)
|
||||
}
|
||||
""")
|
||||
],
|
||||
triggeringExamples: [
|
||||
Example("success ↓? askQuestion() : exit()"),
|
||||
Example("""
|
||||
perform { elem in
|
||||
elem.isEmpty() ↓? .emptyValue() : .number(elem)
|
||||
return 1
|
||||
}
|
||||
"""),
|
||||
Example("""
|
||||
DispatchQueue.main.async {
|
||||
self.sectionViewModels[section].collapsed.toggle()
|
||||
self.sectionViewModels[section].collapsed
|
||||
↓? self.tableView.deleteRows(at: [IndexPath(row: 0, section: section)], with: .automatic)
|
||||
: self.tableView.insertRows(at: [IndexPath(row: 0, section: section)], with: .automatic)
|
||||
self.tableView.scrollToRow(at: IndexPath(row: NSNotFound, section: section), at: .top, animated: true)
|
||||
}
|
||||
""")
|
||||
]
|
||||
)
|
||||
|
||||
public func validate(file: SwiftLintFile) -> [StyleViolation] {
|
||||
#if canImport(SwiftSyntax)
|
||||
return validate(file: file, visitor: TernaryVisitor())
|
||||
#else
|
||||
return []
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if canImport(SwiftSyntax)
|
||||
private class TernaryVisitor: SyntaxRuleVisitor {
|
||||
private var positions = [AbsolutePosition]()
|
||||
|
||||
func visit(_ node: TernaryExprSyntax) -> SyntaxVisitorContinueKind {
|
||||
if node.firstChoice is FunctionCallExprSyntax, node.secondChoice is FunctionCallExprSyntax,
|
||||
let parent = node.parent as? ExprListSyntax, !parent.containsAssignment,
|
||||
parent.parent is SequenceExprSyntax,
|
||||
let blockItem = parent.parent?.parent as? CodeBlockItemSyntax, !blockItem.isClosureImplictReturn {
|
||||
positions.append(node.questionMark.positionAfterSkippingLeadingTrivia)
|
||||
}
|
||||
|
||||
return .visitChildren
|
||||
}
|
||||
|
||||
func violations(for rule: VoidFunctionInTernaryConditionRule, in file: SwiftLintFile) -> [StyleViolation] {
|
||||
return positions.map { position in
|
||||
StyleViolation(ruleDescription: type(of: rule).description,
|
||||
severity: rule.configuration.severity,
|
||||
location: Location(file: file, byteOffset: ByteCount(position.utf8Offset)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension ExprListSyntax {
|
||||
var containsAssignment: Bool {
|
||||
return children.contains(where: { $0 is AssignmentExprSyntax })
|
||||
}
|
||||
}
|
||||
|
||||
private extension CodeBlockItemSyntax {
|
||||
var isClosureImplictReturn: Bool {
|
||||
guard let parent = parent as? CodeBlockItemListSyntax else {
|
||||
return false
|
||||
}
|
||||
|
||||
return Array(parent.children).count == 1 && parent.parent is ClosureExprSyntax
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,99 @@
|
|||
import Foundation
|
||||
import SourceKittenFramework
|
||||
#if canImport(SwiftSyntax)
|
||||
import SwiftSyntax
|
||||
#endif
|
||||
|
||||
public struct PhohibitedNaNComparisonRule: ConfigurationProviderRule, SyntaxRule, OptInRule, AutomaticTestableRule {
|
||||
public var configuration = SeverityConfiguration(.warning)
|
||||
|
||||
public init() {}
|
||||
|
||||
public static let description = RuleDescription(
|
||||
identifier: "prohibited_nan_comparison",
|
||||
name: "Prohibited NaN Comparison",
|
||||
description: "Use `isNaN` instead of comparing values to the `.nan` constant.",
|
||||
kind: .lint,
|
||||
minSwiftVersion: .fiveDotOne,
|
||||
nonTriggeringExamples: [
|
||||
Example("if number.isNaN {}"),
|
||||
Example("if foo.nan == 3 {}") // allows using in non-types
|
||||
],
|
||||
triggeringExamples: [
|
||||
Example("if number == .nan {}"),
|
||||
Example("if number + 1 == .nan {}"),
|
||||
Example("if number == Float.nan {}"),
|
||||
Example("if .nan == number {}"),
|
||||
Example("if Double.nan == number {}")
|
||||
]
|
||||
)
|
||||
|
||||
public func validate(file: SwiftLintFile) -> [StyleViolation] {
|
||||
#if canImport(SwiftSyntax)
|
||||
return validate(file: file, visitor: BinaryOperatorVisitor())
|
||||
#else
|
||||
return []
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if canImport(SwiftSyntax)
|
||||
private class BinaryOperatorVisitor: SyntaxRuleVisitor {
|
||||
private var positions = [AbsolutePosition]()
|
||||
private let operators: Set = ["==", "!="]
|
||||
|
||||
func visit(_ node: BinaryOperatorExprSyntax) -> SyntaxVisitorContinueKind {
|
||||
if operators.contains(node.operatorToken.withoutTrivia().text), let children = node.parent?.children {
|
||||
let array = Array(children)
|
||||
let before = array[array.index(before: node.indexInParent)]
|
||||
let after = array[array.index(after: node.indexInParent)]
|
||||
|
||||
if before.isNaN || after.isNaN {
|
||||
positions.append(node.operatorToken.positionAfterSkippingLeadingTrivia)
|
||||
}
|
||||
}
|
||||
|
||||
return .visitChildren
|
||||
}
|
||||
|
||||
func violations(for rule: PhohibitedNaNComparisonRule, in file: SwiftLintFile) -> [StyleViolation] {
|
||||
return positions.map { position in
|
||||
StyleViolation(ruleDescription: type(of: rule).description,
|
||||
severity: rule.configuration.severity,
|
||||
location: Location(file: file, byteOffset: ByteCount(position.utf8Offset)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private extension Syntax {
|
||||
var isNaN: Bool {
|
||||
guard let memberExpr = self as? MemberAccessExprSyntax else {
|
||||
return false
|
||||
}
|
||||
|
||||
let isNaNProperty = memberExpr.name.withoutTrivia().text == "nan"
|
||||
return isNaNProperty && (memberExpr.base == nil || memberExpr.base?.referringToType == true)
|
||||
}
|
||||
}
|
||||
|
||||
private extension ExprSyntax {
|
||||
var referringToType: Bool {
|
||||
guard let expr = self as? IdentifierExprSyntax else {
|
||||
return false
|
||||
}
|
||||
|
||||
return expr.identifier.classifications.map { $0.kind } == [.identifier] &&
|
||||
expr.identifier.withoutTrivia().text.isTypeLike
|
||||
}
|
||||
}
|
||||
|
||||
private extension String {
|
||||
var isTypeLike: Bool {
|
||||
guard let firstLetter = unicodeScalars.first else {
|
||||
return false
|
||||
}
|
||||
|
||||
return CharacterSet.uppercaseLetters.contains(firstLetter)
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -264,6 +264,7 @@
|
|||
D40AD08A1E032F9700F48C30 /* UnusedClosureParameterRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D40AD0891E032F9700F48C30 /* UnusedClosureParameterRule.swift */; };
|
||||
D40E041C1F46E3B30043BC4E /* SuperfluousDisableCommandRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D40E041B1F46E3B30043BC4E /* SuperfluousDisableCommandRule.swift */; };
|
||||
D40F83881DE9179200524C62 /* TrailingCommaConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = D40F83871DE9179200524C62 /* TrailingCommaConfiguration.swift */; };
|
||||
D40F8B6723E6D60E00A5218E /* PhohibitedNaNComparisonRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D40F8B6623E6D60E00A5218E /* PhohibitedNaNComparisonRule.swift */; };
|
||||
D40FE89D1F867BFF006433E2 /* OverrideInExtensionRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D40FE89C1F867BFF006433E2 /* OverrideInExtensionRule.swift */; };
|
||||
D4130D971E16183F00242361 /* IdentifierNameRuleExamples.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4130D961E16183F00242361 /* IdentifierNameRuleExamples.swift */; };
|
||||
D4130D991E16CC1300242361 /* TypeNameRuleExamples.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4130D981E16CC1300242361 /* TypeNameRuleExamples.swift */; };
|
||||
|
@ -277,6 +278,9 @@
|
|||
D41B57781ED8CEE0007B0470 /* ExtensionAccessModifierRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D41B57771ED8CEE0007B0470 /* ExtensionAccessModifierRule.swift */; };
|
||||
D41C09BD23C1B99D00F105C4 /* OrphanedDocCommentRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D41C09BC23C1B99D00F105C4 /* OrphanedDocCommentRule.swift */; };
|
||||
D41E7E0B1DF9DABB0065259A /* RedundantStringEnumValueRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D41E7E0A1DF9DABB0065259A /* RedundantStringEnumValueRule.swift */; };
|
||||
D423FCE623F3E0AB00607F3A /* library_wrapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D423FCE523F3E0AB00607F3A /* library_wrapper.swift */; };
|
||||
D423FCE823F3E0D900607F3A /* library_wrapper_SwiftSyntax.swift in Sources */ = {isa = PBXBuildFile; fileRef = D423FCE723F3E0D900607F3A /* library_wrapper_SwiftSyntax.swift */; };
|
||||
D423FCEA23F3E28700607F3A /* Exec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D423FCE923F3E28700607F3A /* Exec.swift */; };
|
||||
D4246D6D1F30D8620097E658 /* PrivateOverFilePrivateRuleConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4246D6C1F30D8620097E658 /* PrivateOverFilePrivateRuleConfiguration.swift */; };
|
||||
D4246D6F1F30DB260097E658 /* PrivateOverFilePrivateRuleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4246D6E1F30DB260097E658 /* PrivateOverFilePrivateRuleTests.swift */; };
|
||||
D42B45D91F0AF5E30086B683 /* StrictFilePrivateRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D42B45D81F0AF5E30086B683 /* StrictFilePrivateRule.swift */; };
|
||||
|
@ -297,6 +301,8 @@
|
|||
D4470D591EB6B4D1008A1B2E /* EmptyEnumArgumentsRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4470D581EB6B4D1008A1B2E /* EmptyEnumArgumentsRule.swift */; };
|
||||
D4470D5B1EB76F44008A1B2E /* UnusedOptionalBindingRuleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4470D5A1EB76F44008A1B2E /* UnusedOptionalBindingRuleTests.swift */; };
|
||||
D4470D5D1EB8004B008A1B2E /* VerticalParameterAlignmentOnCallRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4470D5C1EB8004B008A1B2E /* VerticalParameterAlignmentOnCallRule.swift */; };
|
||||
D4492B9323DD499A004EC27B /* _CSwiftSyntax.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D4492B9123DD499A004EC27B /* _CSwiftSyntax.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
|
||||
D4492B9523DD499A004EC27B /* SwiftSyntax.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D4492B9223DD499A004EC27B /* SwiftSyntax.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
|
||||
D44AD2761C0AA5350048F7B0 /* LegacyConstructorRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D44AD2741C0AA3730048F7B0 /* LegacyConstructorRule.swift */; };
|
||||
D450D1D121EC4A6900E60010 /* StrongIBOutletRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D450D1D021EC4A6900E60010 /* StrongIBOutletRule.swift */; };
|
||||
D450D1DD21F199F700E60010 /* TrailingClosureConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = D450D1DA21F1992E00E60010 /* TrailingClosureConfiguration.swift */; };
|
||||
|
@ -306,6 +312,8 @@
|
|||
D462021F1E15F52D0027AAD1 /* NumberSeparatorRuleExamples.swift in Sources */ = {isa = PBXBuildFile; fileRef = D462021E1E15F52D0027AAD1 /* NumberSeparatorRuleExamples.swift */; };
|
||||
D46252541DF63FB200BE2CA1 /* NumberSeparatorRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D46252531DF63FB200BE2CA1 /* NumberSeparatorRule.swift */; };
|
||||
D466B620233D229F0068190B /* FlatMapOverMapReduceRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D466B61F233D229F0068190B /* FlatMapOverMapReduceRule.swift */; };
|
||||
D467275823DD971300DE73B6 /* VoidFunctionInTernaryConditionRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D467275723DD971300DE73B6 /* VoidFunctionInTernaryConditionRule.swift */; };
|
||||
D467275A23DE71D200DE73B6 /* TuplePatternRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D467275923DE71D200DE73B6 /* TuplePatternRule.swift */; };
|
||||
D46A317F1F1CEDCD00AF914A /* UnneededParenthesesInClosureArgumentRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D46A317E1F1CEDCD00AF914A /* UnneededParenthesesInClosureArgumentRule.swift */; };
|
||||
D46C7C3E23BF2F6A007C517F /* PreferSelfTypeOverTypeOfSelfRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D46C7C3D23BF2F6A007C517F /* PreferSelfTypeOverTypeOfSelfRule.swift */; };
|
||||
D46E041D1DE3712C00728374 /* TrailingCommaRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D46E041C1DE3712C00728374 /* TrailingCommaRule.swift */; };
|
||||
|
@ -368,11 +376,14 @@
|
|||
D4DE9133207B4750000FFAA8 /* UnavailableFunctionRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4DE9131207B4731000FFAA8 /* UnavailableFunctionRule.swift */; };
|
||||
D4E2BA851F6CD77B00E8E184 /* ArrayInitRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4E2BA841F6CD77B00E8E184 /* ArrayInitRule.swift */; };
|
||||
D4E4FB5223E7A1A300746FCD /* LineEndingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4E4FB5123E7A1A300746FCD /* LineEndingTests.swift */; };
|
||||
D4E4FB5523E7A6CF00746FCD /* ReturnValueFromVoidFunctionRuleExamples.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4E4FB5323E7A6CF00746FCD /* ReturnValueFromVoidFunctionRuleExamples.swift */; };
|
||||
D4E4FB5623E7A6CF00746FCD /* ReturnValueFromVoidFunctionRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4E4FB5423E7A6CF00746FCD /* ReturnValueFromVoidFunctionRule.swift */; };
|
||||
D4E92D1F2137B4C9002EDD48 /* IdenticalOperandsRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4E92D1E2137B4C9002EDD48 /* IdenticalOperandsRule.swift */; };
|
||||
D4EA77C81F817FD200C315FB /* UnneededBreakInSwitchRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4EA77C71F817FD200C315FB /* UnneededBreakInSwitchRule.swift */; };
|
||||
D4EA77CA1F81FACC00C315FB /* LiteralExpressionEndIdentationRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4EA77C91F81FACC00C315FB /* LiteralExpressionEndIdentationRule.swift */; };
|
||||
D4EAB3A420E9948E0051C09A /* AutomaticRuleTests.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4EAB3A320E9948D0051C09A /* AutomaticRuleTests.generated.swift */; };
|
||||
D4EABD0C22CE6F5B00635667 /* VerticalParameterAlignmentRuleExamples.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4EABD0B22CE6F5B00635667 /* VerticalParameterAlignmentRuleExamples.swift */; };
|
||||
D4EF8EA223E695EA0038C26E /* SyntaxRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4EF8EA123E695EA0038C26E /* SyntaxRule.swift */; };
|
||||
D4F10614229A2F5E00FDE319 /* NoFallthroughOnlyRuleExamples.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4F10613229A2F5E00FDE319 /* NoFallthroughOnlyRuleExamples.swift */; };
|
||||
D4F10616229A331200FDE319 /* LegacyMultipleRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4F10615229A331200FDE319 /* LegacyMultipleRule.swift */; };
|
||||
D4F5851520E99A8A0085C6D8 /* TrailingWhitespaceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4F5851320E99A720085C6D8 /* TrailingWhitespaceTests.swift */; };
|
||||
|
@ -791,6 +802,7 @@
|
|||
D40AD0891E032F9700F48C30 /* UnusedClosureParameterRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnusedClosureParameterRule.swift; sourceTree = "<group>"; };
|
||||
D40E041B1F46E3B30043BC4E /* SuperfluousDisableCommandRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SuperfluousDisableCommandRule.swift; sourceTree = "<group>"; };
|
||||
D40F83871DE9179200524C62 /* TrailingCommaConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrailingCommaConfiguration.swift; sourceTree = "<group>"; };
|
||||
D40F8B6623E6D60E00A5218E /* PhohibitedNaNComparisonRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhohibitedNaNComparisonRule.swift; sourceTree = "<group>"; };
|
||||
D40FE89C1F867BFF006433E2 /* OverrideInExtensionRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OverrideInExtensionRule.swift; sourceTree = "<group>"; };
|
||||
D4130D961E16183F00242361 /* IdentifierNameRuleExamples.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IdentifierNameRuleExamples.swift; sourceTree = "<group>"; };
|
||||
D4130D981E16CC1300242361 /* TypeNameRuleExamples.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TypeNameRuleExamples.swift; sourceTree = "<group>"; };
|
||||
|
@ -804,6 +816,9 @@
|
|||
D41B57771ED8CEE0007B0470 /* ExtensionAccessModifierRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExtensionAccessModifierRule.swift; sourceTree = "<group>"; };
|
||||
D41C09BC23C1B99D00F105C4 /* OrphanedDocCommentRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OrphanedDocCommentRule.swift; sourceTree = "<group>"; };
|
||||
D41E7E0A1DF9DABB0065259A /* RedundantStringEnumValueRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RedundantStringEnumValueRule.swift; sourceTree = "<group>"; };
|
||||
D423FCE523F3E0AB00607F3A /* library_wrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = library_wrapper.swift; sourceTree = "<group>"; };
|
||||
D423FCE723F3E0D900607F3A /* library_wrapper_SwiftSyntax.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = library_wrapper_SwiftSyntax.swift; sourceTree = "<group>"; };
|
||||
D423FCE923F3E28700607F3A /* Exec.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Exec.swift; sourceTree = "<group>"; };
|
||||
D4246D6C1F30D8620097E658 /* PrivateOverFilePrivateRuleConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrivateOverFilePrivateRuleConfiguration.swift; sourceTree = "<group>"; };
|
||||
D4246D6E1F30DB260097E658 /* PrivateOverFilePrivateRuleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PrivateOverFilePrivateRuleTests.swift; sourceTree = "<group>"; };
|
||||
D42B45D81F0AF5E30086B683 /* StrictFilePrivateRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StrictFilePrivateRule.swift; sourceTree = "<group>"; };
|
||||
|
@ -824,6 +839,8 @@
|
|||
D4470D581EB6B4D1008A1B2E /* EmptyEnumArgumentsRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmptyEnumArgumentsRule.swift; sourceTree = "<group>"; };
|
||||
D4470D5A1EB76F44008A1B2E /* UnusedOptionalBindingRuleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnusedOptionalBindingRuleTests.swift; sourceTree = "<group>"; };
|
||||
D4470D5C1EB8004B008A1B2E /* VerticalParameterAlignmentOnCallRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VerticalParameterAlignmentOnCallRule.swift; sourceTree = "<group>"; };
|
||||
D4492B9123DD499A004EC27B /* _CSwiftSyntax.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = _CSwiftSyntax.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D4492B9223DD499A004EC27B /* SwiftSyntax.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = SwiftSyntax.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D44AD2741C0AA3730048F7B0 /* LegacyConstructorRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegacyConstructorRule.swift; sourceTree = "<group>"; };
|
||||
D450D1D021EC4A6900E60010 /* StrongIBOutletRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StrongIBOutletRule.swift; sourceTree = "<group>"; };
|
||||
D450D1DA21F1992E00E60010 /* TrailingClosureConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrailingClosureConfiguration.swift; sourceTree = "<group>"; };
|
||||
|
@ -833,6 +850,8 @@
|
|||
D462021E1E15F52D0027AAD1 /* NumberSeparatorRuleExamples.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumberSeparatorRuleExamples.swift; sourceTree = "<group>"; };
|
||||
D46252531DF63FB200BE2CA1 /* NumberSeparatorRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumberSeparatorRule.swift; sourceTree = "<group>"; };
|
||||
D466B61F233D229F0068190B /* FlatMapOverMapReduceRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlatMapOverMapReduceRule.swift; sourceTree = "<group>"; };
|
||||
D467275723DD971300DE73B6 /* VoidFunctionInTernaryConditionRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VoidFunctionInTernaryConditionRule.swift; sourceTree = "<group>"; };
|
||||
D467275923DE71D200DE73B6 /* TuplePatternRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TuplePatternRule.swift; sourceTree = "<group>"; };
|
||||
D46A317E1F1CEDCD00AF914A /* UnneededParenthesesInClosureArgumentRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnneededParenthesesInClosureArgumentRule.swift; sourceTree = "<group>"; };
|
||||
D46C7C3D23BF2F6A007C517F /* PreferSelfTypeOverTypeOfSelfRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferSelfTypeOverTypeOfSelfRule.swift; sourceTree = "<group>"; };
|
||||
D46E041C1DE3712C00728374 /* TrailingCommaRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TrailingCommaRule.swift; sourceTree = "<group>"; };
|
||||
|
@ -896,11 +915,14 @@
|
|||
D4DE9131207B4731000FFAA8 /* UnavailableFunctionRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnavailableFunctionRule.swift; sourceTree = "<group>"; };
|
||||
D4E2BA841F6CD77B00E8E184 /* ArrayInitRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayInitRule.swift; sourceTree = "<group>"; };
|
||||
D4E4FB5123E7A1A300746FCD /* LineEndingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LineEndingTests.swift; sourceTree = "<group>"; };
|
||||
D4E4FB5323E7A6CF00746FCD /* ReturnValueFromVoidFunctionRuleExamples.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReturnValueFromVoidFunctionRuleExamples.swift; sourceTree = "<group>"; };
|
||||
D4E4FB5423E7A6CF00746FCD /* ReturnValueFromVoidFunctionRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReturnValueFromVoidFunctionRule.swift; sourceTree = "<group>"; };
|
||||
D4E92D1E2137B4C9002EDD48 /* IdenticalOperandsRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IdenticalOperandsRule.swift; sourceTree = "<group>"; };
|
||||
D4EA77C71F817FD200C315FB /* UnneededBreakInSwitchRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnneededBreakInSwitchRule.swift; sourceTree = "<group>"; };
|
||||
D4EA77C91F81FACC00C315FB /* LiteralExpressionEndIdentationRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LiteralExpressionEndIdentationRule.swift; sourceTree = "<group>"; };
|
||||
D4EAB3A320E9948D0051C09A /* AutomaticRuleTests.generated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AutomaticRuleTests.generated.swift; sourceTree = "<group>"; };
|
||||
D4EABD0B22CE6F5B00635667 /* VerticalParameterAlignmentRuleExamples.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerticalParameterAlignmentRuleExamples.swift; sourceTree = "<group>"; };
|
||||
D4EF8EA123E695EA0038C26E /* SyntaxRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SyntaxRule.swift; sourceTree = "<group>"; };
|
||||
D4F10613229A2F5E00FDE319 /* NoFallthroughOnlyRuleExamples.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NoFallthroughOnlyRuleExamples.swift; sourceTree = "<group>"; };
|
||||
D4F10615229A331200FDE319 /* LegacyMultipleRule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyMultipleRule.swift; sourceTree = "<group>"; };
|
||||
D4F5851320E99A720085C6D8 /* TrailingWhitespaceTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrailingWhitespaceTests.swift; sourceTree = "<group>"; };
|
||||
|
@ -1002,8 +1024,10 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E876BFBE1B07828500114ED5 /* SourceKittenFramework.framework in Frameworks */,
|
||||
D4492B9323DD499A004EC27B /* _CSwiftSyntax.framework in Frameworks */,
|
||||
E8C0DFCD1AD349DB007EE3D4 /* SWXMLHash.framework in Frameworks */,
|
||||
3BBF2F9D1C640A0F006CD775 /* SwiftyTextTable.framework in Frameworks */,
|
||||
D4492B9523DD499A004EC27B /* SwiftSyntax.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -1109,6 +1133,9 @@
|
|||
C25EBBE321078DC700E27603 /* Glob.swift */,
|
||||
D4AB0EA11F8993DD00CEC380 /* NamespaceCollector.swift */,
|
||||
4DCB8E7D1CBE43640070FCF0 /* RegexHelpers.swift */,
|
||||
D423FCE523F3E0AB00607F3A /* library_wrapper.swift */,
|
||||
D423FCE723F3E0D900607F3A /* library_wrapper_SwiftSyntax.swift */,
|
||||
D423FCE923F3E28700607F3A /* Exec.swift */,
|
||||
);
|
||||
path = Helpers;
|
||||
sourceTree = "<group>";
|
||||
|
@ -1194,6 +1221,7 @@
|
|||
094385021D5D4F78009168CF /* PrivateOutletRule.swift */,
|
||||
B2902A0B1D66815600BFCCF7 /* PrivateUnitTestRule.swift */,
|
||||
D44037962132730000FDA77B /* ProhibitedInterfaceBuilderRule.swift */,
|
||||
D40F8B6623E6D60E00A5218E /* PhohibitedNaNComparisonRule.swift */,
|
||||
009E09271DFEE4C200B588A7 /* ProhibitedSuperRule.swift */,
|
||||
623E36EF1F3DB1B1002E5B71 /* QuickDiscouragedCallRule.swift */,
|
||||
623E36F11F3DB988002E5B71 /* QuickDiscouragedCallRuleExamples.swift */,
|
||||
|
@ -1361,17 +1389,21 @@
|
|||
D41E7E0A1DF9DABB0065259A /* RedundantStringEnumValueRule.swift */,
|
||||
6208ED4E20C297AC004E78D1 /* RedundantTypeAnnotationRule.swift */,
|
||||
D4B022B11E10B613007E5297 /* RedundantVoidReturnRule.swift */,
|
||||
D4E4FB5423E7A6CF00746FCD /* ReturnValueFromVoidFunctionRule.swift */,
|
||||
D4E4FB5323E7A6CF00746FCD /* ReturnValueFromVoidFunctionRuleExamples.swift */,
|
||||
D4D383842145F550000235BD /* StaticOperatorRule.swift */,
|
||||
D42B45D81F0AF5E30086B683 /* StrictFilePrivateRule.swift */,
|
||||
D44254251DB9C12300492EA4 /* SyntacticSugarRule.swift */,
|
||||
7551DF6C21382C9A00AA1F4D /* ToggleBoolRule.swift */,
|
||||
E87E4A041BFB927C00FCFE46 /* TrailingSemicolonRule.swift */,
|
||||
D467275923DE71D200DE73B6 /* TuplePatternRule.swift */,
|
||||
E88DEA911B099B1F00A66CB0 /* TypeNameRule.swift */,
|
||||
D4130D981E16CC1300242361 /* TypeNameRuleExamples.swift */,
|
||||
D4DE9131207B4731000FFAA8 /* UnavailableFunctionRule.swift */,
|
||||
D4EA77C71F817FD200C315FB /* UnneededBreakInSwitchRule.swift */,
|
||||
181D9E162038343D001F6887 /* UntypedErrorInCatchRule.swift */,
|
||||
D43B04631E0620AB004016AF /* UnusedEnumeratedRule.swift */,
|
||||
D467275723DD971300DE73B6 /* VoidFunctionInTernaryConditionRule.swift */,
|
||||
41715DE023BEA08E00544BDF /* FileNameNoSpaceRule.swift */,
|
||||
626D02961F31CBCC0054788D /* XCTFailMessageRule.swift */,
|
||||
622AD7FF216ACE6200A002C6 /* XCTSpecificMatcherRule.swift */,
|
||||
|
@ -1396,6 +1428,7 @@
|
|||
D0D1211A19E87861005E4BAA /* swiftlint */,
|
||||
D0D1216E19E87B05005E4BAA /* SwiftLintFramework */,
|
||||
D0D1217B19E87B05005E4BAA /* SwiftLintFrameworkTests */,
|
||||
D4492B9023DD499A004EC27B /* Frameworks */,
|
||||
);
|
||||
indentWidth = 4;
|
||||
sourceTree = "<group>";
|
||||
|
@ -1621,6 +1654,15 @@
|
|||
path = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
D4492B9023DD499A004EC27B /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D4492B9123DD499A004EC27B /* _CSwiftSyntax.framework */,
|
||||
D4492B9223DD499A004EC27B /* SwiftSyntax.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E802ECFE1C56A54600A35AE1 /* Helpers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -1680,6 +1722,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
E88DEA8B1B0999A000A66CB0 /* ASTRule.swift */,
|
||||
D4EF8EA123E695EA0038C26E /* SyntaxRule.swift */,
|
||||
E80746F51ECB722F00548D31 /* CacheDescriptionProvider.swift */,
|
||||
A73469401FB12149009B57C7 /* CallPairRule.swift */,
|
||||
E86396C11BADAAE5002C9E88 /* Reporter.swift */,
|
||||
|
@ -2060,6 +2103,7 @@
|
|||
341FDB2021AD69970022E8E9 /* MarkdownReporter.swift in Sources */,
|
||||
181D9E172038343D001F6887 /* UntypedErrorInCatchRule.swift in Sources */,
|
||||
47FF3BE11E7C75B600187E6D /* ImplicitlyUnwrappedOptionalRule.swift in Sources */,
|
||||
D423FCE623F3E0AB00607F3A /* library_wrapper.swift in Sources */,
|
||||
623E36F01F3DB1B1002E5B71 /* QuickDiscouragedCallRule.swift in Sources */,
|
||||
288289602229776C0037CF5F /* NSObjectPreferIsEqualRuleExamples.swift in Sources */,
|
||||
BFF028AE1CBCF8A500B38A9D /* TrailingWhitespaceConfiguration.swift in Sources */,
|
||||
|
@ -2069,12 +2113,14 @@
|
|||
62A3E95D209E084000547A86 /* EmptyXCTestMethodRule.swift in Sources */,
|
||||
D4C4A34C1DEA4FF000E0E04C /* AttributesConfiguration.swift in Sources */,
|
||||
29FC197A21382C07006D208C /* DuplicateImportsRuleExamples.swift in Sources */,
|
||||
D4E4FB5623E7A6CF00746FCD /* ReturnValueFromVoidFunctionRule.swift in Sources */,
|
||||
83D71E281B131ECE000395DE /* RuleDescription.swift in Sources */,
|
||||
D4470D571EB69225008A1B2E /* ImplicitReturnRule.swift in Sources */,
|
||||
8FE3CCBC22DBF8D000B8EA87 /* UnusedDeclarationConfiguration.swift in Sources */,
|
||||
3B12C9C51C322032000B423F /* MasterRuleList.swift in Sources */,
|
||||
E812249C1B04FADC001783D2 /* Linter.swift in Sources */,
|
||||
1F11B3CF1C252F23002E8FA8 /* ClosingBraceRule.swift in Sources */,
|
||||
D423FCEA23F3E28700607F3A /* Exec.swift in Sources */,
|
||||
DAD3BE4A1D6ECD9500660239 /* PrivateOutletRuleConfiguration.swift in Sources */,
|
||||
188B3FF4207D61230073C2D6 /* ModifierOrderConfiguration.swift in Sources */,
|
||||
183B6B4921FF672B00425134 /* RedundantObjcAttributeRuleExamples.swift in Sources */,
|
||||
|
@ -2084,6 +2130,7 @@
|
|||
D4C4A3521DEFBBB700E0E04C /* FileHeaderConfiguration.swift in Sources */,
|
||||
623675B01F960C5C009BE6F3 /* QuickDiscouragedPendingTestRule.swift in Sources */,
|
||||
287F8B642230843000BDC504 /* NSLocalizedStringRequireBundleRule.swift in Sources */,
|
||||
D4EF8EA223E695EA0038C26E /* SyntaxRule.swift in Sources */,
|
||||
D47079AD1DFE2FA700027086 /* EmptyParametersRule.swift in Sources */,
|
||||
E87E4A091BFB9CAE00FCFE46 /* SyntaxKind+SwiftLint.swift in Sources */,
|
||||
3B0B14541C505D6300BE82F7 /* SeverityConfiguration.swift in Sources */,
|
||||
|
@ -2149,6 +2196,7 @@
|
|||
E8EA41171C2D1DBE004F9930 /* CheckstyleReporter.swift in Sources */,
|
||||
006ECFC41C44E99E00EF6364 /* LegacyConstantRule.swift in Sources */,
|
||||
82FE254120F604CB00295958 /* VerticalWhitespaceClosingBracesRule.swift in Sources */,
|
||||
D40F8B6723E6D60E00A5218E /* PhohibitedNaNComparisonRule.swift in Sources */,
|
||||
429644B61FB0A9B400D75128 /* SortedFirstLastRule.swift in Sources */,
|
||||
C3EF547821B5A4000009262F /* LegacyHashingRule.swift in Sources */,
|
||||
31F1B6CC1F60BF4500A57456 /* SwitchCaseAlignmentRule.swift in Sources */,
|
||||
|
@ -2237,6 +2285,7 @@
|
|||
18B90B6B21ADD99800B60749 /* RedundantObjcAttributeRule.swift in Sources */,
|
||||
D46C7C3E23BF2F6A007C517F /* PreferSelfTypeOverTypeOfSelfRule.swift in Sources */,
|
||||
93E0C3CE1D67BD7F007FA25D /* ConditionalReturnsOnNewlineRule.swift in Sources */,
|
||||
D423FCE823F3E0D900607F3A /* library_wrapper_SwiftSyntax.swift in Sources */,
|
||||
D43DB1081DC573DA00281215 /* ImplicitGetterRule.swift in Sources */,
|
||||
D450D1D121EC4A6900E60010 /* StrongIBOutletRule.swift in Sources */,
|
||||
824AB64D2105C39F004B5A8F /* ConditionalReturnsOnNewlineConfiguration.swift in Sources */,
|
||||
|
@ -2301,6 +2350,7 @@
|
|||
E83530C61ED6328A00FBAF79 /* FileNameRule.swift in Sources */,
|
||||
3BB47D831C514E8100AE6A10 /* RegexConfiguration.swift in Sources */,
|
||||
D401D9261ED85EF0005DA5D4 /* RuleKind.swift in Sources */,
|
||||
D467275A23DE71D200DE73B6 /* TuplePatternRule.swift in Sources */,
|
||||
622AD800216ACE6300A002C6 /* XCTSpecificMatcherRuleExamples.swift in Sources */,
|
||||
82EB7886215BAE790042E0FD /* TypeContentsOrderRuleExamples.swift in Sources */,
|
||||
7551DF6D21382C9A00AA1F4D /* ToggleBoolRule.swift in Sources */,
|
||||
|
@ -2316,6 +2366,7 @@
|
|||
6C15818D237026AC00F582A2 /* GitHubActionsLoggingReporter.swift in Sources */,
|
||||
62FE5D32200CABDD00F68793 /* DiscouragedOptionalCollectionExamples.swift in Sources */,
|
||||
D41C09BD23C1B99D00F105C4 /* OrphanedDocCommentRule.swift in Sources */,
|
||||
D467275823DD971300DE73B6 /* VoidFunctionInTernaryConditionRule.swift in Sources */,
|
||||
D49896F12026B36C00814A83 /* RedundantSetAccessControlRule.swift in Sources */,
|
||||
E4A6CF752363CBFB00DD5B18 /* RandomAccessCollection+Swiftlint.swift in Sources */,
|
||||
29FFC37A1F15764D007E4825 /* FileLengthRuleConfiguration.swift in Sources */,
|
||||
|
@ -2329,6 +2380,7 @@
|
|||
C946FECB1EAE67EE007DD778 /* LetVarWhitespaceRule.swift in Sources */,
|
||||
E881985D1BEA97EB00333A11 /* TrailingWhitespaceRule.swift in Sources */,
|
||||
E832F10B1B17E2F5003F265F /* FileManager+SwiftLint.swift in Sources */,
|
||||
D4E4FB5523E7A6CF00746FCD /* ReturnValueFromVoidFunctionRuleExamples.swift in Sources */,
|
||||
E816194C1BFBF35D00946723 /* SwiftDeclarationKind+SwiftLint.swift in Sources */,
|
||||
D4DABFD71E2C23B1009617B6 /* NotificationCenterDetachmentRule.swift in Sources */,
|
||||
3BA79C9B1C4767910057E705 /* NSRange+SwiftLint.swift in Sources */,
|
||||
|
@ -2488,7 +2540,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = D0D1212619E878CC005E4BAA /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -2497,7 +2549,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = D0D1212819E878CC005E4BAA /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -2574,7 +2626,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = D0D1212719E878CC005E4BAA /* Profile.xcconfig */;
|
||||
buildSettings = {
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Profile;
|
||||
|
@ -2617,7 +2669,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = D0D1212919E878CC005E4BAA /* Test.xcconfig */;
|
||||
buildSettings = {
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.12;
|
||||
SWIFT_VERSION = 4.0;
|
||||
};
|
||||
name = Test;
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
<FileRef
|
||||
location = "group:Carthage/Checkouts/SwiftyTextTable/SwiftyTextTable.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:SwiftSyntax/SwiftSyntax.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Carthage/Checkouts/Yams/Yams.xcodeproj">
|
||||
</FileRef>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 3e3eb191fcdbecc6031522660c4ed6ce25282c25
|
|
@ -1064,6 +1064,12 @@ extension PatternMatchingKeywordsRuleTests {
|
|||
]
|
||||
}
|
||||
|
||||
extension PhohibitedNaNComparisonRuleTests {
|
||||
static var allTests: [(String, (PhohibitedNaNComparisonRuleTests) -> () throws -> Void)] = [
|
||||
("testWithDefaultConfiguration", testWithDefaultConfiguration)
|
||||
]
|
||||
}
|
||||
|
||||
extension PreferSelfTypeOverTypeOfSelfRuleTests {
|
||||
static var allTests: [(String, (PreferSelfTypeOverTypeOfSelfRuleTests) -> () throws -> Void)] = [
|
||||
("testWithDefaultConfiguration", testWithDefaultConfiguration)
|
||||
|
@ -1262,6 +1268,12 @@ extension ReturnArrowWhitespaceRuleTests {
|
|||
]
|
||||
}
|
||||
|
||||
extension ReturnValueFromVoidFunctionRuleTests {
|
||||
static var allTests: [(String, (ReturnValueFromVoidFunctionRuleTests) -> () throws -> Void)] = [
|
||||
("testWithDefaultConfiguration", testWithDefaultConfiguration)
|
||||
]
|
||||
}
|
||||
|
||||
extension RuleConfigurationTests {
|
||||
static var allTests: [(String, (RuleConfigurationTests) -> () throws -> Void)] = [
|
||||
("testNameConfigurationSetsCorrectly", testNameConfigurationSetsCorrectly),
|
||||
|
@ -1445,6 +1457,12 @@ extension TrailingWhitespaceTests {
|
|||
]
|
||||
}
|
||||
|
||||
extension TuplePatternRuleTests {
|
||||
static var allTests: [(String, (TuplePatternRuleTests) -> () throws -> Void)] = [
|
||||
("testWithDefaultConfiguration", testWithDefaultConfiguration)
|
||||
]
|
||||
}
|
||||
|
||||
extension TypeBodyLengthRuleTests {
|
||||
static var allTests: [(String, (TypeBodyLengthRuleTests) -> () throws -> Void)] = [
|
||||
("testWithDefaultConfiguration", testWithDefaultConfiguration)
|
||||
|
@ -1593,6 +1611,12 @@ extension VerticalWhitespaceRuleTests {
|
|||
]
|
||||
}
|
||||
|
||||
extension VoidFunctionInTernaryConditionRuleTests {
|
||||
static var allTests: [(String, (VoidFunctionInTernaryConditionRuleTests) -> () throws -> Void)] = [
|
||||
("testWithDefaultConfiguration", testWithDefaultConfiguration)
|
||||
]
|
||||
}
|
||||
|
||||
extension VoidReturnRuleTests {
|
||||
static var allTests: [(String, (VoidReturnRuleTests) -> () throws -> Void)] = [
|
||||
("testWithDefaultConfiguration", testWithDefaultConfiguration)
|
||||
|
@ -1790,6 +1814,7 @@ XCTMain([
|
|||
testCase(OverriddenSuperCallRuleTests.allTests),
|
||||
testCase(OverrideInExtensionRuleTests.allTests),
|
||||
testCase(PatternMatchingKeywordsRuleTests.allTests),
|
||||
testCase(PhohibitedNaNComparisonRuleTests.allTests),
|
||||
testCase(PreferSelfTypeOverTypeOfSelfRuleTests.allTests),
|
||||
testCase(PrefixedTopLevelConstantRuleTests.allTests),
|
||||
testCase(PrivateActionRuleTests.allTests),
|
||||
|
@ -1818,6 +1843,7 @@ XCTMain([
|
|||
testCase(RequiredDeinitRuleTests.allTests),
|
||||
testCase(RequiredEnumCaseRuleTestCase.allTests),
|
||||
testCase(ReturnArrowWhitespaceRuleTests.allTests),
|
||||
testCase(ReturnValueFromVoidFunctionRuleTests.allTests),
|
||||
testCase(RuleConfigurationTests.allTests),
|
||||
testCase(RuleTests.allTests),
|
||||
testCase(RulesTests.allTests),
|
||||
|
@ -1840,6 +1866,7 @@ XCTMain([
|
|||
testCase(TrailingCommaRuleTests.allTests),
|
||||
testCase(TrailingSemicolonRuleTests.allTests),
|
||||
testCase(TrailingWhitespaceTests.allTests),
|
||||
testCase(TuplePatternRuleTests.allTests),
|
||||
testCase(TypeBodyLengthRuleTests.allTests),
|
||||
testCase(TypeContentsOrderRuleTests.allTests),
|
||||
testCase(TypeNameRuleTests.allTests),
|
||||
|
@ -1863,6 +1890,7 @@ XCTMain([
|
|||
testCase(VerticalWhitespaceClosingBracesRuleTests.allTests),
|
||||
testCase(VerticalWhitespaceOpeningBracesRuleTests.allTests),
|
||||
testCase(VerticalWhitespaceRuleTests.allTests),
|
||||
testCase(VoidFunctionInTernaryConditionRuleTests.allTests),
|
||||
testCase(VoidReturnRuleTests.allTests),
|
||||
testCase(WeakDelegateRuleTests.allTests),
|
||||
testCase(XCTFailMessageRuleTests.allTests),
|
||||
|
|
|
@ -510,6 +510,12 @@ class PatternMatchingKeywordsRuleTests: XCTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
class PhohibitedNaNComparisonRuleTests: XCTestCase {
|
||||
func testWithDefaultConfiguration() {
|
||||
verifyRule(PhohibitedNaNComparisonRule.description)
|
||||
}
|
||||
}
|
||||
|
||||
class PreferSelfTypeOverTypeOfSelfRuleTests: XCTestCase {
|
||||
func testWithDefaultConfiguration() {
|
||||
verifyRule(PreferSelfTypeOverTypeOfSelfRule.description)
|
||||
|
@ -642,6 +648,12 @@ class ReturnArrowWhitespaceRuleTests: XCTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
class ReturnValueFromVoidFunctionRuleTests: XCTestCase {
|
||||
func testWithDefaultConfiguration() {
|
||||
verifyRule(ReturnValueFromVoidFunctionRule.description)
|
||||
}
|
||||
}
|
||||
|
||||
class ShorthandOperatorRuleTests: XCTestCase {
|
||||
func testWithDefaultConfiguration() {
|
||||
verifyRule(ShorthandOperatorRule.description)
|
||||
|
@ -708,6 +720,12 @@ class TrailingSemicolonRuleTests: XCTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
class TuplePatternRuleTests: XCTestCase {
|
||||
func testWithDefaultConfiguration() {
|
||||
verifyRule(TuplePatternRule.description)
|
||||
}
|
||||
}
|
||||
|
||||
class TypeBodyLengthRuleTests: XCTestCase {
|
||||
func testWithDefaultConfiguration() {
|
||||
verifyRule(TypeBodyLengthRule.description)
|
||||
|
@ -822,6 +840,12 @@ class VerticalWhitespaceOpeningBracesRuleTests: XCTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
class VoidFunctionInTernaryConditionRuleTests: XCTestCase {
|
||||
func testWithDefaultConfiguration() {
|
||||
verifyRule(VoidFunctionInTernaryConditionRule.description)
|
||||
}
|
||||
}
|
||||
|
||||
class VoidReturnRuleTests: XCTestCase {
|
||||
func testWithDefaultConfiguration() {
|
||||
verifyRule(VoidReturnRule.description)
|
||||
|
|
|
@ -88,7 +88,8 @@ extension ConfigurationTests {
|
|||
let mergedConfiguration = projectMockConfig0CustomRules.merge(with: projectMockConfig2CustomRules)
|
||||
guard let mergedCustomRules = mergedConfiguration.rules.first(where: { $0 is CustomRules }) as? CustomRules
|
||||
else {
|
||||
return XCTFail("Custom rule are expected to be present")
|
||||
XCTFail("Custom rule are expected to be present")
|
||||
return
|
||||
}
|
||||
XCTAssertTrue(
|
||||
mergedCustomRules.configuration.customRuleConfigurations.contains(where: { $0.identifier == "no_abc" })
|
||||
|
@ -102,7 +103,8 @@ extension ConfigurationTests {
|
|||
let mergedConfiguration = projectMockConfig0CustomRules.merge(with: projectMockConfig2CustomRulesDisabled)
|
||||
guard let mergedCustomRules = mergedConfiguration.rules.first(where: { $0 is CustomRules }) as? CustomRules
|
||||
else {
|
||||
return XCTFail("Custom rule are expected to be present")
|
||||
XCTFail("Custom rule are expected to be present")
|
||||
return
|
||||
}
|
||||
XCTAssertFalse(
|
||||
mergedCustomRules.configuration.customRuleConfigurations.contains(where: { $0.identifier == "no_abc" })
|
||||
|
|
|
@ -23,15 +23,11 @@ jobs:
|
|||
strategy:
|
||||
maxParallel: 10
|
||||
matrix:
|
||||
xcode102:
|
||||
DEVELOPER_DIR: /Applications/Xcode_10.2.app
|
||||
xcode103:
|
||||
DEVELOPER_DIR: /Applications/Xcode_10.3.app
|
||||
xcode111:
|
||||
DEVELOPER_DIR: /Applications/Xcode_11.1.app
|
||||
steps:
|
||||
- script: git submodule update --init --recursive
|
||||
displayName: Update git submodules
|
||||
- script: Script/bootstrap
|
||||
displayName: Bootstrap
|
||||
- script: |
|
||||
sw_vers
|
||||
xcodebuild -version
|
||||
|
|
|
@ -21,6 +21,8 @@ main ()
|
|||
echo "*** Updating submodules..."
|
||||
update_submodules
|
||||
fi
|
||||
|
||||
cd "SwiftSyntax" && swift package generate-xcodeproj
|
||||
}
|
||||
|
||||
bootstrap_submodule ()
|
||||
|
|
Loading…
Reference in New Issue