Rasterio: PROPOSAL: Code linting?

Created on 12 Jul 2020  ·  4Comments  ·  Source: mapbox/rasterio

What are the current thoughts on adding code linter support?

Here are some potentially useful ones:

  • black - really nice because it forces all programmers on the project to use the same code style regardless of our individual preferences

    • Unfortunately, doesn't work with cython yet (https://github.com/psf/black/issues/359), but still nice to have for the regular python part of the codebase.

  • isort

    • Example .isort.cfg.

    • Version 5.0 works with cython.

  • flake8

They can be used along with pre-commit so the checks are run with each commit and can work as an as-you-go type thing. Or you can run pre-commit run --all-files.

  • Example .pre-commit-config.yaml.
  • It is an opt-in thing. You have to do pip install pre-commit & pre-commit install for it to be enabled.

Most helpful comment

@snowman2 @vincentsarago would you be okay with waiting until after 1.2.0? I don't want anything getting in the way of a new minor release.

I've been using darker on my recent commits, so we're getting there if slowly.

All 4 comments

👍 and if we ever drop python2 I'll add mypy (type) to the list!

@sgillies would you be in opposed to a PR with the linting & pre-commit config files?

IMO we should do this at the same time as https://github.com/mapbox/rasterio/issues/1774 so we can add types 🤷‍♂️

@snowman2 @vincentsarago would you be okay with waiting until after 1.2.0? I don't want anything getting in the way of a new minor release.

I've been using darker on my recent commits, so we're getting there if slowly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

snowman2 picture snowman2  ·  3Comments

vincentsarago picture vincentsarago  ·  4Comments

sgillies picture sgillies  ·  4Comments

sgillies picture sgillies  ·  5Comments

astrojuanlu picture astrojuanlu  ·  4Comments