mirror of
https://github.com/realm/SwiftLint.git
synced 2026-06-06 20:18:40 +00:00
Enable upcoming feature "Concise Magic File" (#5637)
This commit is contained in:
+4
-1
@@ -163,6 +163,9 @@ internal struct DiscouragedOptionalBooleanRuleExamples {
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func wrapExample(_ type: String, _ test: String, file: StaticString = #file, line: UInt = #line) -> Example {
|
||||
private func wrapExample(_ type: String,
|
||||
_ test: String,
|
||||
file: StaticString = #filePath,
|
||||
line: UInt = #line) -> Example {
|
||||
return Example("\(type) Foo {\n\t\(test)\n}", file: file, line: line)
|
||||
}
|
||||
|
||||
+4
-1
@@ -210,7 +210,10 @@ internal struct DiscouragedOptionalCollectionExamples {
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func wrapExample(_ type: String, _ test: String, file: StaticString = #file, line: UInt = #line) -> Example {
|
||||
private func wrapExample(_ type: String,
|
||||
_ test: String,
|
||||
file: StaticString = #filePath,
|
||||
line: UInt = #line) -> Example {
|
||||
return Example("""
|
||||
\(type) Foo {
|
||||
\(test)
|
||||
|
||||
@@ -3,7 +3,7 @@ import SwiftSyntax
|
||||
private func embedInSwitch(
|
||||
_ text: String,
|
||||
case: String = "case .bar",
|
||||
file: StaticString = #file, line: UInt = #line) -> Example {
|
||||
file: StaticString = #filePath, line: UInt = #line) -> Example {
|
||||
return Example("""
|
||||
switch foo {
|
||||
\(`case`):
|
||||
|
||||
@@ -36,7 +36,7 @@ private extension ProhibitedInterfaceBuilderRule {
|
||||
}
|
||||
}
|
||||
|
||||
private func wrapExample(_ text: String, file: StaticString = #file, line: UInt = #line) -> Example {
|
||||
private func wrapExample(_ text: String, file: StaticString = #filePath, line: UInt = #line) -> Example {
|
||||
return Example("""
|
||||
class ViewController: UIViewController {
|
||||
\(text)
|
||||
|
||||
@@ -68,7 +68,7 @@ private extension VariableDeclSyntax {
|
||||
}
|
||||
}
|
||||
|
||||
private func wrapExample(_ text: String, file: StaticString = #file, line: UInt = #line) -> Example {
|
||||
private func wrapExample(_ text: String, file: StaticString = #filePath, line: UInt = #line) -> Example {
|
||||
return Example("""
|
||||
class ViewController: UIViewController {
|
||||
\(text)
|
||||
|
||||
@@ -29,7 +29,7 @@ internal struct ClosureBodyLengthRuleExamples {
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func singleLineClosure(file: StaticString = #file, line: UInt = #line) -> Example {
|
||||
private func singleLineClosure(file: StaticString = #filePath, line: UInt = #line) -> Example {
|
||||
return Example("foo.bar { $0 }", file: file, line: line)
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ private func trailingClosure(_ violationSymbol: String = "",
|
||||
codeLinesCount: Int,
|
||||
commentLinesCount: Int,
|
||||
emptyLinesCount: Int,
|
||||
file: StaticString = #file,
|
||||
file: StaticString = #filePath,
|
||||
line: UInt = #line) -> Example {
|
||||
return Example("""
|
||||
foo.bar \(violationSymbol){ toto in
|
||||
@@ -50,7 +50,7 @@ private func trailingClosure(_ violationSymbol: String = "",
|
||||
|
||||
private func argumentClosure(_ violationSymbol: String = "",
|
||||
codeLinesCount: Int,
|
||||
file: StaticString = #file,
|
||||
file: StaticString = #filePath,
|
||||
line: UInt = #line) -> Example {
|
||||
return Example("""
|
||||
foo.bar(\(violationSymbol){ toto in
|
||||
@@ -61,7 +61,7 @@ private func argumentClosure(_ violationSymbol: String = "",
|
||||
|
||||
private func labeledArgumentClosure(_ violationSymbol: String = "",
|
||||
codeLinesCount: Int,
|
||||
file: StaticString = #file,
|
||||
file: StaticString = #filePath,
|
||||
line: UInt = #line) -> Example {
|
||||
return Example("""
|
||||
foo.bar(label: \(violationSymbol){ toto in
|
||||
@@ -72,7 +72,7 @@ private func labeledArgumentClosure(_ violationSymbol: String = "",
|
||||
|
||||
private func multiLabeledArgumentClosures(_ violationSymbol: String = "",
|
||||
codeLinesCount: Int,
|
||||
file: StaticString = #file,
|
||||
file: StaticString = #filePath,
|
||||
line: UInt = #line) -> Example {
|
||||
return Example("""
|
||||
foo.bar(label: \(violationSymbol){ toto in
|
||||
@@ -85,7 +85,7 @@ private func multiLabeledArgumentClosures(_ violationSymbol: String = "",
|
||||
|
||||
private func labeledAndTrailingClosures(_ violationSymbol: String = "",
|
||||
codeLinesCount: Int,
|
||||
file: StaticString = #file,
|
||||
file: StaticString = #filePath,
|
||||
line: UInt = #line) -> Example {
|
||||
return Example("""
|
||||
foo.bar(label: \(violationSymbol){ toto in
|
||||
@@ -98,7 +98,7 @@ private func labeledAndTrailingClosures(_ violationSymbol: String = "",
|
||||
|
||||
private func lazyInitialization(_ violationSymbol: String = "",
|
||||
codeLinesCount: Int,
|
||||
file: StaticString = #file,
|
||||
file: StaticString = #filePath,
|
||||
line: UInt = #line) -> Example {
|
||||
return Example("""
|
||||
let foo: Bar = \(violationSymbol){ toto in
|
||||
|
||||
@@ -4,7 +4,7 @@ private func wrapExample(
|
||||
_ template: String,
|
||||
_ count: Int,
|
||||
_ add: String = "",
|
||||
file: StaticString = #file,
|
||||
file: StaticString = #filePath,
|
||||
line: UInt = #line) -> Example {
|
||||
return Example("\(prefix)\(type) Abc {\n" +
|
||||
repeatElement(template, count: count).joined() + "\(add)}\n", file: file, line: line)
|
||||
|
||||
@@ -3,7 +3,7 @@ import SwiftSyntax
|
||||
private func wrapInSwitch(
|
||||
variable: String = "foo",
|
||||
_ str: String,
|
||||
file: StaticString = #file, line: UInt = #line) -> Example {
|
||||
file: StaticString = #filePath, line: UInt = #line) -> Example {
|
||||
return Example(
|
||||
"""
|
||||
switch \(variable) {
|
||||
@@ -12,7 +12,7 @@ private func wrapInSwitch(
|
||||
""", file: file, line: line)
|
||||
}
|
||||
|
||||
private func wrapInFunc(_ str: String, file: StaticString = #file, line: UInt = #line) -> Example {
|
||||
private func wrapInFunc(_ str: String, file: StaticString = #filePath, line: UInt = #line) -> Example {
|
||||
return Example("""
|
||||
func example(foo: Foo) {
|
||||
switch foo {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftSyntax
|
||||
|
||||
private func wrapInSwitch(_ str: String, file: StaticString = #file, line: UInt = #line) -> Example {
|
||||
private func wrapInSwitch(_ str: String, file: StaticString = #filePath, line: UInt = #line) -> Example {
|
||||
return Example("""
|
||||
switch foo {
|
||||
\(str)
|
||||
|
||||
Reference in New Issue
Block a user