Skip to content

gonzalonunez/ross

Repository files navigation

Ross 🧼

Ross is a Swift command-line tool to remove all comments from Swift code.

-/**
-Registers a handler in an `Application` for a given path.
-
-- Parameters:
-  - app: The `Application` to register the handler in.
-  - path: The path to register the handler for.
-*/
public func register(in app: Application, for path: String) {
  app.on(method, path.pathComponents) { [handle] req async throws in
    try await handle(req)
  }
}

Warning Right now, Ross almost certainly won't remove all of the comments that you are interested in removing. If you find a comment left behind, please file an issue so that we can add the appropriate specialized version of the visit(_:) function along with a test case.

Basic usage

swift run ross <directory> [--remove-plain <remove-plain>]
ARGUMENTS:
  <directory>             The folder whose contents you want to remove comments from.

OPTIONS:
  --remove-plain <remove-plain>
                          Whether or not Ross should remove plain comments. (default: true)
  -h, --help              Show help information.

It is recommended to pair this with swift-format, specifically the "maximumBlankLines" rule, in order to deal with any extraneous newlines that may remain after comments are removed.

Why Ross?

Charles Ross, President Harry Truman's White House press secretary, was responsible for the first recorded usage of "no comment" as a stock answer to a question.

About

🧼 Remove all comments from Swift code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages