Skip to content

0xLeif/fledge-plugin-swift-format

Repository files navigation

fledge-plugin-swift-format

CI License: MIT

A Fledge plugin that formats and lints Swift code with the CorvidLabs style guide.

Install

fledge plugins install 0xLeif/fledge-plugin-swift-format

Usage

Format all Swift files

fledge swift-format

Lint without modifying

fledge swift-format --lint

Strict lint for CI

fledge swift-format --check

Use your own config

fledge swift-format --use-project-config

Format specific paths

fledge swift-format Sources/MyModule Tests/MyModuleTests

CorvidLabs Style

This plugin ships a locked configuration that enforces:

  • 4 spaces indentation
  • 120 character line length
  • K&R braces (opening brace on same line)
  • No force unwrap (!) or force try (try!)
  • No semicolons
  • Ordered imports
  • Triple-slash documentation comments
  • And more...

See the full config in Sources/FledgeSwiftFormat/Resources/.swift-format.json.

Standalone Usage

The binary also works outside Fledge:

swift build -c release
.build/release/fledge-plugin-swift-format --lint

Exit Codes

Code Meaning
0 Success
1 Lint violations found (strict mode) or format error
2 swift-format not installed
3 No Swift files found

Development

swift build
swift test
swift-format lint --strict -r Sources Tests

License

MIT

About

Fledge plugin that formats and lints Swift code with 0xLeif's bundled .swift-format.json style.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages