Repository navigation
Added a command line option to specify a path to lint - #44
Conversation
Usage example: `swiftlint lint --path Source/swiftlint/LintCommand.swift`
|
Thanks for the PR, @larslockefeer! This is definitely on the right track, but needs a bit of work:
Otherwise, I have a few minor comments that I'll add inline to your PR now. Again, thanks for doing this! |
…han `stringByAppendingPathComponent`
Conflicts: Source/swiftlint/LintCommand.swift
|
Thanks for the feedback @jpsim! I have processed your comments and synced with the upstream again. I have discovered one additional issue after syncing with the upstream: files are now linted twice. I suspect that it is due to Also, I see that the tests failed. On my machine, they ran fine so this could be an issue with Travis. I see the following error in their console output: |
|
Failure looks unrelated, I restarted the build. |
There was a problem hiding this comment.
Seems like this function could be simplified:
func filesToLintAtPath(path: String) -> [String] {
let absolutePath = path.absolutePathRepresentation()
var isDirectory: ObjCBool = false
if fileManager.fileExistsAtPath(absolutePath, isDirectory: &isDirectory) {
if isDirectory {
return fileManager.allFilesRecursively(directory: absolutePath).filter {
$0.isSwiftFile()
}
} else if standardizedPath.isSwiftFile() {
return [standardizedPath]
}
}
return []
}|
This is great, @larslockefeer. My final comment is about perhaps simplifying |
|
Thanks again @jpsim, I have processed your feedback. |
Added a command line option to specify a path to lint
|
Hurray! Great work. |
This pull request adds a command-line option to specify an (absolute or relative) path to a file or directory to lint.
This enables use cases such as:
Usage examples:
swiftlint lint --path Source/swiftlint/LintCommand.swiftswiftlint lint --path Source/SwiftLintFrameworkThis PR relates to issues #6, #16 and #20