Skip to content

Commit

Permalink
fix #522
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsim committed Feb 11, 2016
1 parent d95d0c4 commit c662407
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 c662407

Please sign in to comment.