LGTM (LGTM dot com) is a platform that provides useful insights and code quality information for all sorts of people participating in software development.
- Use open source libraries and frameworks in private projects and want to know how well they’re being maintained
- Contribute to open source repositories and want to find out about the quality of the code you contribute
- Own or administer a public Git repository and want to integrate code quality analysis into your pull request review workflow
- Want to join the debate on how to define good quality code
LGTM is a cloud app service so you will need to create an account first. Go head to their website https://lgtm.com and sign up for a free account.
LGTM supports fetching the projects from Github and Bitbucket. At the Dashboard page, provide the full url to your code repository.
After submiting the url, LGMT will fetch your project and analyze the code on the default branch. Depends on the size of your project, it might take time to show the complete result.
Once LGTM has done the analysis it will show you alerts with code issues in detail and give the suggestion to fix them. You can fix the code issues by solving the alerts and update your upstream repository then LGTM will following the new changes and do the analysis again.
If your git repository has many contributors, you might have to review several pull requests again and again. It is a great idea to have LGTM do apart of reviewing job for you.
To integrate you git repository with LGTM, go to Integrations tab in your project page and enable the Pull Requests integration. This action requires you to allow LGTM app access to your Github / Bitbucket repository.
Once you integrated your repository with LGTM, it will automatically keep an eye on your project’s pull requests. Every new commit will be analyzed. You would see the check status like this
I used LGTM to analyze my github project - PowerDNS-Admin. Following is the code quality ranking before and after fixing the alerts.