From 7e4c06adbe2d86e3c1fa933d3188d40a701e4398 Mon Sep 17 00:00:00 2001 From: Tony Allevato Date: Thu, 21 Sep 2023 18:29:43 -0400 Subject: [PATCH] Rename `generate-pipeline` to `generate-swift-format`. The name referring to just the pipeline is somewhat outdated now; it generates a lot of other stuff now too. So give it a more appropriate name indicating that it generates all the swift-format things. --- Documentation/Development.md | 4 ++-- Documentation/RuleDocumentation.md | 5 ++--- Package.swift | 2 +- Sources/SwiftFormat/API/Configuration.swift | 2 +- Sources/SwiftFormat/Core/Context.swift | 2 +- Sources/SwiftFormat/Core/Pipelines+Generated.swift | 2 +- Sources/SwiftFormat/Core/RuleNameCache+Generated.swift | 2 +- Sources/SwiftFormat/Core/RuleRegistry+Generated.swift | 2 +- .../FileGenerator.swift | 0 .../PipelineGenerator.swift | 2 +- .../RuleCollector.swift | 0 .../RuleDocumentationGenerator.swift | 3 +-- .../RuleNameCacheGenerator.swift | 2 +- .../RuleRegistryGenerator.swift | 2 +- .../Syntax+Convenience.swift | 0 .../{generate-pipeline => generate-swift-format}/main.swift | 0 16 files changed, 14 insertions(+), 16 deletions(-) rename Sources/{generate-pipeline => generate-swift-format}/FileGenerator.swift (100%) rename Sources/{generate-pipeline => generate-swift-format}/PipelineGenerator.swift (97%) rename Sources/{generate-pipeline => generate-swift-format}/RuleCollector.swift (100%) rename Sources/{generate-pipeline => generate-swift-format}/RuleDocumentationGenerator.swift (94%) rename Sources/{generate-pipeline => generate-swift-format}/RuleNameCacheGenerator.swift (95%) rename Sources/{generate-pipeline => generate-swift-format}/RuleRegistryGenerator.swift (95%) rename Sources/{generate-pipeline => generate-swift-format}/Syntax+Convenience.swift (100%) rename Sources/{generate-pipeline => generate-swift-format}/main.swift (100%) diff --git a/Documentation/Development.md b/Documentation/Development.md index 5445d2ed..f9c67fce 100644 --- a/Documentation/Development.md +++ b/Documentation/Development.md @@ -6,12 +6,12 @@ Since Swift does not yet have a runtime reflection system, we use code generation to keep the linting/formatting pipeline up-to-date. If you add or remove any rules from the `SwiftFormat` module, or if you add or remove any `visit` methods from an existing rule in that module, you must run the -`generate-pipeline` tool update the pipeline and configuration sources. +`generate-swift-format` tool update the pipeline and configuration sources. The easiest way to do this is to run the following command in your terminal: ```shell -swift run generate-pipeline +swift run generate-swift-format ``` If successful, this tool will update the files `Pipelines+Generated.swift`, diff --git a/Documentation/RuleDocumentation.md b/Documentation/RuleDocumentation.md index eb761845..cc3ae92d 100644 --- a/Documentation/RuleDocumentation.md +++ b/Documentation/RuleDocumentation.md @@ -1,11 +1,10 @@ - + # `swift-format` Lint and Format Rules Use the rules below in the `rules` block of your `.swift-format` configuration file, as described in -[Configuration](Configuration.md). All of these rules can be +[Configuration](Documentation/Configuration.md). All of these rules can be applied in the linter, but only some of them can format your source code automatically. diff --git a/Package.swift b/Package.swift index ae4d42be..7705de0f 100644 --- a/Package.swift +++ b/Package.swift @@ -103,7 +103,7 @@ let package = Package( path: "Plugins/LintPlugin" ), .executableTarget( - name: "generate-pipeline", + name: "generate-swift-format", dependencies: [ "SwiftFormat", .product(name: "SwiftSyntax", package: "swift-syntax"), diff --git a/Sources/SwiftFormat/API/Configuration.swift b/Sources/SwiftFormat/API/Configuration.swift index 17ef00ea..ec7d9767 100644 --- a/Sources/SwiftFormat/API/Configuration.swift +++ b/Sources/SwiftFormat/API/Configuration.swift @@ -48,7 +48,7 @@ public struct Configuration: Codable, Equatable { /// A dictionary containing the default enabled/disabled states of rules, keyed by the rules' /// names. /// - /// This value is generated by `generate-pipeline` based on the `isOptIn` value of each rule. + /// This value is generated by `generate-swift-format` based on the `isOptIn` value of each rule. public static let defaultRuleEnablements: [String: Bool] = RuleRegistry.rules /// The version of this configuration. diff --git a/Sources/SwiftFormat/Core/Context.swift b/Sources/SwiftFormat/Core/Context.swift index 8851a685..29e69b0d 100644 --- a/Sources/SwiftFormat/Core/Context.swift +++ b/Sources/SwiftFormat/Core/Context.swift @@ -94,7 +94,7 @@ public final class Context { ruleNameCache[ObjectIdentifier(rule)] != nil, """ Missing cached rule name for '\(rule)'! \ - Ensure `generate-pipelines` has been run and `ruleNameCache` was injected. + Ensure `generate-swift-format` has been run and `ruleNameCache` was injected. """) let ruleName = ruleNameCache[ObjectIdentifier(rule)] ?? R.ruleName diff --git a/Sources/SwiftFormat/Core/Pipelines+Generated.swift b/Sources/SwiftFormat/Core/Pipelines+Generated.swift index a7432e53..6e961582 100644 --- a/Sources/SwiftFormat/Core/Pipelines+Generated.swift +++ b/Sources/SwiftFormat/Core/Pipelines+Generated.swift @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -// This file is automatically generated with generate-pipeline. Do Not Edit! +// This file is automatically generated with generate-swift-format. Do not edit! import SwiftSyntax diff --git a/Sources/SwiftFormat/Core/RuleNameCache+Generated.swift b/Sources/SwiftFormat/Core/RuleNameCache+Generated.swift index f487d349..b19b88d6 100644 --- a/Sources/SwiftFormat/Core/RuleNameCache+Generated.swift +++ b/Sources/SwiftFormat/Core/RuleNameCache+Generated.swift @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -// This file is automatically generated with generate-pipeline. Do Not Edit! +// This file is automatically generated with generate-swift-format. Do not edit! /// By default, the `Rule.ruleName` should be the name of the implementing rule type. @_spi(Testing) diff --git a/Sources/SwiftFormat/Core/RuleRegistry+Generated.swift b/Sources/SwiftFormat/Core/RuleRegistry+Generated.swift index cf91f9d0..9fb96fcf 100644 --- a/Sources/SwiftFormat/Core/RuleRegistry+Generated.swift +++ b/Sources/SwiftFormat/Core/RuleRegistry+Generated.swift @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -// This file is automatically generated with generate-pipeline. Do Not Edit! +// This file is automatically generated with generate-swift-format. Do not edit! @_spi(Internal) public enum RuleRegistry { public static let rules: [String: Bool] = [ diff --git a/Sources/generate-pipeline/FileGenerator.swift b/Sources/generate-swift-format/FileGenerator.swift similarity index 100% rename from Sources/generate-pipeline/FileGenerator.swift rename to Sources/generate-swift-format/FileGenerator.swift diff --git a/Sources/generate-pipeline/PipelineGenerator.swift b/Sources/generate-swift-format/PipelineGenerator.swift similarity index 97% rename from Sources/generate-pipeline/PipelineGenerator.swift rename to Sources/generate-swift-format/PipelineGenerator.swift index 4b0054cc..abf8b2c0 100644 --- a/Sources/generate-pipeline/PipelineGenerator.swift +++ b/Sources/generate-swift-format/PipelineGenerator.swift @@ -38,7 +38,7 @@ final class PipelineGenerator: FileGenerator { // //===----------------------------------------------------------------------===// - // This file is automatically generated with generate-pipeline. Do Not Edit! + // This file is automatically generated with generate-swift-format. Do not edit! import SwiftSyntax diff --git a/Sources/generate-pipeline/RuleCollector.swift b/Sources/generate-swift-format/RuleCollector.swift similarity index 100% rename from Sources/generate-pipeline/RuleCollector.swift rename to Sources/generate-swift-format/RuleCollector.swift diff --git a/Sources/generate-pipeline/RuleDocumentationGenerator.swift b/Sources/generate-swift-format/RuleDocumentationGenerator.swift similarity index 94% rename from Sources/generate-pipeline/RuleDocumentationGenerator.swift rename to Sources/generate-swift-format/RuleDocumentationGenerator.swift index fccddee4..c90cc62e 100644 --- a/Sources/generate-pipeline/RuleDocumentationGenerator.swift +++ b/Sources/generate-swift-format/RuleDocumentationGenerator.swift @@ -27,8 +27,7 @@ final class RuleDocumentationGenerator: FileGenerator { func write(into handle: FileHandle) throws { handle.write( """ - + # `swift-format` Lint and Format Rules diff --git a/Sources/generate-pipeline/RuleNameCacheGenerator.swift b/Sources/generate-swift-format/RuleNameCacheGenerator.swift similarity index 95% rename from Sources/generate-pipeline/RuleNameCacheGenerator.swift rename to Sources/generate-swift-format/RuleNameCacheGenerator.swift index 06c2978e..55db7063 100644 --- a/Sources/generate-pipeline/RuleNameCacheGenerator.swift +++ b/Sources/generate-swift-format/RuleNameCacheGenerator.swift @@ -38,7 +38,7 @@ final class RuleNameCacheGenerator: FileGenerator { // //===----------------------------------------------------------------------===// - // This file is automatically generated with generate-pipeline. Do Not Edit! + // This file is automatically generated with generate-swift-format. Do not edit! /// By default, the `Rule.ruleName` should be the name of the implementing rule type. @_spi(Testing) diff --git a/Sources/generate-pipeline/RuleRegistryGenerator.swift b/Sources/generate-swift-format/RuleRegistryGenerator.swift similarity index 95% rename from Sources/generate-pipeline/RuleRegistryGenerator.swift rename to Sources/generate-swift-format/RuleRegistryGenerator.swift index 8e4c66ff..3994f5b3 100644 --- a/Sources/generate-pipeline/RuleRegistryGenerator.swift +++ b/Sources/generate-swift-format/RuleRegistryGenerator.swift @@ -38,7 +38,7 @@ final class RuleRegistryGenerator: FileGenerator { // //===----------------------------------------------------------------------===// - // This file is automatically generated with generate-pipeline. Do Not Edit! + // This file is automatically generated with generate-swift-format. Do not edit! @_spi(Internal) public enum RuleRegistry { public static let rules: [String: Bool] = [ diff --git a/Sources/generate-pipeline/Syntax+Convenience.swift b/Sources/generate-swift-format/Syntax+Convenience.swift similarity index 100% rename from Sources/generate-pipeline/Syntax+Convenience.swift rename to Sources/generate-swift-format/Syntax+Convenience.swift diff --git a/Sources/generate-pipeline/main.swift b/Sources/generate-swift-format/main.swift similarity index 100% rename from Sources/generate-pipeline/main.swift rename to Sources/generate-swift-format/main.swift