Install Free
Visual Studio | Core concepts | New code

Was this page helpful?

New code

On this page

New code in the context of Clean as You Code

Focusing on new code is an important step in getting the most out of SonarLint. When you run an analysis on your main branch (or other long-lived branches) in SonarQube or SonarCloud, SonarLint uses the New Code Definition (NCD) to determine which issues you should focus on fixing, and calls out that these issues are found in new code. Focusing on new code is at the core of implementing the Clean as You Code strategy, knowing that the other code will be incrementally fixed over time.

Your new code definition

When SonarLint is running in Connected Mode, the SonarLint uses the NCD defined in SonarQube or on SonarCloud. Running SonarLint in Connected Mode with SonarQube or SonarCloud offers more opportunities to choose how you define new code.

New code definition options

When running SonarLint for Visual Studio in Connected Mode, SonarLint uses the NCD found in the SonarQube or SonarCloud quality profile, which gives you more opportunities to choose how you define new code. Check out their respective pages for details.

How the new code definition affects the analysis results

The core idea of Clean as You Code is that you focus your attention and effort on new code (code that has been added or modified recently) and improve your code incrementally. SonarQube and SonarCloud use your NCD as a baseline for code comparison, to identify what is new code which reinforces the Clean as You Code strategy by only showing you issues found in new code.

© 2008-2024 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARLINT, SONARQUBE, SONARCLOUD, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License