Skip to content

Commit

Permalink
Use indentation_width severity configuration (#3397)
Browse files Browse the repository at this point in the history
* Use the severity from the configuration

It was previously using a hardcoded value, that of the default configuration.

* Update CHANGELOG.md

* Correctly format CHANGELOG addition
  • Loading branch information
Samasaur1 authored Oct 31, 2020
1 parent 1950abb commit e6df1d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
* Rule `unused_capture_list` should not be triggered by unowned self keyword.
[hank121314](https://github.com/hank121314)
[#3389](https://github.com/realm/SwiftLint/issues/3389)

* Fix severity configuration for `indentation_width`.
[Samasaur1](https://github.com/Samasaur1), issue
[#3346](https://github.com/realm/SwiftLint/issues/3389)

## 0.40.3: Greased Up Drum Bearings

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public struct IndentationWidthRule: ConfigurationProviderRule, OptInRule {
violations.append(
StyleViolation(
ruleDescription: IndentationWidthRule.description,
severity: .warning,
severity: configuration.severityConfiguration.severity,
location: Location(file: file, characterOffset: line.range.location),
reason: "Code should be indented with tabs or " +
"\(configuration.indentationWidth) spaces, but not both in the same line."
Expand All @@ -97,7 +97,7 @@ public struct IndentationWidthRule: ConfigurationProviderRule, OptInRule {
violations.append(
StyleViolation(
ruleDescription: IndentationWidthRule.description,
severity: .warning,
severity: configuration.severityConfiguration.severity,
location: Location(file: file, characterOffset: line.range.location),
reason: "The first line shall not be indented."
)
Expand All @@ -122,7 +122,7 @@ public struct IndentationWidthRule: ConfigurationProviderRule, OptInRule {
violations.append(
StyleViolation(
ruleDescription: IndentationWidthRule.description,
severity: .warning,
severity: configuration.severityConfiguration.severity,
location: Location(file: file, characterOffset: line.range.location),
reason: isIndentation ?
"Code should be indented using one tab or \(indentWidth) spaces." :
Expand Down

0 comments on commit e6df1d3

Please sign in to comment.