Skip to content

Commit

Permalink
added formatting instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
untoldengine committed Dec 28, 2024
1 parent 3f3a24c commit 6dc62ce
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/ContributionGuidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Your guide must follow this structure:
- Use concise and user-friendly language.
- Ensure all code examples are complete, tested, and follow the engine’s coding conventions.
- PRs must be documented in the /Documentation folder, with guides in markdown format.
- Make sure your code follows the [formatting guidelines](Formatting.md).

---
Thank you for contributing to the Untold Engine! Following these guidelines will ensure that your work aligns with the project's goals and provides value to users.
48 changes: 48 additions & 0 deletions docs/Formatting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Formatting and Linting

To maintain a consistent code style across the Untold Engine repo, we use [SwiftFormat](https://github.com/nicklockwood/SwiftFormat). SwiftFormat is a code formatter for Swift that helps enforce Swift style conventions and keep the codebase clean.

### Installing SwiftFormat

The simplest way to install SwiftFormat is through the command line.

1. Install SwiftFormat Using Homebrew: Open the terminal and run the following command:

```bash
brew install swiftformat
```
2. Verify Installation: After installation, verify that SwiftFormat is installed correctly by running:

```bash
swiftformat --version
```
This should print the installed version of SwiftFormat.

### Using SwiftFormat

Format a Single File

To format a specific Swift file:

1. Open the terminal and navigate to your project directory.

2. Run the following command:

```bash
swiftformat path/to/YourFile.swift
```
This will format YourFile.swift according to the default rules.

### Format Multiple Files

To format all Swift files in your project:

1. Navigate to your project directory in the terminal.

2. Run the following command:

```bash
swiftformat .
```

This will recursively format all Swift files in the current directory and its subdirectories.

0 comments on commit 6dc62ce

Please sign in to comment.