Different profiles for fresh and old Code


(Philip Hunsicker) #1

I would like to use different profiles on the same Project.One for new written code and one for old, untouched code. To reduce the findings for old code to the important Smell ,and still Keep a Strict Profile for new code. Similar to the Analyse to Committed Code. But without ignoring old code.

(Roger Larsson) #2

Not only: New v. Old
Also split in: Type, Severity, …

Is it possible to take this one step further and use the projects defined Quality Gate?

Right now when commiting (with code analysis) SonarLint complains about all issues.
It should complain louder about potential Gate breakage…

(G Ann Campbell) #3


Sorry we missed the initial message. If you’re asking for different Quality Profiles for old projects versus new, that’s certainly a possibility although we don’t recommend it. Instead, you should be Fixing the Leak, i.e. applying the same rules across the board, but only chasing down issues raised on added or updated code.

On the same theme, your Quality Gate should also be focused on New Code, then you have no problem with the issues raised on old code; you’re only required to keep new issues cleaned up to be able to release.


(Roger Larsson) #4

When running SonarLint in IntelliJ

Making a change - adding text in a comment

Commit Changes
with Perform SonarLint analysis


Commit and push
Sonar Lint Analysis Results
SonarLint analysis on 1 file found 22 issues
Review Issues    Commit Anyway   Close

None of those 22 issues was because of my changes…
If it had read 23 instead it could have been an Major added by me - no way to tell…

(Philip Hunsicker) #5


Thanks for your time.

The idea was to focus on the new problems, it was my lack of understanding of the leak period and Quality gates that brought me to the idea of 2 profiles for new and old projects and there is no necessary need for it. (Sorry for not reading that through before creating my topic)

For the “Analyse VCS Changes wih Sonarlint”. I tried it out. And it founded the added smell and all smells on the same file. It looks that Sonarlint only difference between changed files and not lines. It would be nice to have only the smells on the lines I changed but its not a core function I need.

Sincerely Philip Hunsicker