DiamondLightSource / httomo

High-throughput tomography pipeline
https://diamondlightsource.github.io/httomo/
Other
7 stars 4 forks source link

Inconsistent docstring format across codebase #499

Open yousefmoazzam opened 1 month ago

yousefmoazzam commented 1 month ago

Some docstrings use the google convention: https://github.com/DiamondLightSource/httomo/blob/8a55c4dc62aae97d9d7f4d264602a2cfa96cd23e/httomo/methods.py#L20-L30

whereas other docstrings use the numpy convention: https://github.com/DiamondLightSource/httomo/blob/8a55c4dc62aae97d9d7f4d264602a2cfa96cd23e/httomo/method_wrappers/__init__.py#L20-L58

Picking one convention and sticking with it feels better than having docstrings of various appearances in the source code.

yousefmoazzam commented 1 month ago

If we do decide to pick one convention to stick with, whatever convention is chosen, the tool ruff (which can be used as a formatter and/or a linter) can be configured to lint the code and check docstrings and ensure the chosen convention is adhered to.

The way ruff can be used is that it has reimplemented various python code quality checks (see the full list in: https://github.com/astral-sh/ruff?tab=readme-ov-file#rules), one of which is flake8-docstrings, which can be used to check that python docstrings adhere to a particular docstring convention.

Thus, ruff can be used to lint the code (in PR's for example) and check if the docstrings in the code adhere to the chosen docstring convention.