Improve `identifier_name` documentation (#4784)
This commit is contained in:
parent
c9b1b961f5
commit
04791929a7
|
@ -83,6 +83,10 @@
|
||||||
* Catch more valid `no_magic_numbers` violations.
|
* Catch more valid `no_magic_numbers` violations.
|
||||||
[JP Simard](https://github.com/jpsim)
|
[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
|
#### Bug Fixes
|
||||||
|
|
||||||
* Report violations in all `<scope>_length` rules when the error threshold is
|
* Report violations in all `<scope>_length` rules when the error threshold is
|
||||||
|
|
|
@ -16,7 +16,7 @@ struct IdentifierNameRule: ASTRule, ConfigurationProviderRule {
|
||||||
description: "Identifier names should only contain alphanumeric characters and " +
|
description: "Identifier names should only contain alphanumeric characters and " +
|
||||||
"start with a lowercase character or should only contain capital letters. " +
|
"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 " +
|
"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.",
|
"long or too short.",
|
||||||
kind: .style,
|
kind: .style,
|
||||||
nonTriggeringExamples: IdentifierNameRuleExamples.nonTriggeringExamples,
|
nonTriggeringExamples: IdentifierNameRuleExamples.nonTriggeringExamples,
|
||||||
|
|
|
@ -13,7 +13,17 @@ internal struct IdentifierNameRuleExamples {
|
||||||
Example("func == (lhs: SyntaxToken, rhs: SyntaxToken) -> Bool"),
|
Example("func == (lhs: SyntaxToken, rhs: SyntaxToken) -> Bool"),
|
||||||
Example("override func IsOperator(name: String) -> Bool"),
|
Example("override func IsOperator(name: String) -> Bool"),
|
||||||
Example("enum Foo { case `private` }"),
|
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 = [
|
static let triggeringExamples = [
|
||||||
|
|
Loading…
Reference in New Issue