Skip to content

Commit

Permalink
fix realm#522
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsim authored and berikv committed Feb 15, 2016
1 parent 7fdbb25 commit ff59db5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
[JP Simard](https://github.com/jpsim)
[#466](https://github.com/realm/SwiftLint/issues/466)

* Fixed an issue where `variable_name` or `type_name` would always report a
violation when configured with only a `warning` value on either `min_length`
or `max_length`.
[JP Simard](https://github.com/jpsim)
[#522](https://github.com/realm/SwiftLint/issues/522)

## 0.8.0: High Heat

##### Breaking
Expand Down
15 changes: 7 additions & 8 deletions Source/SwiftLintFramework/Rules/RuleConfigs/NameConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,13 @@ public func == (lhs: NameConfig, rhs: NameConfig) -> Bool {

public extension ConfigProviderRule where ConfigType == NameConfig {
public func severity(forLength length: Int) -> ViolationSeverity? {
if length < config.minLength.error ||
length > config.maxLength.error {
return .Error
} else if length < config.minLength.warning ||
length > config.maxLength.warning {
return .Warning
} else {
return .None
if let minError = config.minLength.error where length < minError {
return .Error
} else if let maxError = config.maxLength.error where length > maxError {
return .Error
} else if length < config.minLength.warning || length > config.maxLength.warning {
return .Warning
}
return nil
}
}

0 comments on commit ff59db5

Please sign in to comment.