ReSharper CLI - Inspect not respecting the .NET Naming conventions.

Hi all,

In our team, certain team members have a hard time to handle the warnings, suggestions, ... which are present in Rider / Visual Studio + ReSharper.

For that reason, I'm setting up our CI/CD server to fail a build if there are any issues reported by the IDE.
This is achieved by using JetBrains's CLI Tools.

I have JetBrains.ReSharper.GlobalTools installed.
Here's the content of my dotnet-tools.json file.

{
  "version": 1,
  "isRoot": true,
  "tools": {
    "jetbrains.resharper.globaltools": {
      "version": "2022.3.1",
      "commands": [
        "jb"
      ]
    }
  }
}

I have than a large `.editorconfig` file to configure this tool, and I'm struggling with the .NET Naming conventions.
Here's what I use (these are the only naming rules currently defined in the `.editorconfig` file).

# Naming style: Camel Case (Without prefix).
dotnet_naming_style.camel_case_without_prefix.capitalization = camel_case

# Symbol definition: Fields (private, readonly).
dotnet_naming_symbols.private_readonly_field.applicable_kinds = field
dotnet_naming_symbols.private_readonly_field.applicable_accessibilities = private
dotnet_naming_symbols.private_readonly_field.required_modifiers = readonly

# Naming rule: Fiels (private, readonly) should use "Camel Case (Without prefix)".
dotnet_naming_rule.private_readonly_field_style.symbols = private_readonly_field
dotnet_naming_rule.private_readonly_field_style.style = camel_case_without_prefix
dotnet_naming_rule.private_readonly_field_style.severity = warning
Inside Visual Studio, this is respected.
 
The same is true in Rider, but when I run the following command (to inspect the code using the CLI Tool).
 
dotnet jb inspectcode --build .\Testify.sln -f="sarif" -o="..\Tmp\Analysis\CodeIssues.json" --swea --no-buildin-settings

The resulting file reports an issue that I should use an underscore.

"ruleId": "InconsistentNaming",
        "ruleIndex": 3,
        "message": {
          "text": "Name 'factory' does not match rule 'Instance fields (private)'. Suggested name is '_factory'."
          },
 
Why are the rules regarding naming conventions not respected here?
Here's the structure of the repository.
 
0
1 comment

Hello Kevin Dconinck

Thank you for contacting us! Do you run the tool inside CI/CD on the same machine where VS+ReSharper/Rider is installed? 

Please try to add the following option to the command:

--disable-settings-layers: GlobalAll; GlobalPerProduct; SolutionPersonal; ProjectPersonal
0

Please sign in to leave a comment.