Ross

main

🧼 Remove all comments from Swift code
gonzalonunez/ross

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.

Description

  • Swift Tools 5.6.0
View More Packages from this Author

Dependencies

Last updated: Fri Oct 18 2024 16:48:33 GMT-0900 (Hawaii-Aleutian Daylight Time)