Files
SwiftLint/Source/SwiftLintCoreMacros/SwiftLintCoreMacroError.swift
T
Danny Mösch 61558ce766 Separate @main macro provider allowing to exclude it from Bazel build
Avoids linker error in tests due to duplicated `_main` routine.
2025-10-03 22:41:38 +02:00

29 lines
889 B
Swift

import SwiftDiagnostics
import SwiftSyntax
enum SwiftLintCoreMacroError: String, DiagnosticMessage {
case notStruct = "Attribute can only be applied to structs"
case severityBasedWithoutProperty = """
Severity-based configuration without a 'severityConfiguration' property is invalid
"""
case notEnum = "Attribute can only be applied to enums"
case noStringRawType = "Attribute can only be applied to enums with a 'String' raw type"
case noBooleanLiteral = "Macro argument must be a boolean literal"
var message: String {
rawValue
}
var diagnosticID: MessageID {
MessageID(domain: "SwiftLint", id: "SwiftLintCoreMacro.\(self)")
}
var severity: DiagnosticSeverity {
.error
}
func diagnose(at node: some SyntaxProtocol) -> Diagnostic {
Diagnostic(node: Syntax(node), message: self)
}
}