A Fledge plugin that formats and lints Swift code with the CorvidLabs style guide.
fledge plugins install 0xLeif/fledge-plugin-swift-formatfledge swift-formatfledge swift-format --lintfledge swift-format --checkfledge swift-format --use-project-configfledge swift-format Sources/MyModule Tests/MyModuleTestsThis 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.
The binary also works outside Fledge:
swift build -c release
.build/release/fledge-plugin-swift-format --lint| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Lint violations found (strict mode) or format error |
| 2 | swift-format not installed |
| 3 | No Swift files found |
swift build
swift test
swift-format lint --strict -r Sources TestsMIT