# swiftlang/swift-format

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/swiftlang-swift-format).**

2,940 stars · 265 forks · Swift · Apache-2.0

## Links

- GitHub: https://github.com/swiftlang/swift-format
- awesome-repositories: https://awesome-repositories.com/repository/swiftlang-swift-format.md

## Description

swift-format is a set of developer utilities for the Swift ecosystem designed for automated style enforcement, static analysis, and project-wide configuration management. It functions as a code formatter that rewrites source code to adhere to consistent style rules and as a linter that identifies style violations.

The tool provides a system for defining and applying custom formatting rules through a configuration tool. This includes the ability to load settings from configuration files discovered in a directory hierarchy or to export default settings for user customization.

Its capabilities include source code formatting and linting, which allow for the detection of style violations and the automatic rewriting of files. The project also provides an API for embedding formatting and linting logic directly into other applications.

## Tags

### Programming Languages & Runtimes

- [Source Code Formatters](https://awesome-repositories.com/f/programming-languages-runtimes/source-code-formatters.md) — Automatically rewrites Swift source files to adhere to a consistent and standardized style guide. ([source](https://cdn.jsdelivr.net/gh/swiftlang/swift-format@main/README.md))
- [Swift Resources](https://awesome-repositories.com/f/programming-languages-runtimes/programming-language-varieties/programming-languages/language-specific-resources/apple-platform-languages/swift-resources.md) — Provides developer utilities built specifically to maintain code quality and consistency in Swift projects.
- [Swift Code Formatters](https://awesome-repositories.com/f/programming-languages-runtimes/swift-code-formatters.md) — Applies visual style and consistent formatting specifically to the Swift programming language.
- [Swift Development Tooling](https://awesome-repositories.com/f/programming-languages-runtimes/swift-development-tooling.md) — Provides a set of developer utilities to manage code style and quality within the Swift ecosystem.

### Development Tools & Productivity

- [Preservation-Aware Rewrites](https://awesome-repositories.com/f/development-tools-productivity/ast-transformation-tools/ast-to-source-conversion/source-code-rewriting/preservation-aware-rewrites.md) — Performs structural code modifications while preserving all original whitespace and comments to prevent metadata loss.
- [Static Code Linting](https://awesome-repositories.com/f/development-tools-productivity/static-code-linting.md) — Scans source code to detect style violations and report diagnostics via a linter. ([source](https://cdn.jsdelivr.net/gh/swiftlang/swift-format@main/README.md))
- [Swift Linters](https://awesome-repositories.com/f/development-tools-productivity/swift-linters.md) — Performs static analysis on Swift code to identify style violations and ensure adherence to coding standards.
- [Automated Linting Integrations](https://awesome-repositories.com/f/development-tools-productivity/automated-linting-integrations.md) — Enables the integration of style checks into development pipelines to treat formatting warnings as build errors.
- [Style Rule Configurations](https://awesome-repositories.com/f/development-tools-productivity/command-line-configuration/style-rule-configurations.md) — Supports loading formatting rules from configuration files discovered in the directory hierarchy or command line flags. ([source](https://cdn.jsdelivr.net/gh/swiftlang/swift-format@main/README.md))
- [Style Configuration Systems](https://awesome-repositories.com/f/development-tools-productivity/swift-linters/style-configuration-systems.md) — Provides a system for defining and applying custom formatting rules for Swift projects via configuration files.

### Software Engineering & Architecture

- [Abstract Syntax Tree Parsing](https://awesome-repositories.com/f/software-engineering-architecture/abstract-syntax-tree-parsing.md) — Parses Swift source code into a structured abstract syntax tree to identify and manipulate specific language constructs.
- [Configuration-Driven Rule Engines](https://awesome-repositories.com/f/software-engineering-architecture/configuration-driven-rule-engines.md) — Implements a rule engine that parses user-defined settings to apply specific style transformations to source code.
- [Configuration Path Resolution](https://awesome-repositories.com/f/software-engineering-architecture/directory-based-version-resolution/configuration-path-resolution.md) — Resolves the applicable style configuration by traversing up the directory tree from the current file to the root.
