Skip to content

Commit be711ca

Browse files
authored
Fix several one-line summary doc comment issues (#743)
1 parent 5bb54b9 commit be711ca

File tree

7 files changed

+73
-75
lines changed

7 files changed

+73
-75
lines changed

Sources/ArgumentParser/Completions/CompletionsGenerator.swift

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,31 +56,25 @@ public struct CompletionShell: RawRepresentable, Hashable, CaseIterable {
5656

5757
static let _requesting = Mutex<CompletionShell?>(nil)
5858

59-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
60-
// https://github.com/swiftlang/swift-format/issues/924
61-
/// While generating a shell completion script or while a Swift custom
62-
/// completion function is executing to offer completions for a word from a
63-
/// command line (e.g., while `customCompletion` from
64-
/// `@Option(completion: .custom(customCompletion))` executes), an instance
65-
/// representing the shell for which completions will be or are being
66-
/// requested, respectively.
59+
/// The shell for which completions will be or are being requested.
6760
///
68-
/// Otherwise `nil`.
61+
/// `CompletionShell.requesting` is non-`nil` only while generating a shell
62+
/// completion script or while a Swift custom completion function is executing
63+
/// to offer completions for a word from a command line (that is, while
64+
/// `customCompletion` from `@Option(completion: .custom(customCompletion))`
65+
/// executes).
6966
public static var requesting: CompletionShell? {
7067
Self._requesting.withLock { $0 }
7168
}
7269

7370
static let _requestingVersion = Mutex<String?>(nil)
7471

75-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
76-
// https://github.com/swiftlang/swift-format/issues/924
77-
/// While a Swift custom completion function is executing to offer completions
78-
/// for a word from a command line (e.g., while `customCompletion` from
79-
/// `@Option(completion: .custom(customCompletion))` executes), a `String`
80-
/// representing the version of the shell for which completions are being
81-
/// requested.
72+
/// The shell version for which completions will be or are being requested.
8273
///
83-
/// Otherwise `nil`.
74+
/// `CompletionShell.requestingVersion` is non-`nil` only while generating a
75+
/// shell completion script or while a Swift custom completion function is
76+
/// running (that is, while `customCompletion` from
77+
/// `@Option(completion: .custom(customCompletion))` executes).
8478
public static var requestingVersion: String? {
8579
Self._requestingVersion.withLock { $0 }
8680
}

Sources/ArgumentParser/Parsable Properties/Errors.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,7 @@ public struct ExitCode: Error, RawRepresentable, Hashable {
6262
}
6363
}
6464

65-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
66-
// https://github.com/swiftlang/swift-format/issues/924
67-
/// An error type that represents a clean (i.e. non-error state) exit of the
65+
/// An error type that represents a clean (non-error state) exit of the
6866
/// utility.
6967
///
7068
/// Throwing a `CleanExit` instance from a `validate` or `run` method, or

Sources/ArgumentParser/Parsable Properties/Flag.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,6 @@ public struct FlagInversion: Hashable {
152152
self.init(base: .prefixedNo)
153153
}
154154

155-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
156-
// https://github.com/swiftlang/swift-format/issues/924
157155
/// Uses matching flags with `enable-` and `disable-` prefixes.
158156
///
159157
/// For example, the `extraOutput` property in this declaration is set to

Sources/ArgumentParser/Parsable Types/ParsableArgumentsValidation.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ extension ArgumentSet {
6565
}
6666
}
6767

68-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
69-
// https://github.com/swiftlang/swift-format/issues/925
68+
/// A validator for positional argument arrays.
69+
///
7070
/// For positional arguments to be valid, there must be at most one
7171
/// positional array argument, and it must be the last positional argument
7272
/// in the argument list. Any other configuration leads to ambiguity in
@@ -131,7 +131,7 @@ struct PositionalArgumentsValidator: ParsableArgumentsValidator {
131131
}
132132
}
133133

