dotnet / dotnet/roslynator

Roslynator commandLine can't catch the analysis of 'Microsoft.CodeAnalysis.CSharp.NetAnalyzers'

Open
#854 16 comments 0 reactions 0 assignees View on GitHub
Area-CLI
Dominant language
C#
Stars
3.5k
Forks
294
Avg merge
2h 30m
Merged PRs (30d)
4

Description

First, Thanks to the great Roslynator project.
I try to analyze and fix both `Roslynators` and external analyzers like `Microsoft.CodeAnalysis.CSharp.NetAnalyzers` using Roslynator commandline tool v 0.2.0 for a project net472

in visual studio 2019, I get the next analysis warning
```
Warning CA1014 Mark assemblies with CLSCompliant
Warning RCS1012 Use explicit type instead of 'var'.
Warning RCS1012 Use explicit type instead of 'var'.
Message IDE1006 Naming rule violation: Prefix '_' is not expected
Message RCS1163 Unused parameter 'args'.
Message IDE0060 Remove unused parameter 'args'
Message RCS1118 Mark local variable as const.
Message IDE0059 Unnecessary assignment of a value to 'yy'
```
I get the path of the MS analyzers used in vs 2019 to pass them to the commandline:
```
C:\Program Files\dotnet\sdk\5.0.402\Sdks\Microsoft.NET.Sdk\targets\..\analyzers\Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll
C:\Program Files\dotnet\sdk\5.0.402\Sdks\Microsoft.NET.Sdk\targets\..\analyzers\Microsoft.CodeAnalysis.NetAnalyzers.dll
```

Then run the commandline:

```
set ms="C:\Program Files\dotnet\sdk\5.0.402\Sdks\Microsoft.NET.Sdk\targets\..\analyzers\"

Roslynator analyze %project% -v diagnostic -p CodeAnalysisRuleSet=%rule% --file-log %log% --file-log-verbosity diag --analyzer-assemblies %ms%
```
Roslynator can't catch IDExxxx, CAxxxx of Ms analyzers
The same result for the project net50

The log is attached
[logs.log](https://github.com/JosefPihrt/Roslynator/files/7356647/logs.log)

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the shown Roslynator analyze command for the net472 or net50 project with the Microsoft.CodeAnalysis analyzer assemblies, then inspect the attached logs.log output. Done means Roslynator captures the IDE and CA diagnostics that Visual Studio reports.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.