Baseline Coding Standards
Baseline coding standards for OPG that teams can customise and adapt to their needs, starting from a common point
Standards
- Code should conform to recognised style guides or standards, and take advantage of automatic style checkers, linters, and static analysis tools
- Project structures should follow the conventions of the language and frameworks used
- Favour clear variable and function names over acronyms, abbreviations and explanations in comments (and don’t assume technical and business domain knowledge)
- Favour open standards over proprietary or customised ones
- Any information or user interactable parts of the system must be Accessible
Code should be:
- Readable
- Correct, clear, and concise - in that order
- Tested, automatically and with easily visible measures of what is covered
- Secure, and make use of automated tools like dependency scanners
- Maintained; addressing emerging user feedback, with libraries and kept up to date, and agreed pattern changes applied consistently across the application
- Observable, with adequate logging, tracing, metrics and alerts. To understand the state of the system, be aware of issues, and see the impact of changes
- Commented where it aids understanding and good naming cannot solve this
- Appropriately performant and scalable
- Documented (with clarity on what documentation goes where and adequate signposting - see the repo guide for more details)
- Open by default (With the MoJ Copyright version of the MIT Licence)
Useful links
- GDS Service Standard
- MOJ Technical Guidance
- WCAG AA standards for websites
- Document accessibility
- PDF accessibility
This page was last reviewed on 14 October 2024.
It needs to be reviewed again on 14 October 2025
by the page owner #opg-developers
.
This page was set to be reviewed before 14 October 2025
by the page owner #opg-developers.
This might mean the content is out of date.