Skip to content

Commit 22118db

Browse files
authored
Merge pull request swiftlang#248 from dylansturg/quieter_docs
Convert another doc comment rule to opt-in and fix some typos.
2 parents e89eaef + 431eac4 commit 22118db

6 files changed

+9
-5
lines changed

Sources/SwiftFormatConfiguration/RuleRegistry+Generated.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ enum RuleRegistry {
1717
"AllPublicDeclarationsHaveDocumentation": false,
1818
"AlwaysUseLowerCamelCase": true,
1919
"AmbiguousTrailingClosureOverload": true,
20-
"BeginDocumentationCommentWithOneLineSummary": true,
20+
"BeginDocumentationCommentWithOneLineSummary": false,
2121
"DoNotUseSemicolons": true,
2222
"DontRepeatTypeInStaticProperties": true,
2323
"FileScopedDeclarationPrivacy": true,

Sources/SwiftFormatRules/AllPublicDeclarationsHaveDocumentation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import SwiftSyntax
1818
/// Lint: If a public declaration is missing a documentation comment, a lint error is raised.
1919
public final class AllPublicDeclarationsHaveDocumentation: SyntaxLintRule {
2020

21-
/// Identifies this rule was being opt-in. While docs on most public declarations are beneficial,
21+
/// Identifies this rule as being opt-in. While docs on most public declarations are beneficial,
2222
/// there are a number of public decls where docs are either redundant or superfluous. This rule
2323
/// can't differentiate those situations and will make a lot of noise for projects that are
2424
/// intentionally avoiding docs on some decls.

Sources/SwiftFormatRules/BeginDocumentationCommentWithOneLineSummary.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ public final class BeginDocumentationCommentWithOneLineSummary: SyntaxLintRule {
2626
/// This allows test runs on those platforms to test both implementations.
2727
public static var _forcesFallbackModeForTesting = false
2828

29+
/// Identifies this rule as being opt-in. Well written docs on declarations are important, but
30+
/// this rule isn't linguistically advanced enough on all platforms to be applied universally.
31+
public override class var isOptIn: Bool { return true }
32+
2933
public override func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind {
3034
diagnoseDocComments(in: DeclSyntax(node))
3135
return .skipChildren

Sources/SwiftFormatRules/NeverForceUnwrap.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import SwiftSyntax
1818
/// Lint: If a force unwrap is used, a lint warning is raised.
1919
public final class NeverForceUnwrap: SyntaxLintRule {
2020

21-
/// Identifies this rule was being opt-in. While force unwrap is an unsafe pattern (i.e. it can
21+
/// Identifies this rule as being opt-in. While force unwrap is an unsafe pattern (i.e. it can
2222
/// crash), there are valid contexts for force unwrap where it won't crash. This rule can't
2323
/// evaluate the context around the force unwrap to make that determination.
2424
public override class var isOptIn: Bool { return true }

Sources/SwiftFormatRules/NeverUseForceTry.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import SwiftSyntax
2323
/// TODO: Create exception for NSRegularExpression
2424
public final class NeverUseForceTry: SyntaxLintRule {
2525

26-
/// Identifies this rule was being opt-in. While force try is an unsafe pattern (i.e. it can
26+
/// Identifies this rule as being opt-in. While force try is an unsafe pattern (i.e. it can
2727
/// crash), there are valid contexts for force try where it won't crash. This rule can't
2828
/// evaluate the context around the force try to make that determination.
2929
public override class var isOptIn: Bool { return true }

Sources/SwiftFormatRules/NeverUseImplicitlyUnwrappedOptionals.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import SwiftSyntax
2525
/// Lint: Declaring a property with an implicitly unwrapped type yields a lint error.
2626
public final class NeverUseImplicitlyUnwrappedOptionals: SyntaxLintRule {
2727

28-
/// Identifies this rule was being opt-in. While accessing implicitly unwrapped optionals is an
28+
/// Identifies this rule as being opt-in. While accessing implicitly unwrapped optionals is an
2929
/// unsafe pattern (i.e. it can crash), there are valid contexts for using implicitly unwrapped
3030
/// optionals where it won't crash. This rule can't evaluate the context around the usage to make
3131
/// that determination.

0 commit comments

Comments
 (0)