rabbitmq-dotnet-client icon indicating copy to clipboard operation
rabbitmq-dotnet-client copied to clipboard

Consider adding static analysis

Open paulomorgado opened this issue 6 years ago • 8 comments

There are a few analyzers provided by Microsoft: https://github.com/dotnet/roslyn-analyzers

There's also one from Sonar (https://www.nuget.org/packages/SonarAnalyzer.CSharp/) and their platform (https://www.sonarqube.org/).

There's also .editorconfig (https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options). This would enforce style on the code base and would prevent contributors to inadvertently make useless changes to the code.

paulomorgado avatar Sep 08 '18 22:09 paulomorgado

All good ideas but a .editorconfig perhaps should be its own issue.

michaelklishin avatar Sep 09 '18 10:09 michaelklishin

Done! #448

paulomorgado avatar Sep 09 '18 13:09 paulomorgado

#689 resolved the .editorconfig suggestion.

lukebakken avatar Jan 30 '20 00:01 lukebakken

Moving to version 7.0.0. We would appreciate help on implementing the use of a static analyzer.

lukebakken avatar Mar 14 '20 23:03 lukebakken

Challenge accepted :)

stebet avatar Mar 14 '20 23:03 stebet

Codacy is free for open source and is quite capable. It also supports SonarQube's configuration format so it can be committed to source. We use it and are quite happy with it. Someone with administrative rights to this repository can set up analysis by logging in to Codacy and performing a few steps.

If there's anything I can do to help, please holler!

asbjornu avatar Oct 09 '20 19:10 asbjornu

Infersharp may also be a low-hanging fruit worth implementing since it's available as a GitHub Action:

- name: Run C# Code Analyzer      
  uses: microsoft/[email protected]
  id: runcsharpcodeanalyzer
  with:
    binary-path: '<path to the binary directory containing .dlls and .pdbs>'
- name: C# Code Analyzer analysis results
  run: echo "${{ steps.runcsharpcodeanalyzer.outputs.results }}"

asbjornu avatar Oct 14 '20 11:10 asbjornu

I think a good first step is looking at and figuring out which Roslyn analyzers to enable and which to set as warning and error. There are a bunch of new ones coming in .NET 5.0 as well.

stebet avatar Oct 14 '20 11:10 stebet

Please see https://github.com/rabbitmq/rabbitmq-dotnet-client/issues/1269

lukebakken avatar Dec 21 '23 14:12 lukebakken