Improve `identifier_name` documentation (#4784)

This commit is contained in:
Martin Redington 2023-02-25 19:02:02 +00:00 committed by GitHub
parent c9b1b961f5
commit 04791929a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 2 deletions

View File

@ -83,6 +83,10 @@
* Catch more valid `no_magic_numbers` violations.
[JP Simard](https://github.com/jpsim)
* Improve `identifier_name` documentation.
[Martin Redington](https://github.com/mildm8nnered)
[#4767](https://github.com/realm/SwiftLint/issues/4767)
#### Bug Fixes
* Report violations in all `<scope>_length` rules when the error threshold is

View File

@ -16,7 +16,7 @@ struct IdentifierNameRule: ASTRule, ConfigurationProviderRule {
description: "Identifier names should only contain alphanumeric characters and " +
"start with a lowercase character or should only contain capital letters. " +
"In an exception to the above, variable names may start with a capital letter " +
"when they are declared static and immutable. Variable names should not be too " +
"when they are declared as static. Variable names should not be too " +
"long or too short.",
kind: .style,
nonTriggeringExamples: IdentifierNameRuleExamples.nonTriggeringExamples,

View File

@ -13,7 +13,17 @@ internal struct IdentifierNameRuleExamples {
Example("func == (lhs: SyntaxToken, rhs: SyntaxToken) -> Bool"),
Example("override func IsOperator(name: String) -> Bool"),
Example("enum Foo { case `private` }"),
Example("enum Foo { case value(String) }")
Example("enum Foo { case value(String) }"),
Example("""
class Foo {
static let Bar = 0
}
"""),
Example("""
class Foo {
static var Bar = 0
}
""")
]
static let triggeringExamples = [