[swift-evolution] "bad smells" should be compiler errors with suggestions on how to fix them

Erica Sadun erica at ericasadun.com
Sun Dec 6 11:07:35 CST 2015

On Dec 5, 2015, at 11:15 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
> Separate from compiler-enforced policies, I’d *love* to see someone tackle implementing a "go fmt” analog that reformats Swift code into a standard style, as well as a “clang format”  tool that could be used by IDEs for on-the-fly editing of code, as well as a “linter” / static analysis tool which can flag potential issues while having a higher tolerance for false positives.  These should be separate from the “always on” compiler diagnostics though.
> -Chris

I have a fairly minimal held-together-by-bandaids linter I put together: 


I have hesitated to develop it much further because I didn't want to be committed to inter-process SourceKit hacking and did not yet have access to a reliable parse tree. In its current state, it's a regex-based line-by-line scan.

The rules it follows are here: https://github.com/erica/testlint/blob/master/testlint/sources/Linter.m
with fairly copious commenting

-- Erica

More information about the swift-evolution mailing list