C# Rule S6669 ignoring changes to regex format

We are running SonarQube Community Build v24.12.0.100206 and are experiencing the exact same problem as described in https://community.sonarsource.com/t/c-rule-s6669-ignoring-changes-to-regex-format (Create a new issue here just according to the FAQ!)

We have a custom Quality Profile for C# which works great except for rule S6669. The parameter we want to have is ^m?Logger$ but analysis keeps showing code rules violations: Rename this field 'mLogger' to match the regular expression '^_?[Ll]og(ger)?$'.

Is anyone using a customized S6669 rule succesfully?

Hi,

Welcome to the community and thanks for following directions! :smiley:

I assume you mean this thread. Your link just comes back to your own post.

For clarity, are there other rules where you’ve customized parameters and the new values are used?

 
Thx,
Ann

Hi @SonarWelcome

We’re investigating the mentioned issue and we will get back to you soon.

Regards,
Ismail

Hello @SonarWelcome

Would you be able to perform the following actions, to investigate the issue:

  1. Login into your SonarQube Server instance
  2. Open the URL: <your SQ server>/api/qualityprofiles/search?project=<your project key>&language=cs This should give you the uuid of the quality profile associated to your project.
  3. Open the URL: <your SQ server>/api/rules/list?qprofile=<the quality profile uuid from step 2>&language=cs

You should get a JSON response, please look for the rule csharpsquid:S6669 in the actives section.

On my side, this is what I get:

  "actives": {
    [...]
    "csharpsquid:S6669": [
      {
        "qProfile": "2f560f8e-c7d0-4ae3-a0e7-7a862cbf8160",
        "inherit": "OVERRIDES",
        "severity": "MINOR",
        "params": [
          {
            "key": "format",
            "value": "^m?Logger$"
          }
        ],
        "createdAt": "2025-02-14T15:17:49+0100",
        "updatedAt": "2025-02-14T15:18:14+0100",
        "prioritizedRule": false,
        "impacts": [
          {
            "softwareQuality": "MAINTAINABILITY",
            "severity": "LOW"
          }
        ]
      }
    ],
  }

so I can confirm the change of the parameter has been taken into account (at least on the server side).

Please do the same and let us know.

1 Like

Hello!

We tried to update this C# rule today and the error is still the same. The overridden regex is ignored. All other custom rules with overridden values work correctly.

When I call the API endpoints to get list of rules, csharpsquid:S6669 appears twice. The default value comes first and then our overridden value.

Could that be a problem?

We are using SonarQube Developer Edition v2026.1 (119033)

Hi @matthias.reiseder,

Definitely. Can you force an ElasticSearch reindex and see if the problem is still replicable?

 
Thx,
Ann

Forcing the reindex did not help unfortunately.

This is what the API request returned. Our profile is based on the default Sonar Way profile.

{
  "rules": [
    ...
    {
      "key": "csharpsquid:S6669",
      "repo": "csharpsquid",
      "name": "Logger field or property name should comply with a naming convention",
      "createdAt": "2024-04-19T08:23:59+0000",
      "severity": "MINOR",
      "lang": "cs",
      "langName": "C#",
      "params": [
        {
          "key": "format",
          "htmlDesc": "Regular expression used to check the field or property names against",
          "defaultValue": "^_?[Ll]og(ger)?$",
          "type": "STRING"
        }
      ],
      "type": "CODE_SMELL",
      "updatedAt": "2024-12-13T12:32:20+0000",
      "impacts": [
        {
          "softwareQuality": "MAINTAINABILITY",
          "severity": "LOW"
        }
      ]
    },
    ...
  ],
  "actives": {
    ...
    "csharpsquid:S6669": [
      {
        "qProfile": "cbb68c0c-f257-497d-b7ce-3a82c5797f0c",
        "inherit": "OVERRIDES",
        "severity": "MINOR",
        "params": [
          {
            "key": "format",
            "value": "^s?_?[Ll]og(ger)?$"
          }
        ],
        "createdAt": "2024-10-09T08:45:02+0000",
        "updatedAt": "2026-03-19T14:51:48+0000",
        "prioritizedRule": false,
        "impacts": [
          {
            "softwareQuality": "MAINTAINABILITY",
            "severity": "LOW"
          }
        ]
      }
    ],
    ...
  },
  ...
}

Hi,

Does this mean a copy or inheritance?

 
Thx,
Ann

Inherited

Hi,

Thanks for that detail. I’ve flagged this for the team.

 
Ann