134-
/// Ensure that all arguments have corresponding coding keys.
134+
/// A validator that ensures that all arguments have corresponding coding keys.
135135
struct ParsableArgumentsCodingKeyValidator: ParsableArgumentsValidator {
136136

137137
private struct Validator: Decoder {
@@ -252,7 +252,8 @@ struct ParsableArgumentsCodingKeyValidator: ParsableArgumentsValidator {
252252
}
253253
}
254254

255-
/// Ensure argument names are unique within a `ParsableArguments` or `ParsableCommand`.
255+
/// A validator that ensures argument names are unique within a
256+
/// `ParsableArguments` or `ParsableCommand`.
256257
struct ParsableArgumentsUniqueNamesValidator: ParsableArgumentsValidator {
257258
struct Error: ParsableArgumentsValidatorError, CustomStringConvertible {
258259
var duplicateNames: [String: Int] = [:]
@@ -295,6 +296,7 @@ struct ParsableArgumentsUniqueNamesValidator: ParsableArgumentsValidator {
295296
}
296297
}
297298

299+
/// A validator that prevents declaring flags that can't be turned off.
298300
struct NonsenseFlagsValidator: ParsableArgumentsValidator {
299301
struct Error: ParsableArgumentsValidatorError, CustomStringConvertible {
300302
var names: [String]

Sources/ArgumentParser/Usage/HelpGenerator.swift

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,7 @@ extension CommandConfiguration {
416416
}
417417

418418
extension NameSpecification {
419-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
420-
// https://github.com/swiftlang/swift-format/issues/924
421-
/// Generates a list of `Name`s for the help command at any visibility level.
419+
/// Generates a list of names for the help command at any visibility level.
422420
///
423421
/// If the `default` visibility is used, the help names are returned
424422
/// unmodified. If a non-default visibility is used the short names are
@@ -445,13 +443,11 @@ extension NameSpecification {
445443
}
446444

447445
extension BidirectionalCollection where Element == ParsableCommand.Type {
448-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
449-
// https://github.com/swiftlang/swift-format/issues/924
450-
/// Returns a list of help names at the request visibility level for the top-
451-
/// most ParsableCommand in the command stack with custom helpNames
446+
/// Returns a list of help names at the requested visibility level for the
447+
/// top-most command in the command stack with custom help names.
452448
///
453-
/// If the command stack contains no custom help names the default help
454-
/// names.
449+
/// If the command stack contains no custom help names, returns the default
450+
/// help names.
455451
func getHelpNames(visibility: ArgumentVisibility) -> [Name] {
456452
self.lazy.reversed().compactMap { $0.configuration.helpNames }
457453
.first

Tests/ArgumentParserEndToEndTests/DefaultsEndToEndTests.swift

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,12 @@ extension DefaultsEndToEndTests {
451451
}
452452
}
453453

454-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
455-
// https://github.com/swiftlang/swift-format/issues/925
456-
/// Tests that *not* providing a default value still parses the argument correctly from the command-line.
457-
/// This test is almost certainly duplicated by others in the repository, but allows for quick use of test filtering during development on the initialization functionality.
454+
/// Tests that *not* providing a default value still parses the argument
455+
/// correctly from the command-line.
456+
///
457+
/// This test is almost certainly duplicated by others in the repository,
458+
/// but allows for quick use of test filtering during development on the
459+
/// initialization functionality.
458460
func testParsing_OptionPropertyInit_NoDefault_NoTransform() throws {
459461
AssertParse(
460462
OptionPropertyInitArguments_NoDefault_NoTransform.self,
@@ -464,18 +466,18 @@ extension DefaultsEndToEndTests {
464466
}
465467
}
466468

467-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
468-
// https://github.com/swiftlang/swift-format/issues/925
469-
/// Tests that using default property initialization syntax on a property with a `transform` function provided parses the default value for the argument when nothing is provided from the command-line.
469+
/// Tests that using default property initialization syntax on a property
470+
/// with a transform function provided parses the default value for the
471+
/// argument when nothing is provided from the command-line.
470472
func testParsing_OptionPropertyInit_Default_Transform_UseDefault() throws {
471473
AssertParse(OptionPropertyInitArguments_Default.self, []) { arguments in
472474
XCTAssertEqual(arguments.transformedData, "test")
473475
}
474476
}
475477

476-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
477-
// https://github.com/swiftlang/swift-format/issues/925
478-
/// Tests that using default property initialization syntax on a property with a `transform` function provided parses and transforms the command-line-provided value for the argument when provided.
478+
/// Tests that using default property initialization syntax on a property
479+
/// with a transform function provided parses and transforms the
480+
/// command-line-provided value for the argument when provided.
479481
func testParsing_OptionPropertyInit_Default_Transform_OverrideDefault() throws
480482
{
481483
AssertParse(
@@ -485,10 +487,13 @@ extension DefaultsEndToEndTests {
485487
}
486488
}
487489

488-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
489-
// https://github.com/swiftlang/swift-format/issues/925
490-
/// Tests that *not* providing a default value for a property with a `transform` function still parses the argument correctly from the command-line.
491-
/// This test is almost certainly duplicated by others in the repository, but allows for quick use of test filtering during development on the initialization functionality.
490+
/// Tests that *not* providing a default value for a property with a
491+
/// transform function still parses the argument correctly from the
492+
/// command-line.
493+
///
494+
/// This test is almost certainly duplicated by others in the repository,
495+
/// but allows for quick use of test filtering during development on the
496+
/// initialization functionality.
492497
func testParsing_OptionPropertyInit_NoDefault_Transform() throws {
493498
AssertParse(
494499
OptionPropertyInitArguments_NoDefault_Transform.self,
@@ -550,10 +555,12 @@ extension DefaultsEndToEndTests {
550555
}
551556
}
552557

553-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
554-
// https://github.com/swiftlang/swift-format/issues/925
555-
/// Tests that *not* providing a default value still parses the argument correctly from the command-line.
556-
/// This test is almost certainly duplicated by others in the repository, but allows for quick use of test filtering during development on the initialization functionality.
558+
/// Tests that *not* providing a default value still parses the argument
559+
/// correctly from the command-line.
560+
///
561+
/// This test is almost certainly duplicated by others in the repository, but
562+
/// allows for quick use of test filtering during development on the
563+
/// initialization functionality.
557564
func testParsing_ArgumentPropertyInit_NoDefault_NoTransform() throws {
558565
AssertParse(
559566
ArgumentPropertyInitArguments_NoDefault_NoTransform.self, ["test"]
@@ -582,10 +589,13 @@ extension DefaultsEndToEndTests {
582589
}
583590
}
584591

585-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
586-
// https://github.com/swiftlang/swift-format/issues/925
587-
/// Tests that *not* providing a default value for a property with a `transform` function still parses the argument correctly from the command-line.
588-
/// This test is almost certainly duplicated by others in the repository, but allows for quick use of test filtering during development on the initialization functionality.
592+
/// Tests that *not* providing a default value for a property with a
593+
/// transform function still parses the argument correctly from the
594+
/// command-line.
595+
///
596+
/// This test is almost certainly duplicated by others in the repository,
597+
/// but allows for quick use of test filtering during development on the
598+
/// initialization functionality.
589599
func testParsing_ArgumentPropertyInit_NoDefault_Transform() throws {
590600
AssertParse(
591601
ArgumentPropertyInitArguments_NoDefault_Transform.self, ["test"]
@@ -654,10 +664,12 @@ extension DefaultsEndToEndTests {
654664
}
655665
}
656666

657-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
658-
// https://github.com/swiftlang/swift-format/issues/925
659-
/// Tests that *not* providing a default value still parses the argument correctly from the command-line.
660-
/// This test is almost certainly duplicated by others in the repository, but allows for quick use of test filtering during development on the initialization functionality.
667+
/// Tests that *not* providing a default value still parses the argument
668+
/// correctly from the command-line.
669+
///
670+
/// This test is almost certainly duplicated by others in the repository, but
671+
/// allows for quick use of test filtering during development on the
672+
/// initialization functionality.
661673
func testParsing_FlagPropertyInit_Bool_NoDefault() throws {
662674
AssertParse(FlagPropertyInitArguments_Bool_NoDefault.self, ["--data"]) {
663675
arguments in
@@ -707,10 +719,12 @@ extension DefaultsEndToEndTests {
707719
}
708720
}
709721

710-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
711-
// https://github.com/swiftlang/swift-format/issues/925
712-
/// Tests that *not* providing a default value still parses the argument correctly from the command-line.
713-
/// This test is almost certainly duplicated by others in the repository, but allows for quick use of test filtering during development on the initialization functionality.
722+
/// Tests that *not* providing a default value still parses the argument
723+
/// correctly from the command-line.
724+
///
725+
/// This test is almost certainly duplicated by others in the repository, but
726+
/// allows for quick use of test filtering during development on the
727+
/// initialization functionality.
714728
func testParsing_FlagPropertyInit_EnumerableFlag_NoDefault() throws {
715729
AssertParse(
716730
FlagPropertyInitArguments_EnumerableFlag_NoDefault.self, ["--data"]
@@ -916,8 +930,6 @@ extension DefaultsEndToEndTests {
916930

917931
// MARK: Overload selection
918932

919-
// swift-format-ignore: AlwaysUseLowerCamelCase
920-
// https://github.com/apple/swift-argument-parser/issues/710
921933
extension DefaultsEndToEndTests {
922934
private struct AbsolutePath: ExpressibleByArgument {
923935
init(_ value: String) {}
@@ -938,11 +950,11 @@ extension DefaultsEndToEndTests {
938950
var path4 = AbsolutePath("abc")
939951
}
940952

941-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
942-
// https://github.com/swiftlang/swift-format/issues/925
943953
/// Tests that a non-optional `Value` type is inferred, regardless of how the
944-
/// initializer parameters are spelled. Previously, string literals and
945-
/// `.init` calls for the help parameter inferred different generic types.
954+
/// initializer parameters are spelled.
955+
///
956+
/// Previously, string literals and `.init` calls for the help parameter
957+
/// inferred different generic types.
946958
func testHelpInitInferredType() throws {
947959
AssertParse(TwoPaths.self, []) { cmd in
948960
XCTAssert(type(of: cmd.path1) == AbsolutePath.self)

Tests/ArgumentParserEndToEndTests/SourceCompatEndToEndTests.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ import ArgumentParser
1313
import ArgumentParserTestHelpers
1414
import XCTest
1515

16-
// swift-format-ignore: BeginDocumentationCommentWithOneLineSummary
17-
// https://github.com/swiftlang/swift-format/issues/925
18-
/// The goal of this test class is to validate source compatibility. By running
19-
/// this class's tests, all property wrapper initializers should be called.
16+
// The goal of this test class is to validate source compatibility. By running
17+
// this class's tests, all property wrapper initializers should be called.
2018
final class SourceCompatEndToEndTests: XCTestCase {}
2119

2220
// MARK: - Property Wrapper Initializers

0 commit comments

Comments
 (0)