Skip to content

Commit dbd5d0c

Browse files
authored
Merge pull request swiftlang#132 from google/the-great-renaming
[The Great Renaming] Qualify module names with "SwiftFormat" prefix.
2 parents 67d76cc + 83df713 commit dbd5d0c

File tree

173 files changed

+359
-336
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+359
-336
lines changed

Package.swift

Lines changed: 49 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:4.1
1+
// swift-tools-version:4.2
22
//===----------------------------------------------------------------------===//
33
//
44
// This source file is part of the Swift Formatter open source project.
@@ -16,47 +16,67 @@
1616
import PackageDescription
1717

1818
let package = Package(
19-
name: "swiftformat",
19+
name: "swift-format",
20+
products: [
21+
.executable(name: "swift-format", targets: ["swift-format"]),
22+
],
2023
dependencies: [
2124
.package(url: "https://github.com/apple/swift-package-manager.git", from: "0.1.0"),
2225
.package(url: "https://github.com/apple/swift-syntax", from: "0.40200.0"),
2326
],
2427
targets: [
25-
.target(
26-
name: "swiftformat",
27-
dependencies: ["Rules", "Core", "Configuration", "PrettyPrint", "SwiftSyntax", "Utility"]),
28-
.target(
29-
name: "generate-pipeline",
30-
dependencies: ["SwiftSyntax"]),
31-
.target(
32-
name: "Rules",
33-
dependencies: ["Core", "Configuration"]),
34-
.target(
35-
name: "PrettyPrint",
36-
dependencies: ["Core", "Configuration"]),
37-
.target(
38-
name: "Core",
39-
dependencies: ["Configuration", "SwiftSyntax"]),
40-
.target(
41-
name: "Configuration",
42-
dependencies: []),
43-
.target(name: "CommonMark", dependencies: ["CCommonMark"]),
4428
.target(
4529
name: "CCommonMark",
4630
exclude: [
4731
"cmark/api_test",
48-
// We must exclude main.c or SwiftPM will treat this target as an
49-
// executable target and we won't be able to import it from the
50-
// CommonMark Swift module.
32+
// We must exclude main.c or SwiftPM will treat this target as an executable target instead
33+
// of a library, and we won't be able to import it from the CommonMark Swift module.
5134
"cmark/src/main.c",
5235
]
5336
),
37+
.target(name: "CommonMark", dependencies: ["CCommonMark"]),
38+
.target(name: "SwiftFormatConfiguration"),
39+
.target(name: "SwiftFormatCore", dependencies: ["SwiftFormatConfiguration", "SwiftSyntax"]),
40+
.target(
41+
name: "SwiftFormatRules",
42+
dependencies: ["SwiftFormatCore", "SwiftFormatConfiguration"]
43+
),
44+
.target(
45+
name: "SwiftFormatPrettyPrint",
46+
dependencies: ["SwiftFormatCore", "SwiftFormatConfiguration"]
47+
),
48+
.target(name: "generate-pipeline", dependencies: ["SwiftSyntax"]),
49+
.target(
50+
name: "swift-format",
51+
dependencies: [
52+
"SwiftFormatConfiguration",
53+
"SwiftFormatCore",
54+
"SwiftFormatPrettyPrint",
55+
"SwiftFormatRules",
56+
"SwiftSyntax",
57+
"Utility",
58+
]
59+
),
60+
.testTarget(name: "CommonMarkTests", dependencies: ["CommonMark"]),
5461
.testTarget(
55-
name: "SwiftFormatTests",
56-
dependencies: ["Core", "Configuration", "Rules", "PrettyPrint", "SwiftSyntax"]),
62+
name: "SwiftFormatRulesTests",
63+
dependencies: [
64+
"SwiftFormatConfiguration",
65+
"SwiftFormatCore",
66+
"SwiftFormatPrettyPrint",
67+
"SwiftFormatRules",
68+
"SwiftSyntax",
69+
]
70+
),
5771
.testTarget(
58-
name: "PrettyPrinterTests",
59-
dependencies: ["Core", "Configuration", "Rules", "PrettyPrint", "SwiftSyntax"]),
60-
.testTarget(name: "CommonMarkTests", dependencies: ["CommonMark"]),
72+
name: "SwiftFormatPrettyPrintTests",
73+
dependencies: [
74+
"SwiftFormatConfiguration",
75+
"SwiftFormatCore",
76+
"SwiftFormatPrettyPrint",
77+
"SwiftFormatRules",
78+
"SwiftSyntax",
79+
]
80+
),
6181
]
6282
)

README.md

Lines changed: 2 additions & 2 deletions

Sources/Core/Context.swift renamed to Sources/SwiftFormatCore/Context.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Configuration
1615
import Foundation
16+
import SwiftFormatConfiguration
1717
import SwiftSyntax
1818

1919
/// Context contains the bits that each formatter and linter will need access to.

Sources/Core/FileRule.swift renamed to Sources/SwiftFormatCore/FileRule.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Configuration
15+
import SwiftFormatConfiguration
1616
import SwiftSyntax
1717

1818
/// A linting rule that does not parse the file, but instead runs analyses over the raw text of
File renamed without changes.
File renamed without changes.

Sources/PrettyPrint/Indent+Length.swift renamed to Sources/SwiftFormatPrettyPrint/Indent+Length.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Configuration
15+
import SwiftFormatConfiguration
1616

