generalimport icon indicating copy to clipboard operation
generalimport copied to clipboard

Linting

Open ZanSara opened this issue 2 years ago • 2 comments

As discussed in https://github.com/ManderaGeneral/generalimport/issues/18, we can consider adding some linting and code formatting facilities to this project. I opened the issue here not to make noise on generalpackager, but feel free to move it there if you deem it suitable.

I'm basing this recommendation on what we have in Haystack and related projects, like Canals. Canals is way simpler and smaller than Haystack, so you can take a look at it to make yourself an idea of what I have in mind :slightly_smiling_face:

  • Code formatting: black
  • Type checking: mypy
  • Linting: pylint

These tools need close to no configuration, but all the config would go in the pyproject.toml file. So I recommend introducing that one first (https://github.com/ManderaGeneral/generalpackager/issues/78).

They could run in the CI and fail if they hit any error. This is an example workflow from Canals running all these three (plus the unit tests): https://github.com/deepset-ai/canals/blob/main/.github/workflows/tests.yml

We also add these same tools in the pre-commit hooks like this: https://github.com/deepset-ai/canals/blob/main/.pre-commit-config.yaml In this way, the CI almost never fails and it can be used to make sure contributors installed the pre-commit hooks.

ZanSara avatar Apr 14 '23 15:04 ZanSara