Skip to content

Conversation

@mannylopez
Copy link
Contributor

@mannylopez mannylopez commented Aug 1, 2024

Summary

This PR adds rule unusedPrivateDeclaration to remove unused private and fileprivate properties, functions, and typealiases.

// WRONG: Includes private declarations that are unused
struct Planet {
  var ageInBillionYears: Double {
    ageInMillionYears / 1000
  }

  private var ageInMillionsOfYears: Double
  private typealias Dependencies = UniverseBuilderProviding // unused
  private var mass: Double // unused
  private func distance(to: Planet) { } // unused
}

// RIGHT
struct Planet {
  var ageInBillionsOfYears: Double {
    ageInMillionYears / 1000
  }

  private var ageInMillionYears: Double
}

Reasoning

Improves readability since the code has no effect and should be removed for clarity.

Copy link
Member

@calda calda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excited about this one, nice work @mannylopez!

@calda calda enabled auto-merge (squash) August 7, 2024 16:49
@calda calda merged commit 633fc25 into master Aug 7, 2024
@calda calda deleted the manny-lopez--add-unusedPrivateDeclaration branch August 7, 2024 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants