Skip to content

Commit

Permalink
Reuse option serialization code
Browse files Browse the repository at this point in the history
  • Loading branch information
SimplyDanny committed Jul 9, 2023
1 parent 7315337 commit 36f1be5
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions Source/SwiftLintCore/Models/RuleConfigurationDescription.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,10 @@ extension OptionType: Documentable {

public func markdown() -> String {
switch self {
case .empty:
queuedFatalError("Empty options shall not be serialized.")
case let .flag(value):
return String(describing: value)
case .empty, .flag, .symbol, .integer, .float, .severity:
return yaml()
case let .string(value):
return """ + value + """
case let .symbol(value):
return value
case let .integer(value):
return String(describing: value)
case let .float(value):
return String(describing: value)
case let .severity(value):
return value.rawValue
case let .list(options):
return "[" + options.map { $0.markdown() }.joined(separator: ", ") + "]"
case let .nested(value):
Expand Down

0 comments on commit 36f1be5

Please sign in to comment.