Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default column to 1 in XcodeReporter output #2488

Merged
merged 2 commits into from
Nov 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,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)