Skip to content

AllPublicDeclarationsHaveDocumentation warns on overridden methods  #651

Closed
@aperkov

Description

@aperkov

I recently used Homebrew to upgrade to swift-format 509.0.0.

The behaviour of the AllPublicDeclarationsHaveDocumentation rule has changed:

  • Previously overridden methods did not cause the rule to trigger a warning.
  • Now they do.

I'm not sure if this was intentional or not - there doesn't seem to be any mention in the release notes.

The behavioural change seems to have happened in #609

AllPublicDeclarationsHaveDocumentation.swift now contains:

guard
       DocumentationCommentText(extractedFrom: decl.leadingTrivia) == nil,
       modifiers.contains(anyOf: [.public, .override])

Whereas previously it contained a guard that modifiers does not contain override:

guard
       DocumentationCommentText(extractedFrom: decl.leadingTrivia) == nil,
       let mods = modifiers, mods.has(modifier: "public") && !mods.has(modifier: "override")

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions