realm/SwiftLint

False negatives in prefer_self_in_static_references since 0.46.2

已關閉

#3,993 建立於 2022年6月13日

 (2 則留言) (0 個反應) (0 位負責人)Swift (2,295 個分叉)batch import
good first issuerule-request

倉庫指標

星標
 (19,570 顆星)
PR 合併指標
 (平均合併 16天 3小時) (30 天內合併 37 個 PR)

描述

New Issue Checklist

Describe the bug

The prefer_self_in_static_references is not reporting some issues since in from version 0.46.2 onward. Our CI was still on 0.46.1 and caught many more issues with the older version

Seems like the same issue as

Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint
Linting Swift files in current working directory
Linting 'foo.swift' (1/1)
Done linting! Found 0 violations, 0 serious in 1 file.

# After downgrading to 0.46.1
$ swiftlint lint
Linting Swift files in current working directory
Linting 'foo.swift' (1/1)
/Users/neo/Desktop/swiftlint/foo.swift:6:27: warning: Prefer Self in Static References Violation: Static references should be prefixed by `Self` instead of the class name. (prefer_self_in_static_references)
Done linting! Found 1 violation, 0 serious in 1 file.

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.47.1
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? 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.4.1 Build version 13F100
  • Do you have a sample that shows the issue? Run echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules to quickly test if your example is really demonstrating the issue. If your example is more complex, you can use swiftlint lint --path [file here] --no-cache --enable-all-rules.
class Foo {
  static let value = 1
}

extension Foo {
  static let otherValue = Foo.value
}

貢獻者指南