Skip to content

Commit

Permalink
Default column to 1 in XcodeReporter output (#2488)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpsim authored Nov 27, 2018
1 parent 64c0b96 commit a944808
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
[JP Simard](https://github.com/jpsim)
[#2276](https://github.com/realm/SwiftLint/issues/2276)

* Fix violations with no character/column location not being reported in
`xcpretty`. Now violations with no column location default to a column value
of `1` indicating the start of the line.
[JP Simard](https://github.com/jpsim)
[#2267](https://github.com/realm/SwiftLint/issues/2267)

## 0.28.2: EnviroBoost Plus

#### Breaking
Expand Down
2 changes: 1 addition & 1 deletion Source/SwiftLintFramework/Models/Location.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public struct Location: CustomStringConvertible, Comparable {
// {full_path_to_file}{:line}{:character}: {error,warning}: {content}
let fileString: String = file ?? "<nopath>"
let lineString: String = ":\(line ?? 1)"
let charString: String = character.map({ ":\($0)" }) ?? ""
let charString: String = ":\(character ?? 1)"
return [fileString, lineString, charString].joined()
}
public var relativeFile: String? {
Expand Down
4 changes: 2 additions & 2 deletions Tests/SwiftLintFrameworkTests/IntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class IntegrationTests: XCTestCase {
} else {
XCTAssertEqual(swiftlintResult.status, 0)
XCTAssertEqual(swiftlintResult.stdout, """
\(testSwiftURL.path):1: \
\(testSwiftURL.path):1:1: \
warning: Trailing Newline Violation: Files should have a single trailing newline. (trailing_newline)
""")
Expand Down Expand Up @@ -109,7 +109,7 @@ class IntegrationTests: XCTestCase {
let swiftlintResult = execute(swiftlintInSandboxArgs, in: testSwiftURL.deletingLastPathComponent())
XCTAssertEqual(swiftlintResult.status, 0)
XCTAssertEqual(swiftlintResult.stdout, """
\(testSwiftURL.path):1: \
\(testSwiftURL.path):1:1: \
warning: Trailing Newline Violation: Files should have a single trailing newline. (trailing_newline)
""")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
filename:1:2: warning: Line Length Violation: Violation Reason. (line_length)
filename:1:2: error: Line Length Violation: Violation Reason. (line_length)
filename:1:2: error: Syntactic Sugar Violation: Shorthand syntactic sugar should be used, i.e. [Int] instead of Array<Int>. (syntactic_sugar)
<nopath>:1: error: Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)
<nopath>:1:1: error: Colon Violation: Colons should be next to the identifier when specifying a type and next to the key in dictionary literals. (colon)

0 comments on commit a944808

Please sign in to comment.