Skip to content

Compilation errors after following new rule prefer_self_in_static_references #3768

Closed

Description

@christiankm

New Issue Checklist

Describe the bug

After implementing the new rule in SwiftLint 0.45.1 prefer_self_in_static_references and running swiftlint --fix our code no longer compiles. This rule is not ignoring some cases where it should not be followed. Please see screenshots:

Skærmbillede 2021-11-30 kl  15 15 19
Skærmbillede 2021-11-30 kl  15 15 30

For now, we can just solve this with a // swiftlint:disable:this but the rule should be fixed to ignore such cases, and prevent build failures.

Environment

  • SwiftLint version: 0.45.1
  • Installation method used: Homebrew
  • Paste your configuration file:
...

opt_in_rules:
  - prefer_self_in_static_references
...
  • Are you using nested configurations? No.
  • Which Xcode version are you using (check xcodebuild -version)? Xcode 13.2 Beta 2

Activity

  1. jpsim commented on Nov 30, 2021

    @jpsim
    Collaborator

    Thanks for the report!

  2. jpsim commented on Nov 30, 2021

    @jpsim
    Collaborator

    @SimplyDanny do you think you'd have time to teach your new rule how to handle this case? It might also be useful to comb through the cases reported by OSSCheck in the original PR (#3732 (comment)) to see if there are any other false positives.

  3. added
    bug
    on Nov 30, 2021
  4. SimplyDanny commented on Nov 30, 2021

    @SimplyDanny
    Collaborator

    Sure. I'll have a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions