Skip to content

Commit 11cbac6

Browse files
authored
Enable consider_default_literal_types_redundant option (#5555)
1 parent 1658f1d commit 11cbac6

File tree

7 files changed

+14
-12
lines changed

7 files changed

+14
-12
lines changed

.swiftlint.yml

+2
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ single_test_class: *unit_test_configuration
8080
final_test_case: *unit_test_configuration
8181
function_body_length: 60
8282
type_body_length: 400
83+
redundant_type_annotation:
84+
consider_default_literal_types_redundant: true
8385

8486
custom_rules:
8587
rule_id:

Source/SwiftLintBuiltInRules/Rules/Idiomatic/StrictFilePrivateRule.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ private extension StrictFilePrivateRule {
205205

206206
private final class ProtocolCollector<Configuration: RuleConfiguration>: ViolationsSyntaxVisitor<Configuration> {
207207
private(set) var protocols = [String: [ProtocolRequirementType]]()
208-
private var currentProtocolName: String = ""
208+
private var currentProtocolName = ""
209209

210210
override var skippableDeclarations: [any DeclSyntaxProtocol.Type] { .allExcept(ProtocolDeclSyntax.self) }
211211

Source/SwiftLintCore/Extensions/Configuration+Remote.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@ import FoundationNetworking
77
internal extension Configuration.FileGraph.FilePath {
88
// MARK: - Properties: Remote Cache
99
/// This should never be touched.
10-
private static let swiftlintPath: String = ".swiftlint"
10+
private static let swiftlintPath = ".swiftlint"
1111

1212
/// This should never be touched. Change the version number for changes to the cache format
13-
private static let remoteCachePath: String = "\(swiftlintPath)/RemoteConfigCache"
13+
private static let remoteCachePath = "\(swiftlintPath)/RemoteConfigCache"
1414

1515
/// If the format of the caching is changed in the future, change this version number
16-
private static let remoteCacheVersionNumber: String = "v1"
16+
private static let remoteCacheVersionNumber = "v1"
1717

1818
/// Use this to get the path to the cache directory for the current cache format
19-
private static let versionedRemoteCachePath: String = "\(remoteCachePath)/\(remoteCacheVersionNumber)"
19+
private static let versionedRemoteCachePath = "\(remoteCachePath)/\(remoteCacheVersionNumber)"
2020

2121
/// The path to the gitignore file.
22-
private static let gitignorePath: String = ".gitignore"
22+
private static let gitignorePath = ".gitignore"
2323

2424
/// This dictionary has URLs as its keys and contents of those URLs as its values
2525
/// In production mode, this should be empty. For tests, it may be filled.

Source/SwiftLintCore/Models/Location.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ public struct Location: CustomStringConvertible, Comparable, Codable, Sendable {
1515
public var description: String {
1616
// Xcode likes warnings and errors in the following format:
1717
// {full_path_to_file}{:line}{:character}: {error,warning}: {content}
18-
let fileString: String = file ?? "<nopath>"
19-
let lineString: String = ":\(line ?? 1)"
20-
let charString: String = ":\(character ?? 1)"
18+
let fileString = file ?? "<nopath>"
19+
let lineString = ":\(line ?? 1)"
20+
let charString = ":\(character ?? 1)"
2121
return [fileString, lineString, charString].joined()
2222
}
2323

Source/SwiftLintCore/Reporters/JSONReporter.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ struct JSONReporter: Reporter {
77

88
static let identifier = "json"
99
static let isRealtime = false
10-
static let description: String = "Reports violations as a JSON array."
10+
static let description = "Reports violations as a JSON array."
1111

1212
static func generateReport(_ violations: [StyleViolation]) -> String {
1313
return toJSON(violations.map(dictionary(for:)))

Source/SwiftLintCore/RuleConfigurations/RegexConfiguration.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public struct RegexConfiguration<Parent: Rule>: SeverityBasedRuleConfiguration,
2323
@ConfigurationElement(key: "severity")
2424
public var severityConfiguration = SeverityConfiguration<Parent>(.warning)
2525
/// The index of the regex capture group to match.
26-
public var captureGroup: Int = 0
26+
public var captureGroup = 0
2727

2828
public var cacheDescription: String {
2929
let jsonObject: [String] = [

Source/SwiftLintCore/RuleConfigurations/SeverityLevelsConfiguration.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
public struct SeverityLevelsConfiguration<Parent: Rule>: RuleConfiguration, InlinableOptionType {
33
/// The threshold for a violation to be a warning.
44
@ConfigurationElement(key: "warning")
5-
public var warning: Int = 12
5+
public var warning = 12
66
/// The threshold for a violation to be an error.
77
@ConfigurationElement(key: "error")
88
public var error: Int?

0 commit comments

Comments
 (0)