Like modern software development, improving code quality is a collaborative effort – and collaborations need teams.
Each person committing code to your project has the ability to improve, or reduce, the quality of your codebase. With the right information, team members can make better decisions with every commit, adding up to a significant impact on the long-term health of your code.
Consider starting with one repository or team before applying Code Climate across all of your repos and organization. Teams with members particularly interested in quality analysis are a great place to start.
Starting small affords the opportunity to establish a rock solid code quality workflow in one team. Our most successful customers have found that once Code Climate is incorporated into one team’s workflow, other teams see the benefit and soon follow suit, allowing the process and improved code quality to spread organically throughout the organization.
Start by discussing with your team what you hope to achieve by adopting a tool like Code Climate. Code Climate offers a wealth of analysis, and can help identify many different areas for code quality improvement, but it will be most effective if there’s a shared understanding and agreement about what you’re trying to achieve.
Sometimes it’s better to start with more modest goals while first integrating the tool into your workflow, and then expanding the scope.
Some example goals might include:
- Improve test coverage on our primary repository by 10% (or from a D to a C)
- Improve repository's maintainability grade from a D to a C
- Increase ratio of time spent adding substantive comments (vs comments about style)
Before performing any kind of integration, walk through Quality with your team to familiarize them with the workflow and how you intend to leverage it. Show them an (already opened) pull request with test coverage and maintainability issues reported by Code Climate, how to view the test coverage of a pull request using the browser extension, and how to mark issues as false positives.
Before making any changes to your workflow, ensure you communicate with your team about when you intend to turn on integrations and what they should expect to see. This can be communicated at the end of a team walk-through, or separately over email or chat.
Code Climate provides a variety of ways to invite your team, including a link that can be shared in a group chat room or individual invites.
At the agreed upon time, add Code Climate to your team's workflow.
Check in with the team at regular intervals after turning on Code Climate – we recommend at 1 day, 1 week, and 2 weeks to start. Ask questions like:
- Are the checks tuned how you expect?
- What did our code look like at the beginning of this period? What does it look like at the end?
- Did Code Climate guide our development throughout this period?
- Did we meet our quality and style goals for this period?
Use the answers to tune your analysis (by configuring plugins and/or checks) and inform your code review process
At first, don't focus too much on your overall project score or improving legacy code. Instead, focus on the quality of code that is added or modified from this point forward. There are just two guidelines you need to keep in mind to observe your code quality improving, your communication getting easier, and your results coming faster:
- Leave code better than you found it
- Don’t introduce new files that aren’t up to quality standards
When your team focuses on the impact of every proposed change, your project will improve with every commit.
Over time your codebase will become healthier, making it easier to change, more fun to work with, and your features will be easier to implement. As a result your code will be more reliable when it runs, bringing benefits to your business. Enjoy!
Updated 9 months ago