Selectively suppressing checks

Hi

I’m using sonar with python/terraform projects

what are the thoughts on being able to selectively suppress rules, via comments in the code, e.g.
# tfsec:disable:xxxx
# pylint: disable=xxx
# type: ignore[xxx]

this is a really common pattern for linting tools, and allows for the suppression to be maintained with the code.

In particular we have been finding the duplicate checking somewhat overbearing, sometimes what ‘looks’ like the same code may be duplicated, but is actually similar ‘scaffolding’, but not actually the same code something that should be (or needs) a abstract base class factory pattern to avoid ever repeating a line of code.

Hey there.

To be clear – are issues being raised on the duplicate code, or is the code being marked as “duplicate code”. Maybe a screenshot would help.

Hi … in this instance the code is being marked as ‘duplicate code’ , but really this is a more general request for ‘selective rule suppression’

Sonar is good, but not always right :), sometimes a team will need to make a knowing duplication ( or other compromise ) and being able to suppress a specific rule in code will make this very visible ( and then tech debt tickets can be created to resolve )