Coding Standards

Basic standards and linting configuration

Besides the language specific standards below, we always include an .editorconfig file in code repositories for easier IDE configuration. Most IDEs either support this by default or need a plugin.

Backend

PHP

Since we depend on WordPress, PHP is the main language we use for backend development.

We follow PSR-12 as a base for coding standards, but with some exceptions and additions. To make it easier to lint our code, either in CI or locally in the IDE, we always include a phpcs.xml.dist file to the root of all of our code repositories.

We also rely on PSR-4 for autoloading.

We use composer for managing dependencies.

Python

Python is also being used for certain use cases. Mainly for scripting and functionality that needs to run in a pipeline. In most cases this is done to avoid writing shell scripts that are harder to read and maintain.

We follow PEP8 as a base for coding standards. We include a setup.cfg file in our code repositories to enable linting.

We use pip for managing dependencies.

Frontend

For all frontend dependencies we use npm package manager and webpack for building and bundling assets for production.

React

Besides using vanilla Javascript, in some cases we also rely on the React framework for most of our frontend work.

We are using ESlint to enforce coding standards that extends WordPress eslint configuration. We include an .eslintrc.json file in our code repositories.

Sass

Besides using vanilla CSS, when the complexity increases we rely on Sass to achieve better readability and maintenance.

We include a .stylelintrc file to enforce linting and certain syntax rules.

Security & Analysis

We use SonarCloud for automated auditing of new code during our Pull Requests pipelines. We also have enabled vulnerability scanning and automated packages security updates on GitHub.

Testing

We use Playwright for “end to end” testing. It’s a Javascript based framework, used also by Wordpress.

Documentation

For technical documentation we use Gitbook. Since the project is open source, the documentation is also publicly available and it’s automatically synced with a code repository.

Last updated