At LiteBreeze, we give paramount importance to consistent code quality. This is also our primary criteria when we select the top 1% of PHP candidates to join our team. We understand that some candidates might have queries on how we maintain our high code quality.
We believe that a well structured and neatly written code has the two-sided advantage of readability and maintainability and can be developed to become a habit.
To ensure code quality, LiteBreeze team follows a three-tier strategy.
- Static code analysis
- Peer reviews
- Reviews by Senior/Lead developers
Let’s see how each strategy works in detail.
1. Static code analysis
Static code analyzers examine the code without executing it and identify the technical defects and the extent to which the code adheres to accepted coding standards. At LiteBreeze we use SonarQube to analyze the quality of the code. SonarQube validates the code against the PHP FIG guidelines using the built-in quality profiles and quality gates.
The Sonarqube analysis gives the developers an insight to various matrices like vulnerabilities, code smells and duplications in code. In addition to this, we use IDE’s that support SonarQube’s plugins that provide on-the-fly feedback to the developers. The static code analysis reduces the overhead at further stages of code reviews explained below.
2. Peer reviews.
We use Git for versioning our projects and use Bitbucket to manage our remote repositories. The projects follow a feature based branching strategy in Git and developers commit their code to Bitbucket at the end of each day. When we complete a feature in a project, the branch corresponding to that feature will be merged to the development branch through pull requests in Bitbucket.
The pull requests will have the other developers as the reviewers, and it will be merged into the dev branch only if the reviewers approve the pull request by checking the commits. If something needs to be changed, then the corresponding developers will be notified through Bitbucket comments by the reviewers.
3. Reviews by Senior/Lead developers
Most of the common coding mistakes will be filtered out and fixed before this stage. In this stage, the senior/lead developers will analyze the code and provide high-level feedback related to design patterns and best practices to the junior developers. This encourages the junior developers to approach a similar problem in future in a more efficient manner while constantly improving their code standards.
1. The analysis screenshot is for indicative purpose
2. Image courtesy of www.xkcd.com