Ignore duplicate scss and typescript code blocks

I have scss and testing(spec.ts) files in Angular project , that need to narrow focus on sonarcloud scanning.
So I want to ignore some duplicated codes and currently using below process.
It seems not working. I only wrap one duplicate code. Should I use it for both duplicates ?


scss code  


Can you provide correct way to solve this with example, for both scss and ts file.

Welcome to the community!

I don’t think it’s possible to ignore duplications in selected blocks of code. On the same settings page, there is a Duplication Exclusions where you can define entire files to exclude from duplications processing. I don’t think it’s possible at a more granular level than that.

Should I include another file in angular project to configure sonar or enough change settings on Duplication Exclusion in website. If I declare like eg: //NOSONAR , should I have to put all duplicate lines.
code 1 //NOSONAR

code 2 //NOSONAR

Is this approach correct ? I didnt clear earlier answer.
Thank you.

The only way to ignore duplications is by using the Duplication Exclusion section of the settings. This settings requires filename patterns. There is no way to select parts of files, only entire files.