Reputation: 2997
The following is an excerpt from my swiftlint logs:
MyViewController.swift:187:21: warning: Empty String Violation: Prefer checking
isEmpty
over comparingstring
to an empty string literal. (empty_string)
Linting 'MyDataSource.swift' (570/578)
In above Logs what is 187:21 ? and what is (570/ 578) ?
Upvotes: 2
Views: 906
Reputation: 437552
You asked:
what is 187:21 ? and what is (570/ 578) ?
The “570/578” is file 570 of 578.
The “187:21” is line 187, column 21.
You say:
[it] doesn't look like its number of lines as
MyViewController.swift
having just 90 lines of code
I can’t reconcile your numbers if you really only have 90 lines in that source file including code, comments, blank lines, etc.
If you really only have 90 lines, perhaps you’re not running this on the directory you think you are. Or maybe you have another copy of this file lingering about which swiftlint picked up even though it’s not part of your compile sources. Or maybe there is some post-processed file that has additional lines. But the colon separated numbers are always “line:column”.
By the way, you can configure your Xcode project to do swiftlint during the build process (see the Xcode section of the README.md
), and the warning show up right in Xcode, just like it does for all of the other Xcode compile-time warnings, simplifying this process of correlating warning/error messages with one’s code. (e.g. tap on warning, jump immediately to relevant code).
And to illustrate the line:column syntax, here is a message from my build log in Xcode, which indicates that my particular warning is on line 18, column 17:
And here is my sample source file that resulted in that warning, in which you can see that this line number and column number is precisely where the issue rests in my code (and because I ran swiftlint from Xcode, it shows me the error right in my IDE, too):
Upvotes: 3