Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ dotnet format --verify-no-changes
pwsh ./scripts/format.ps1
```

See [README-FORMATTING.md](README-FORMATTING.md) for detailed formatting rules.
See [README-FORMATTING.md](docs/README-FORMATTING.md) for detailed formatting rules.

---

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This project is licensed under the **MIT License**. See the [LICENSE](LICENSE) f

- **GitHub Repository:** [https://github.com/Chris-Wolfgang/ETL-Abstractions](https://github.com/Chris-Wolfgang/ETL-Abstractions)
- **API Documentation:** https://Chris-Wolfgang.github.io/ETL-Abstractions/
- **Formatting Guide:** [README-FORMATTING.md](README-FORMATTING.md)
- **Formatting Guide:** [README-FORMATTING.md](docs/README-FORMATTING.md)
- **Contributing Guide:** [CONTRIBUTING.md](CONTRIBUTING.md)

---
Expand Down Expand Up @@ -154,7 +154,7 @@ dotnet format
dotnet format --verify-no-changes
```

See [README-FORMATTING.md](README-FORMATTING.md) for detailed formatting guidelines.
See [README-FORMATTING.md](docs/README-FORMATTING.md) for detailed formatting guidelines.

### Building Documentation

Expand Down
68 changes: 68 additions & 0 deletions docs/README-FORMATTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Code Formatting

This repository uses `dotnet format` to enforce consistent C# code style.
Comment thread
Chris-Wolfgang marked this conversation as resolved.

Comment thread
Chris-Wolfgang marked this conversation as resolved.
## Prerequisites

The `dotnet format` command is **built into the .NET SDK** starting with .NET 6 and later. Since this project requires .NET 8.0 SDK or later, you already have `dotnet format` available — no separate tool installation is needed.

> **Note:** The standalone `dotnet-format` global tool was deprecated when `dotnet format` was integrated into the .NET 6 SDK in August 2021.

## For Developers

### Before Committing

Run the formatting script with PowerShell Core (`pwsh`) on any supported platform:

```powershell
pwsh ./scripts/format.ps1
```

Or check without making changes:

```powershell
pwsh ./scripts/format.ps1 -Check
```
Comment thread
Chris-Wolfgang marked this conversation as resolved.
Comment thread
Chris-Wolfgang marked this conversation as resolved.

### Manual Formatting

```bash
dotnet format
```

### Check Formatting (like CI does)

```bash
dotnet format --verify-no-changes
```

## Configuration

Code style rules are defined in `.editorconfig` at the repository root.

## CI/CD

All pull requests are automatically checked for proper formatting. PRs with formatting issues will fail the build.

### If CI Fails

1. Run `pwsh ./scripts/format.ps1` locally
2. Review the changes
3. Commit and push the formatted code

## IDE Integration

Most IDEs automatically read `.editorconfig`:

- **Visual Studio**: Built-in support, formats on save (Tools → Options → Text Editor → C# → Code Style)
- **VS Code**: Install "EditorConfig for VS Code" extension
- **JetBrains Rider**: Built-in support

## Formatting Rules

Key style rules:
- **Indentation**: 4 spaces for C# (with `switch` case contents not additionally indented when inside a block, per `.editorconfig`), 2 for XML/JSON
- **Braces**: Opening brace on new line
- **Line endings**: LF (Unix style) for most files; PowerShell scripts (`*.ps1`) use CRLF as configured in `.editorconfig`
- **Trailing whitespace**: Removed
- **Using directives**: System namespaces first, sorted alphabetically
4 changes: 2 additions & 2 deletions scripts/format.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
If specified, only checks formatting without making changes (like CI does).

.EXAMPLE
.\format.ps1
pwsh ./scripts/format.ps1
Formats all code in the repository.

.EXAMPLE
.\format.ps1 -Check
pwsh ./scripts/format.ps1 -Check
Checks formatting without making changes.
#>

Expand Down
Loading