5 minute read Over the course of Shopify's 13-year codebase history, the core platform has never been rewritten. That meant a slew of outdated code styles, piling atop of one another and without a lot of consistency. By 2012, our CEO Tobi created a draft Ruby style guide to keep up with the growth. Unfortunately, it never became embedded in our programming culture and many people didn't even know it existed.
Overview
The article discusses the challenges of maintaining code style consistency in Shopify's decade-old Ruby codebase and the solutions implemented to address these issues. It highlights the introduction of Policial, a tool built around RuboCop, and the development of a comprehensive Ruby style guide to improve code quality and developer experience.
What You'll Learn
How to implement a linter for Ruby code using Policial
Why maintaining code style consistency is crucial for large codebases
When to use commit status API for code quality checks
Prerequisites & Requirements
- Understanding of Ruby programming and code style guidelines
- Familiarity with GitHub and its webhooks(optional)
Key Questions Answered
What is Policial and how does it improve code style consistency?
How did Shopify address the challenges of an outdated codebase?
What were the results of the survey conducted after implementing Policial?
What strategies were used to fix existing code style violations?
Key Statistics & Figures
Technologies & Tools
Some links below are affiliate links. We may earn a commission if you make a purchase.
Key Actionable Insights
1Engage developers early in the process of implementing code style tools like Policial.Involving developers from the beginning helps address their concerns and improves adoption rates, as seen when teams expressed their initial dissatisfaction with Policial's noise.
2Utilize commit status API to enhance pull request feedback without overwhelming developers.This approach minimizes noise by providing a clear pass/fail status, which encourages developers to focus on critical issues rather than being distracted by excessive comments.
3Plan strategically for fixing existing code style violations to avoid disruption.By scheduling fixes during downtime, Shopify was able to implement necessary changes without affecting ongoing development, demonstrating the importance of timing in such initiatives.