BlogsShopifyCode Style Enforcement and Management

Code Style Enforcement and Management

Code Style Enforcement and Management

1
posts
2017

This post details the evolution of code style consistency at Shopify, starting with the introduction of RuboCop and the development of Policial, a tool to enforce these standards on pull requests. It covers the challenges of managing a large, decade-old codebase, the iterative improvements to Policial (including using GitHub's commit status API), and strategies for fixing existing violations and preventing future ones by integrating RuboCop into CI pipelines. The goal is to achieve full compliance with the Shopify Ruby style guide.

2017

Code Style Consistency for Shopify’s Decade-Old Codebase - Shopify

9/22/2017

Introduced Policial, a wrapper around RuboCop, to enforce code style on pull requests via GitHub webhooks. Improved Policial by integrating with GitHub's commit status API to provide a single status indicator instead of multiple comments. Developed strategies to fix existing code style violations in a large codebase, including using a bot to differentiate bot-generated changes from human changes in Git history. Enforced RuboCop in CI (BuildKite) to fail builds on code style violations, preventing new violations.