Skip to content

Convert another doc comment rule to opt-in and fix some typos. #248

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum RuleRegistry {
"AllPublicDeclarationsHaveDocumentation": false,
"AlwaysUseLowerCamelCase": true,
"AmbiguousTrailingClosureOverload": true,
"BeginDocumentationCommentWithOneLineSummary": true,
"BeginDocumentationCommentWithOneLineSummary": false,
"DoNotUseSemicolons": true,
"DontRepeatTypeInStaticProperties": true,
"FileScopedDeclarationPrivacy": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import SwiftSyntax
/// Lint: If a public declaration is missing a documentation comment, a lint error is raised.
public final class AllPublicDeclarationsHaveDocumentation: SyntaxLintRule {

/// Identifies this rule was being opt-in. While docs on most public declarations are beneficial,
/// Identifies this rule as being opt-in. While docs on most public declarations are beneficial,
/// there are a number of public decls where docs are either redundant or superfluous. This rule
/// can't differentiate those situations and will make a lot of noise for projects that are
/// intentionally avoiding docs on some decls.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public final class BeginDocumentationCommentWithOneLineSummary: SyntaxLintRule {
/// This allows test runs on those platforms to test both implementations.
public static var _forcesFallbackModeForTesting = false

/// Identifies this rule as being opt-in. Well written docs on declarations are important, but
/// this rule isn't linguistically advanced enough on all platforms to be applied universally.
public override class var isOptIn: Bool { return true }

public override func visit(_ node: FunctionDeclSyntax) -> SyntaxVisitorContinueKind {
diagnoseDocComments(in: DeclSyntax(node))
return .skipChildren
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftFormatRules/NeverForceUnwrap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import SwiftSyntax
/// Lint: If a force unwrap is used, a lint warning is raised.
public final class NeverForceUnwrap: SyntaxLintRule {

/// Identifies this rule was being opt-in. While force unwrap is an unsafe pattern (i.e. it can
/// Identifies this rule as being opt-in. While force unwrap is an unsafe pattern (i.e. it can
/// crash), there are valid contexts for force unwrap where it won't crash. This rule can't
/// evaluate the context around the force unwrap to make that determination.
public override class var isOptIn: Bool { return true }
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftFormatRules/NeverUseForceTry.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import SwiftSyntax
/// TODO: Create exception for NSRegularExpression
public final class NeverUseForceTry: SyntaxLintRule {

/// Identifies this rule was being opt-in. While force try is an unsafe pattern (i.e. it can
/// Identifies this rule as being opt-in. While force try is an unsafe pattern (i.e. it can
/// crash), there are valid contexts for force try where it won't crash. This rule can't
/// evaluate the context around the force try to make that determination.
public override class var isOptIn: Bool { return true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import SwiftSyntax
/// Lint: Declaring a property with an implicitly unwrapped type yields a lint error.
public final class NeverUseImplicitlyUnwrappedOptionals: SyntaxLintRule {

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