Introduction
Fix issues before they exist : SonarLint is a free IDE extension that helps you detect and fix bugs and vulnerabilities as you write code. Like a spell checker, SonarLint highlights coding issues so that they can be fixed before committing code.
Why we need SonarLint
When we write code, There are many opportunities to make mistakes without conscious. SonarLint will help you to spot the bug and provide the detailed information about that and also provides the solution for fixing it.
- It's like your personal code reviewer that helps you to write better and safer code.
- SonarLint can analyze code written in Java, JavaScript, TypeScript, Python, Kotlin, Ruby, HTML & PHP.
- At the time of writing this blog, SonarLint is available for Eclipse, Intellij Idea, VS code, Visual Studio.
Installing SonarLint in Eclipse
- Select Help -> Eclipse MarketPlace
- Search for SonarLint in the appeared popup.
- Click install and restart the IDE while eclipse asks to restart.
- Once restarted, right click on your project. A new context menu "SonarLint" will appear.
- Choose SonarLint -> Analyse and it will start to analyse your project.
- Once scanning completed, all the issues in the project will be displayed in the "SonarLint Report" view.
- As well as, bug will be highlighted in the code to identify the issue easily
Installing SonarLint in Intellij Idea
- Select File -> Settings -> Plugins
- Search SonarLint in the plugin search.
- Click install and restart the IDE if required.
- Once restarted, right click on your project. A new context menu "SonarLint" will appear.
- Choose SonarLint -> Analyse with SonarLint and it will start to analyse your project.
- Once scanning completed, all the issues in the project will be displayed in the SonarLint view.
- As well as, It will highlight the issues to identify and solve them easily.
Installing SonarLint in VS Code
- Select Extensions -> Search for SonarLint
- Install the extension and restart if required.
- Now bugs will be highlighted in your code.
Happy Coding!