Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ff59db5

Browse files
jpsimberikv
authored andcommittedFeb 15, 2016
fix realm#522
1 parent 7fdbb25 commit ff59db5

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed
 

‎CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@
7171
[JP Simard](https://github.com/jpsim)
7272
[#466](https://github.com/realm/SwiftLint/issues/466)
7373

74+
* Fixed an issue where `variable_name` or `type_name` would always report a
75+
violation when configured with only a `warning` value on either `min_length`
76+
or `max_length`.
77+
[JP Simard](https://github.com/jpsim)
78+
[#522](https://github.com/realm/SwiftLint/issues/522)
79+
7480
## 0.8.0: High Heat
7581

7682
##### Breaking

‎Source/SwiftLintFramework/Rules/RuleConfigs/NameConfig.swift

+7-8
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,13 @@ public func == (lhs: NameConfig, rhs: NameConfig) -> Bool {
6363

6464
public extension ConfigProviderRule where ConfigType == NameConfig {
6565
public func severity(forLength length: Int) -> ViolationSeverity? {
66-
if length < config.minLength.error ||
67-
length > config.maxLength.error {
68-
return .Error
69-
} else if length < config.minLength.warning ||
70-
length > config.maxLength.warning {
71-
return .Warning
72-
} else {
73-
return .None
66+
if let minError = config.minLength.error where length < minError {
67+
return .Error
68+
} else if let maxError = config.maxLength.error where length > maxError {
69+
return .Error
70+
} else if length < config.minLength.warning || length > config.maxLength.warning {
71+
return .Warning
7472
}
73+
return nil
7574
}
7675
}

0 commit comments

Comments
 (0)
Please sign in to comment.