cake-build / cake-build/cake

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

Open
#4,292 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.2k
Forks
778
Avg merge
1h 15m
Merged PRs (30d)
19

Description

### Prerequisites

- [X] I have written a descriptive issue title
- [X] I have searched [issues](https://github.com/cake-build/cake/issues) to ensure it has not already been reported

### 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](https://github.com/cake-build/cake/blob/911a2f4ed8ba36a6a63758564956883f884bcc33/src/Cake.Common/Tools/InspectCode/InspectCodeRunner.cs#L213), 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("/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("/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).

Contributor guide

Open the contributing guide

Research direction

Start at src/Cake.Common/Tools/InspectCode/InspectCodeRunner.cs around line 213 and reproduce the issue with the provided InspectCodeSettings and InspectCode.sh invocation on Linux or macOS. Compare the generated arguments with the expected InspectCode command-line syntax; done means the listed settings are accepted without the workaround and the inspection runs successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.