1717
extension Indent {
1818
var character: Character {

Sources/PrettyPrint/PrettyPrint.swift renamed to Sources/SwiftFormatPrettyPrint/PrettyPrint.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Configuration
16-
import Core
15+
import SwiftFormatConfiguration
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
#if os(Linux)

Sources/PrettyPrint/Token.swift renamed to Sources/SwiftFormatPrettyPrint/Token.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Configuration
16-
import Core
15+
import SwiftFormatConfiguration
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
enum BreakStyle {

Sources/PrettyPrint/TokenStreamCreator.swift renamed to Sources/SwiftFormatPrettyPrint/TokenStreamCreator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Configuration
16-
import Core
15+
import SwiftFormatConfiguration
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
private class FindChildScope: SyntaxVisitor {

Sources/Rules/AddModifierRewriter.swift renamed to Sources/SwiftFormatRules/AddModifierRewriter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
private final class AddModifierRewriter: SyntaxRewriter {

Sources/Rules/AllPublicDeclarationsHaveDocumentation.swift renamed to Sources/SwiftFormatRules/AllPublicDeclarationsHaveDocumentation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// All public or open declarations must have a top-level documentation comment.

Sources/Rules/AlwaysUseLowerCamelCase.swift renamed to Sources/SwiftFormatRules/AlwaysUseLowerCamelCase.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// All values should be written in lower camel-case (`lowerCamelCase`).

Sources/Rules/AmbiguousTrailingClosureOverload.swift renamed to Sources/SwiftFormatRules/AmbiguousTrailingClosureOverload.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// Overloads with only a closure argument should not be disambiguated by parameter labels.

Sources/Rules/AvoidInitializersForLiterals.swift renamed to Sources/SwiftFormatRules/AvoidInitializersForLiterals.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
fileprivate let intSizes = ["", "8", "16", "32", "64"]

Sources/Rules/BeginDocumentationCommentWithOneLineSummary.swift renamed to Sources/SwiftFormatRules/BeginDocumentationCommentWithOneLineSummary.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// All documentation comments must begin with a one-line summary of the declaration.

Sources/Rules/BlankLineBetweenMembers.swift renamed to Sources/SwiftFormatRules/BlankLineBetweenMembers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// At least one blank line between each member of a type.

Sources/Rules/CaseIndentLevelEqualsSwitch.swift renamed to Sources/SwiftFormatRules/CaseIndentLevelEqualsSwitch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// Each `case` of a `switch` statement must be indented the same as the `switch` keyword.

Sources/Rules/CloseBraceWhitespace.swift renamed to Sources/SwiftFormatRules/CloseBraceWhitespace.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
// TODO(abl): "right brace" to be consistent with SwiftSyntax?

Sources/Rules/CollectionLiteralWhitespace.swift renamed to Sources/SwiftFormatRules/CollectionLiteralWhitespace.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// Enforces whitespace requirements for array literals, tuples, and dictionary literals.

Sources/Rules/ColonWhitespace.swift renamed to Sources/SwiftFormatRules/ColonWhitespace.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// Enforces restrictions on whitespace before and after colons.

Sources/Rules/CommaWhitespace.swift renamed to Sources/SwiftFormatRules/CommaWhitespace.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// Enforces restrictions on whitespace before and after commas.

Sources/Rules/CommentWhitespace.swift renamed to Sources/SwiftFormatRules/CommentWhitespace.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// At least two spaces before, and exactly one space after the `//` that begins a line comment.

Sources/Rules/DoNotUseSemicolons.swift renamed to Sources/SwiftFormatRules/DoNotUseSemicolons.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// Semicolons should not be present in Swift code.

Sources/Rules/DontRepeatTypeInStaticProperties.swift renamed to Sources/SwiftFormatRules/DontRepeatTypeInStaticProperties.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// Static properties of a type that return that type should not include a reference to their type.

Sources/Rules/FullyIndirectEnum.swift renamed to Sources/SwiftFormatRules/FullyIndirectEnum.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// If all cases of an enum are `indirect`, the entire enum should be marked `indirect`.

Sources/Rules/GroupNumericLiterals.swift renamed to Sources/SwiftFormatRules/GroupNumericLiterals.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// Numeric literals should be grouped with `_`s to delimit common separators.

Sources/Rules/GroupOverloads.swift renamed to Sources/SwiftFormatRules/GroupOverloads.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// Overloads, subscripts, and initializers should be grouped if they appear in the same scope.

Sources/Rules/IdentifiersMustBeASCII.swift renamed to Sources/SwiftFormatRules/IdentifiersMustBeASCII.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// All identifiers must be ASCII.

Sources/Rules/ImportsXCTestVisitor.swift renamed to Sources/SwiftFormatRules/ImportsXCTestVisitor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// Visitor that determines if the target source file imports XCTest

Sources/Rules/LineLengthLimit.swift renamed to Sources/SwiftFormatRules/LineLengthLimit.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// Enforces line length limits.

Sources/Rules/MaximumBlankLines.swift renamed to Sources/SwiftFormatRules/MaximumBlankLines.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
//
1313
//===----------------------------------------------------------------------===//
1414

15-
import Core
1615
import Foundation
16+
import SwiftFormatCore
1717
import SwiftSyntax
1818

1919
/// Enforce a maximum number of consecutive blank lines.

0 commit comments

Comments
 (0)