Clean as You Code in the IDE
What is Clean as You Code?
Clean as You Code is an approach to code quality that eliminates many of the challenges that come with traditional methodologies. As a developer, you focus on maintaining high standards and taking responsibility specifically in the new code you're working on. More information about the Clean as You Code approach is available for download.
SonarLint, working in Connected Mode with SonarQube or SonarCloud, gives you the tools to set high standards and take pride in knowing that your code meets those standards.
Focus on new code
With Clean as You Code, your focus is always on new code (code that has been added or changed according to your new code definition). You are responsible for making sure the code you write today is clean and safe.
Check the SonarQube or SonarCloud documentation to learn how to set your new code definition.
Pull request analysis
You can use pull request analysis and pull request decoration to make sure that your code meets your standards before merging. Pull request analysis lets you see your pull request's quality gate in the SonarQube or SonarCloud UI. You can then display the number of issues detected directly in your DevOps platform's interface.
For more information on setting up pull request analysis and pull request decoration, see the SonarQube and SonarCloud documentation on pull request analysis.
Quality gate
Your Sonar Quality Gate is a set of conditions that tells you whether or not your project is ready for release. With the Clean as You Code approach, your quality gate should:
- Focus on new code metrics – When your quality gate is set to focus on new code metrics (like the built-in Sonar way quality gate), new features will be delivered cleanly. As long as your quality gate is green, your releases will continue to improve.
- Set and enforce high standards – When standards are set and enforced on new code, you aren't worried about having to meet those standards in old code and having to clean up someone else's code. You can take pride in meeting high standards in your code. If a project doesn't meet these high standards, it won't pass the quality gate, and is therefore not ready to be released.
- Be a reliable measure of code quality - When you consistently have a passing quality gate, you have a clear indication that developers can maintain high standards on all new code.
For information about using quality gates to make sure it enforces your standards, check out the SonarQube and SonarCloud pages about quality gates.
Was this page helpful?