Modify or Customize max allowed characters per line in rule cppS103

We use QT framework (cpp based) in our project development, which requires max characters per line up to 110 as per framework syntax and strategies, but sonar checks throwing error when max character exceeds more than 80 as per rule. ccp:S103, Please check following details and share your recommendation on how to fix it?

  • What language are you writing rules for?
    C++
  • What have you tried, and what’s your challenge / stumbling block
    I’m trying to enable the number of characters allowed per line up to 125 instead 80 as per cpp rule cpp:S103 (Lines should not be too long)
    Please suggest below,
    a. Can I modify the exiting rule?
    b. How to create and import a custom rule into our existing quality profile in SonarQube server.

NOTE: SonarQube version : Enterprise EditionVersion 9.9.1 LTS

Hello @Ajaykumar

Welcome to our community.
cpp:S103 is a parametrized rule. The maximum length of a line is a parameter you can set.
You can see how to do that there.

I hope it helps.

2 Likes

I appreciate your help, Geoffray. Thank you.