belav / csharpier

CSharpier is an opinionated code formatter for c#.
https://csharpier.com
MIT License
1.41k stars 98 forks source link

csharpier as msbuild dependency doesn't fail the github action anymore #1357

Open OneCyrus opened 1 month ago

OneCyrus commented 1 month ago

Environments:

Steps to reproduce:

dotnet build --configuration Release /p:CSharpier_LogLevel=Error

Expected behavior:

we are running csharpier as msbuild dependency and want the build to fail of the code is not formatted. it used to work before but currently even when an error is detected the build succeeds and the github action workflow doesn't fail.

formatting error is detected correctly:

Error /home/runner/work/automation-data/automation-data/Poseidon/Poseidon/GqlSchema/ITSM/Itsm.cs - Was not formatted.
    ----------------------------- Expected: Around Line 1 -----------------------------
    using System.Linq.Expressions;
    using System.Reflection;
    ----------------------------- Actual: Around Line 1 -----------------------------
    using Aveniq.Poseidon.GqlSchema.CMDB;
    using Aveniq.Poseidon.GqlSchema.SMDB;

build fails:

Build failed.

    0 Warning(s)
    1 Error(s)

Actual behavior:

build succeeds and the exit code doesn't fail the github action job.

Build succeeded.

    0 Warning(s)
    0 Error(s)
OneCyrus commented 1 month ago

this started to happen with 0.29.0. probably the issue is here:

https://github.com/belav/csharpier/blob/5d73fe3f9aea7ea9e47858177d44b9ff76683b0a/Src/CSharpier.MsBuild/build/CSharpier.MsBuild.targets#L26