SonarQube Enterprise Edition: Version 126.96.36.199680
We have a requirement to tweak a Swift rule to allow a specific regex for code smell rules like function names, class names, etc.
We followed the below steps to customize the regex:
- Copy the built-in Sonarway quality profile.
- For the “Function names should comply with a naming convention” rule, update the regex from ^[a-z][a-zA-Z0-9]$ to ^[a-z][a-zA-Z0-9_]$. Added “underscore” to allow it in function names.
- Set this new quality profile as the default.
- Scanned the code again.
- There doesn’t seem to be any difference in the related code smells and it still shows the same number of code smells for this rule. Tried even by creating a new project altogether. However, it is all the same. The updated rule seems to be considered while scanning (I tested this by changing the severity of that rule from minor to blocker and that gets reflected in the scan issues list).
As per the built-in rule, a function with this name is not allowed as it has an underscore: swift_function.
However, for us, this is acceptable.
Is there anything else that needs to be configured?