False Positive for cpp:S1172

Here is the code that generates the false positive:

constexpr char AUTHCODE_ACCURACYLEVEL_OPTION_RTK = 'R';

    auto receiverModelHasRTKAccuracy = [](const std::string &modelString) {
        return modelString[ConstantsNovatel::AUTHCODE_ACCURACYLEVEL_OPTION_INDICATOR] ==
               ConstantsNovatel::AUTHCODE_ACCURACYLEVEL_OPTION_RTK;
    };

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube Server / Community Build, Scanner, Plugin, and any relevant extension)
  • how is SonarQube deployed: zip, Docker, Helm
  • what are you trying to achieve
  • what have you tried so far to achieve this

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Hi,

Welcome to the community!

What version of SonarQube are you seeing this in?

 
Thx,
Ann

How can I tell what version of SonarQube I am using?

Hi,

It’s in your page footer.

 
HTH,
Ann

1 Like

With the example code I submitted, SonarQube is saying that modelString is an unused parameter. It is being used.

  • Enterprise Edition
  • Version 7.9.6 (build 41879)

Hi,

Your version is way past EOL. You should upgrade to either the latest version or the current LTA (long-term active version) at your earliest convenience. Your upgrade path is:

7.9.6 β†’ 8.9.10 β†’ 9.9.9 β†’ 2025.1.1

You may find these resources helpful:

If you have questions about upgrading, feel free to open a new thread for that here.

If you can still reproduce this after you upgrade, we’d love to hear about it!

 
Thx,
Ann