cake-build / cake

:cake: Cake (C# Make) is a cross platform build automation system.
https://cakebuild.net
MIT License
3.84k stars 722 forks source link

Bug with InspectCodeSettings parsing in InspectCodeRunner on Linux (and probably MacOS) #4292

Open lmb-djaquier opened 4 months ago

lmb-djaquier commented 4 months ago

Prerequisites

Cake runner

Cake Frosting

Cake version

4.0.0

Operating system

Linux, macOS

Operating system architecture

64-Bit

CI Server

Teamcity

What are you seeing?

Parameters are starting with a / (see output logs) . With a / they are not considered as parameters but as paths, so the output of the InspectCode.sh script is the error "Specify only one solution file".

Regarding the sourcecode of the runner, that bug impacts all parameters, except --no-build

What is expected?

Parameters must start with a - or -- (like already implemented for the --no-build parameter but not the others) on Linux and MacOS operating systems

Steps to Reproduce

Configure your inspectcode in cake with some parameters that way:

context.InspectCode(context.PathToSolution, new InspectCodeSettings
{
    OutputFile = "output.json",
    Debug = true,
    Build = false,
    SolutionWideAnalysis = false,
    Severity = InspectCodeSeverity.Warning,
    Verbosity = InspectCodeVerbosity.Trace
}
.WithToolPath("<toolpath>/JetBrains.ReSharper.CommandLineTools.2023.3.3/tools/inspectcode.sh")
);

To make it work, currently i used that workaround:

context.InspectCode(context.PathToSolution, new InspectCodeSettings
{
    Build = false,
    ArgumentCustomization = args => args.Append("--swea --severity=WARNING --output=output.json"),
}
.WithToolPath("<toolpath>/JetBrains.ReSharper.CommandLineTools.2023.3.3/tools/inspectcode.sh")
);

Output log

teamcity[blockOpened name='Code Inspection']

Executing: /source/solution/build/tools/JetBrains.ReSharper.CommandLineTools.2023.3.3/tools/inspectcode.sh "/output:/source/solution/output/reports/inspectCode.xml" /debug "/verbosity=TRACE" "/severity=WARNING" --no-build "/source/solution/Jsnow.sln" JetBrains Inspect Code 2023.3.3 Running on x64 OS in x64 architecture, .NET 8.0.2 under Ubuntu 22.04.3 LTS Specify only one solution file Usage: inspectcode [options] [solution or project file] Show help: inspectcode --help An error occurred when executing task 'App.CodeInspection'. Error: InspectCode: Process returned an error (exit code 1).