diff --git a/CHANGELOG.md b/CHANGELOG.md index bddd8c57b..8f72c42f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 `_length` rules when the error threshold is diff --git a/Source/SwiftLintFramework/Rules/Style/IdentifierNameRule.swift b/Source/SwiftLintFramework/Rules/Style/IdentifierNameRule.swift index 23e5b64c5..1159d939f 100644 --- a/Source/SwiftLintFramework/Rules/Style/IdentifierNameRule.swift +++ b/Source/SwiftLintFramework/Rules/Style/IdentifierNameRule.swift @@ -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, diff --git a/Source/SwiftLintFramework/Rules/Style/IdentifierNameRuleExamples.swift b/Source/SwiftLintFramework/Rules/Style/IdentifierNameRuleExamples.swift index 746b0e7a0..4febee092 100644 --- a/Source/SwiftLintFramework/Rules/Style/IdentifierNameRuleExamples.swift +++ b/Source/SwiftLintFramework/Rules/Style/IdentifierNameRuleExamples.swift @@ -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 = [