BOPS enforces consistent code style through automated linting. All code must pass CI checks before merging.
- Linter: StandardRB (via RuboCop)
- Magic comment: Add
# frozen_string_literal: trueto all Ruby files
- Linter: Biome
- Indentation: 2 spaces
- Semicolons: Only as needed (ASI-safe)
- Linter: ERB Lint
- Framework: Follow GOV.UK Design System patterns
BOPS has a custom RuboCop cop that enforces GOV.UK-specific link helpers:
# Bad - generic Rails helper with GOV.UK classes
link_to "View application", application_path, class: "govuk-link"
# Good - use GOV.UK helpers
govuk_link_to "View application", application_path
# Bad
link_to "Submit", submit_path, class: "govuk-button"
# Good
govuk_button_link_to "Submit", submit_path- Shared components:
engines/bops_core/app/components/- reusable across all engines - Engine-specific components:
engines/<engine>/app/components/- for that engine only
Only create new components when the GOV.UK Design System library doesn't meet your needs.
Before creating a component:
- Check if GOV.UK components or helpers already solve the problem
- Discuss with the team if uncertain - not all existing components are good patterns to follow
When creating components:
- Components must be accessible by design
- Include specs alongside the component
Use the GOV.UK Ruby on Rails Form Builder gem for form markup. See app/views/users/_form.html.erb for a simple example.
# All linters
make lint
# Auto-fix where possible
make lint-auto-correct- Brakeman: Static analysis for security vulnerabilities runs in CI
- Security issues are blockers and must be resolved before merge