Jump to content

Wikimedia Cloud Services team/Coding

From Wikitech

We write a lot of code, so it seems like that would be the place to introduce some common practices for the WMCS team. In the interest of clean, readable code across the team, it is common practice by development groups to share formatting and other development practices in order to facilitate collaboration. A common example is shared linter settings, like what is used in operations/puppet for puppet-lint.

This is intended as Team Practices, not an overall standard, variations and other settings might exist in our codebases and that's ok.

We usually prefer keeping the defaults of the tools we use relying on specific configurations only for special cases.

For an up ta date set of configurations/tools, see the example repos (and for easy copy-pasting!), here's some common tools used at the time of writing this are:

All

Example repo: https://gitlab.wikimedia.org/repos/cloud/toolforge/jobs-api

  • pre-commit to run linters/static checkers/code formatters (see example code repo for the list).

Shell scripts

Example repo: https://gitlab.wikimedia.org/repos/cloud/toolforge/builds-api

  • pre-commit shellcheck

Python

Example repo: https://gitlab.wikimedia.org/repos/cloud/toolforge/jobs-api

  • tox to run pre-commit + tests
  • pre-commit mypy check
  • black+isort+flake8 / ruff

Golang

Example repo: https://gitlab.wikimedia.org/repos/cloud/toolforge/builds-api

  • blubber test image variation runing go test
  • pre-commit golangci-lint check

Other guidance

The movement has mw:Manual:Coding conventions/Python which provides some additional guidance for python specific coding.