Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
var configuration = SeverityConfiguration<Self>(.warning)
static let description = RuleDescription(
identifier: "non_optional_string_data_conversion",
name: "Non-optional String -> Data Conversion",
description: "Prefer non-optional `Data(_:)` initializer when converting `String` to `Data`",
name: "Non-optional String <-> Data Conversion",
description: "Prefer the non-optional initializers when converting between `String` and `Data` (e.g. `Data(_:)` and `String(decoding:as:)`)",

Check failure on line 9 in Source/SwiftLintBuiltInRules/Rules/Lint/NonOptionalStringDataConversionRule.swift

View workflow job for this annotation

GitHub Actions / Lint Swift

Line should be 120 characters or less; currently it has 149 characters (line_length)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are still interested in providing extended documentation for this rule, please let the description property as it is and prefer the optional rationale property. It serves exactly this purpose.

kind: .lint,
nonTriggeringExamples: [
Example("Data(\"foo\".utf8)")
Example("Data(\"foo\".utf8)"),
Example("String(decoding: data, as: UTF8.self)"),
],
triggeringExamples: [
Example("\"foo\".data(using: .utf8)")
Example("\"foo\".data(using: .utf8)"),
Example("String(data: data, encoding: .utf8)"),
]
)
}
Expand Down
Loading