Skip to content

Commit

Permalink
Prevent type name’s out of bounds crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
sinoru committed May 8, 2022
1 parent ca9217d commit 3206d1b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public struct GenericTypeNameRule: ASTRule, ConfigurationProviderRule {
reason: "Generic type name should only contain alphanumeric characters: '\(name)'")
]
} else if configuration.validatesStartWithLowercase &&
!String(name[name.startIndex]).isUppercase() {
name.first?.isLowercase == true {
return [
StyleViolation(ruleDescription: Self.description,
severity: .error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public struct TypeNameRule: ASTRule, ConfigurationProviderRule {
location: Location(file: file, byteOffset: offset),
reason: "Type name should only contain alphanumeric characters: '\(name)'")]
} else if configuration.validatesStartWithLowercase &&
!String(name[name.startIndex]).isUppercase() {
name.first?.isLowercase == true {
return [StyleViolation(ruleDescription: Self.description,
severity: .error,
location: Location(file: file, byteOffset: offset),
Expand Down

0 comments on commit 3206d1b

Please sign in to comment.