Skip to content
Draft
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
30 changes: 30 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Formatting

on:
pull_request:
push:
branches:
- master
workflow_dispatch:

jobs:
format:
name: Check formatting
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x

- name: Install CSharpier
run: dotnet tool install --tool-path ./.tools CSharpier --version 1.2.6

- name: Check formatting
run: |
mapfile -t files < <(git ls-files '*.cs' '*.csx' '*.csproj' '*.props' '*.targets' '*.xml' '*.slnx')
./.tools/csharpier check "${files[@]}"
29 changes: 29 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Contributing

## Formatting

Format C# files, XML project/configuration files, and `.slnx` files with
CSharpier before opening a pull request.

Install CSharpier as a local .NET tool:

```sh
dotnet tool install --global CSharpier
```

Format the checked files locally:

```sh
dotnet csharpier format $(git ls-files '*.cs' '*.csx' '*.csproj' '*.props' '*.targets' '*.xml' '*.slnx')
```

Check formatting without writing changes:

```sh
dotnet csharpier check $(git ls-files '*.cs' '*.csx' '*.csproj' '*.props' '*.targets' '*.xml' '*.slnx')
```

See the official CSharpier docs for
[installation](https://csharpier.com/docs/About) and
[editor integration](https://csharpier.com/docs/Editors), including format on
save.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
<TargetFrameworks>net10.0</TargetFrameworks>
</PropertyGroup>
</Project>
6 changes: 5 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="2.1.0" />
<PackageVersion Include="CSharpier.Core" Version="1.2.6" />
<PackageVersion
Include="Microsoft.Extensions.DependencyModel"
Version="2.1.0"
/>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
<PackageVersion Include="MsgPack.Cli" Version="0.9.2" />
<PackageVersion Include="MSTest.TestAdapter" Version="1.3.0" />
Expand Down
Loading
Loading