mirror of
https://github.com/realm/SwiftLint.git
synced 2026-05-07 20:12:49 +00:00
Rename macros to something more descriptive (#5686)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct AttributesConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = AttributesRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct BlanketDisableCommandConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = BlanketDisableCommandRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct CollectionAlignmentConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = CollectionAlignmentRule
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct ColonConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = ColonRule
|
||||
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct ComputedAccessorsOrderConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = ComputedAccessorsOrderRule
|
||||
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
enum Order: String {
|
||||
case getSet = "get_set"
|
||||
case setGet = "set_get"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct ConditionalReturnsOnNewlineConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = ConditionalReturnsOnNewlineRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import SourceKittenFramework
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct CyclomaticComplexityConfiguration: RuleConfiguration {
|
||||
typealias Parent = CyclomaticComplexityRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct DiscouragedDirectInitConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = DiscouragedDirectInitRule
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct EmptyCountConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = EmptyCountRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct ExpiringTodoConfiguration: RuleConfiguration {
|
||||
typealias Parent = ExpiringTodoRule
|
||||
typealias Severity = SeverityConfiguration<Parent>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct ExplicitInitConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = ExplicitInitRule
|
||||
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct ExplicitTypeInterfaceConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = ExplicitTypeInterfaceRule
|
||||
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
enum VariableKind: String, CaseIterable {
|
||||
case instance
|
||||
case local
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct FileLengthConfiguration: RuleConfiguration {
|
||||
typealias Parent = FileLengthRule
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct FileNameConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = FileNameRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct FileNameNoSpaceConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = FileNameNoSpaceRule
|
||||
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct FileTypesOrderConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = FileTypesOrderRule
|
||||
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
enum FileType: String {
|
||||
case supportingType = "supporting_type"
|
||||
case mainType = "main_type"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct ForWhereConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = ForWhereRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct FunctionParameterCountConfiguration: RuleConfiguration {
|
||||
typealias Parent = FunctionParameterCountRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct IdentifierNameConfiguration: RuleConfiguration {
|
||||
typealias Parent = IdentifierNameRule
|
||||
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct ImplicitReturnConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = ImplicitReturnRule
|
||||
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
enum ReturnKind: String, CaseIterable, Comparable {
|
||||
case closure
|
||||
case function
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct ImplicitlyUnwrappedOptionalConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = ImplicitlyUnwrappedOptionalRule
|
||||
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
enum ImplicitlyUnwrappedOptionalModeConfiguration: String { // swiftlint:disable:this type_name
|
||||
case all = "all"
|
||||
case allExceptIBOutlets = "all_except_iboutlets"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct InclusiveLanguageConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = InclusiveLanguageRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct IndentationWidthConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = IndentationWidthRule
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct LineLengthConfiguration: RuleConfiguration {
|
||||
typealias Parent = LineLengthRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
import SourceKittenFramework
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct ModifierOrderConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = ModifierOrderRule
|
||||
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct MultilineArgumentsConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = MultilineArgumentsRule
|
||||
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
enum FirstArgumentLocation: String {
|
||||
case anyLine = "any_line"
|
||||
case sameLine = "same_line"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct MultilineParametersConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = MultilineParametersRule
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct NestingConfiguration: RuleConfiguration {
|
||||
typealias Parent = NestingRule
|
||||
typealias Severity = SeverityLevelsConfiguration<Parent>
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply // swiftlint:disable:next type_name
|
||||
@AutoConfigParser // swiftlint:disable:next type_name
|
||||
struct NonOverridableClassDeclarationConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = NonOverridableClassDeclarationRule
|
||||
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
enum FinalClassModifier: String {
|
||||
case finalClass = "final class"
|
||||
case `static` = "static"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct NumberSeparatorConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = NumberSeparatorRule
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@ import SwiftLintCore
|
||||
|
||||
typealias DiscouragedObjectLiteralConfiguration = ObjectLiteralConfiguration<DiscouragedObjectLiteralRule>
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct ObjectLiteralConfiguration<Parent: Rule>: SeverityBasedRuleConfiguration {
|
||||
@ConfigurationElement(key: "severity")
|
||||
private(set) var severityConfiguration = SeverityConfiguration<Parent>(.warning)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct OpeningBraceConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = OpeningBraceRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct OperatorUsageWhitespaceConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = OperatorUsageWhitespaceRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct OverriddenSuperCallConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = OverriddenSuperCallRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct PrefixedTopLevelConstantConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = PrefixedTopLevelConstantRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct PrivateOutletConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = PrivateOutletRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct PrivateOverFilePrivateConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = PrivateOverFilePrivateRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct ProhibitedSuperConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = ProhibitedSuperRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct RedundantTypeAnnotationConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = RedundantTypeAnnotationRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct RedundantVoidReturnConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = RedundantVoidReturnRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct SelfBindingConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = SelfBindingRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct ShorthandArgumentConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = ShorthandArgumentRule
|
||||
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct SortedImportsConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = SortedImportsRule
|
||||
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
enum SortedImportsGroupingConfiguration: String {
|
||||
/// Sorts import lines based on any import attributes (e.g. `@testable`, `@_exported`, etc.), followed by a case
|
||||
/// insensitive comparison of the imported module name.
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct StatementPositionConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = StatementPositionRule
|
||||
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
enum StatementModeConfiguration: String {
|
||||
case `default` = "default"
|
||||
case uncuddledElse = "uncuddled_else"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct SwitchCaseAlignmentConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = SwitchCaseAlignmentRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct TestCaseAccessibilityConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = TestCaseAccessibilityRule
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct TodoConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = TodoRule
|
||||
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
enum TodoKeyword: String, CaseIterable {
|
||||
case todo = "TODO"
|
||||
case fixme = "FIXME"
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct TrailingClosureConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = TrailingClosureRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct TrailingCommaConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = TrailingCommaRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct TrailingWhitespaceConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = TrailingWhitespaceRule
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
enum TypeContent: String {
|
||||
case `case` = "case"
|
||||
case typeAlias = "type_alias"
|
||||
@@ -19,7 +19,7 @@ enum TypeContent: String {
|
||||
case deinitializer = "deinitializer"
|
||||
}
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct TypeContentsOrderConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = TypeContentsOrderRule
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct TypeNameConfiguration: RuleConfiguration {
|
||||
typealias Parent = TypeNameRule
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ typealias FinalTestCaseConfiguration = UnitTestConfiguration<FinalTestCaseRule>
|
||||
typealias NoMagicNumbersConfiguration = UnitTestConfiguration<NoMagicNumbersRule>
|
||||
typealias SingleTestClassConfiguration = UnitTestConfiguration<SingleTestClassRule>
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct UnitTestConfiguration<Parent: Rule>: SeverityBasedRuleConfiguration {
|
||||
@ConfigurationElement(key: "severity")
|
||||
private(set) var severityConfiguration = SeverityConfiguration<Parent>(.warning)
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct UnneededOverrideRuleConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = UnneededOverrideRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct UnusedDeclarationConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = UnusedDeclarationRule
|
||||
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ struct TransitiveModuleConfiguration<Parent: Rule>: Equatable, AcceptableByConfi
|
||||
}
|
||||
}
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct UnusedImportConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = UnusedImportRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct UnusedOptionalBindingConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = UnusedOptionalBindingRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply // swiftlint:disable:next type_name
|
||||
@AutoConfigParser // swiftlint:disable:next type_name
|
||||
struct VerticalWhitespaceClosingBracesConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = VerticalWhitespaceClosingBracesRule
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct VerticalWhitespaceConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = VerticalWhitespaceRule
|
||||
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
import SwiftLintCore
|
||||
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct XCTSpecificMatcherConfiguration: SeverityBasedRuleConfiguration {
|
||||
typealias Parent = XCTSpecificMatcherRule
|
||||
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
enum Matcher: String, CaseIterable {
|
||||
case oneArgumentAsserts = "one-argument-asserts"
|
||||
case twoArgumentAsserts = "two-argument-asserts"
|
||||
|
||||
@@ -4,9 +4,20 @@
|
||||
member,
|
||||
names: named(apply)
|
||||
)
|
||||
public macro AutoConfigParser() = #externalMacro(
|
||||
module: "SwiftLintCoreMacros",
|
||||
type: "AutoConfigParser"
|
||||
)
|
||||
|
||||
/// Deprecated. Use `AutoConfigParser` instead.
|
||||
@available(*, deprecated, renamed: "AutoConfigParser")
|
||||
@attached(
|
||||
member,
|
||||
names: named(apply)
|
||||
)
|
||||
public macro AutoApply() = #externalMacro(
|
||||
module: "SwiftLintCoreMacros",
|
||||
type: "AutoApply"
|
||||
type: "AutoConfigParser"
|
||||
)
|
||||
|
||||
/// Macro that lets an enum with a ``String`` raw type automatically conform to ``AcceptableByConfigurationElement``.
|
||||
@@ -15,9 +26,21 @@ public macro AutoApply() = #externalMacro(
|
||||
conformances: AcceptableByConfigurationElement,
|
||||
names: named(init(fromAny:context:)), named(asOption)
|
||||
)
|
||||
public macro AcceptableByConfigurationElement() = #externalMacro(
|
||||
module: "SwiftLintCoreMacros",
|
||||
type: "AcceptableByConfigurationElement"
|
||||
)
|
||||
|
||||
/// Deprecated. Use `AcceptableByConfigurationElement` instead.
|
||||
@available(*, deprecated, renamed: "AcceptableByConfigurationElement")
|
||||
@attached(
|
||||
extension,
|
||||
conformances: AcceptableByConfigurationElement,
|
||||
names: named(init(fromAny:context:)), named(asOption)
|
||||
)
|
||||
public macro MakeAcceptableByConfigurationElement() = #externalMacro(
|
||||
module: "SwiftLintCoreMacros",
|
||||
type: "MakeAcceptableByConfigurationElement"
|
||||
type: "AcceptableByConfigurationElement"
|
||||
)
|
||||
|
||||
/// Macro that adds a conformance to the ``SwiftSyntaxRule`` protocol and a default `makeVisitor(file:)` implementation
|
||||
@@ -27,7 +50,7 @@ public macro MakeAcceptableByConfigurationElement() = #externalMacro(
|
||||
/// - foldExpressions: Setting it to `true` adds an implementation of `preprocess(file:)` which folds expressions
|
||||
/// before they are passed to the visitor.
|
||||
/// - explicitRewriter: Set it to `true` to add a `makeRewriter(file:)` implementation which creates a rewriter
|
||||
/// defined in the rule struct. In this case, the rule automatically conforms to
|
||||
/// defined in the rule struct. In this case, the rule automatically conforms to
|
||||
/// ``SwiftSyntaxCorrectableRule``.
|
||||
@attached(
|
||||
extension,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/// The magnitude of a `StyleViolation`.
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
public enum ViolationSeverity: String, Comparable, Codable, InlinableOptionType {
|
||||
/// Non-fatal. If using SwiftLint as an Xcode build phase, Xcode will mark the build as having succeeded.
|
||||
case warning
|
||||
|
||||
@@ -3,7 +3,7 @@ import SwiftSyntax
|
||||
import SwiftSyntaxBuilder
|
||||
import SwiftSyntaxMacros
|
||||
|
||||
enum AutoApply: MemberMacro {
|
||||
enum AutoConfigParser: MemberMacro {
|
||||
// swiftlint:disable:next function_body_length
|
||||
static func expansion(
|
||||
of _: AttributeSyntax,
|
||||
@@ -88,7 +88,7 @@ enum AutoApply: MemberMacro {
|
||||
}
|
||||
}
|
||||
|
||||
enum MakeAcceptableByConfigurationElement: ExtensionMacro {
|
||||
enum AcceptableByConfigurationElement: ExtensionMacro {
|
||||
static func expansion(
|
||||
of _: AttributeSyntax,
|
||||
attachedTo declaration: some DeclGroupSyntax,
|
||||
|
||||
@@ -6,8 +6,8 @@ import SwiftSyntaxMacros
|
||||
@main
|
||||
struct SwiftLintCoreMacros: CompilerPlugin {
|
||||
let providingMacros: [any Macro.Type] = [
|
||||
AutoApply.self,
|
||||
MakeAcceptableByConfigurationElement.self,
|
||||
AutoConfigParser.self,
|
||||
AcceptableByConfigurationElement.self,
|
||||
SwiftSyntaxRule.self,
|
||||
]
|
||||
}
|
||||
|
||||
+6
-7
@@ -3,15 +3,14 @@ import SwiftSyntaxMacrosTestSupport
|
||||
import XCTest
|
||||
|
||||
private let macros = [
|
||||
"MakeAcceptableByConfigurationElement": MakeAcceptableByConfigurationElement.self
|
||||
"AcceptableByConfigurationElement": AcceptableByConfigurationElement.self
|
||||
]
|
||||
|
||||
// swiftlint:disable:next type_name
|
||||
final class MakeAcceptableByConfigurationElementTests: XCTestCase {
|
||||
final class AcceptableByConfigurationElementTests: XCTestCase {
|
||||
func testNoEnum() {
|
||||
assertMacroExpansion(
|
||||
"""
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
struct S {
|
||||
}
|
||||
""",
|
||||
@@ -29,7 +28,7 @@ final class MakeAcceptableByConfigurationElementTests: XCTestCase {
|
||||
func testNoStringRawType() {
|
||||
assertMacroExpansion(
|
||||
"""
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
enum E {
|
||||
}
|
||||
""",
|
||||
@@ -47,7 +46,7 @@ final class MakeAcceptableByConfigurationElementTests: XCTestCase {
|
||||
func testPrivateEnum() {
|
||||
assertMacroExpansion(
|
||||
"""
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
private enum E: String {
|
||||
}
|
||||
""",
|
||||
@@ -75,7 +74,7 @@ final class MakeAcceptableByConfigurationElementTests: XCTestCase {
|
||||
func testPublicEnum() {
|
||||
assertMacroExpansion(
|
||||
"""
|
||||
@MakeAcceptableByConfigurationElement
|
||||
@AcceptableByConfigurationElement
|
||||
public enum E: String {
|
||||
}
|
||||
""",
|
||||
+8
-8
@@ -3,14 +3,14 @@ import SwiftSyntaxMacrosTestSupport
|
||||
import XCTest
|
||||
|
||||
private let macros = [
|
||||
"AutoApply": AutoApply.self
|
||||
"AutoConfigParser": AutoConfigParser.self
|
||||
]
|
||||
|
||||
final class AutoApplyTests: XCTestCase {
|
||||
final class AutoConfigParserTests: XCTestCase {
|
||||
func testAttachToClass() {
|
||||
assertMacroExpansion(
|
||||
"""
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
class C {
|
||||
}
|
||||
""",
|
||||
@@ -28,7 +28,7 @@ final class AutoApplyTests: XCTestCase {
|
||||
func testNoConfigurationElements() {
|
||||
assertMacroExpansion(
|
||||
"""
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct S {
|
||||
}
|
||||
""",
|
||||
@@ -54,7 +54,7 @@ final class AutoApplyTests: XCTestCase {
|
||||
func testConfigurationElementsWithoutKeys() {
|
||||
assertMacroExpansion(
|
||||
"""
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct S {
|
||||
@ConfigurationElement
|
||||
var eA = 1
|
||||
@@ -96,7 +96,7 @@ final class AutoApplyTests: XCTestCase {
|
||||
func testInlinedConfigurationElements() {
|
||||
assertMacroExpansion(
|
||||
"""
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct S {
|
||||
@ConfigurationElement(key: "eD")
|
||||
var eA = 1
|
||||
@@ -147,7 +147,7 @@ final class AutoApplyTests: XCTestCase {
|
||||
func testSeverityBasedConfigurationWithoutSeverityProperty() {
|
||||
assertMacroExpansion(
|
||||
"""
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct S: SeverityBasedRuleConfiguration {
|
||||
}
|
||||
""",
|
||||
@@ -180,7 +180,7 @@ final class AutoApplyTests: XCTestCase {
|
||||
// swiftlint:disable line_length
|
||||
assertMacroExpansion(
|
||||
"""
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
struct S: SeverityBasedRuleConfiguration {
|
||||
@ConfigurationElement
|
||||
var severityConfiguration = .warning
|
||||
@@ -6,7 +6,7 @@ import XCTest
|
||||
|
||||
// swiftlint:disable:next type_body_length
|
||||
final class RuleConfigurationDescriptionTests: XCTestCase {
|
||||
@AutoApply
|
||||
@AutoConfigParser
|
||||
private struct TestConfiguration: RuleConfiguration {
|
||||
typealias Parent = RuleMock // swiftlint:disable:this nesting
|
||||
|
||||
|
||||
Reference in New Issue
Block a user