Skip to content

Commit

Permalink
Enable last_where on SwiftLint
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelofabri committed Dec 26, 2018
1 parent c17e269 commit 506e308
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ opt_in_rules:
- identical_operands
- joined_default_parameter
- let_var_whitespace
- last_where
- literal_expression_end_indentation
- lower_acl_than_parent
- nimble_operator
Expand Down
4 changes: 2 additions & 2 deletions Source/SwiftLintFramework/Rules/Style/TrailingCommaRule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ public struct TrailingCommaRule: ASTRule, CorrectableRule, ConfigurationProvider
let ranges = TrailingCommaRule.commaRegex.matches(in: contents, options: [], range: range).map { $0.range }

// skip commas in comments
return ranges.filter {
return ranges.last {
let range = NSRange(location: $0.location + offset, length: $0.length)
let kinds = file.syntaxMap.kinds(inByteRange: range)
return SyntaxKind.commentKinds.isDisjoint(with: kinds)
}.last.flatMap {
}.flatMap {
nsstring.NSRangeToByteRange(start: $0.location, length: $0.length)
}?.location
}
Expand Down

0 comments on commit 506e308

Please sign in to comment.