bluesky / hklpy

Diffractometer computation library with ophyd pseudopositioner support
https://blueskyproject.io/hklpy
BSD 3-Clause "New" or "Revised" License
2 stars 11 forks source link

linting checks can be done via pre-commit #263

Closed prjemian closed 9 months ago

prjemian commented 9 months ago
          Maybe all these checks can be done via pre-commit as we started doing for other projects?

https://github.com/NSLS-II/scientific-python-cookiecutter/blob/main/%7B%7B%20cookiecutter.repo_name%20%7D%7D/.github/workflows/pre-commit.yml

_Originally posted by @mrakitin in https://github.com/bluesky/hklpy/pull/261#discussion_r1349014033_

prjemian commented 9 months ago

Note from pre-commit/action:

this action is in maintenance-only mode and will not be accepting new features.

generally you want to use pre-commit.ci which is faster and has more features.

prjemian commented 9 months ago

... proceeding anyway ...

prjemian commented 9 months ago

Copy .pre-commit-config.yaml file from tiled. Since unit tests have been passing before this branch, comment out parts so that tests pass now as well.

prjemian commented 9 months ago

It is known that versioneer.py is a problem file for style and lint tests. Since this is slated for removal in #267, let's not get too excited about it here.

prjemian commented 9 months ago

Notes about commented tests:

test file(s) that fail the test
end-of-file-fixer docs/source/engine.rst, docs/source/_static/issue-155.ipynb, docs/source/util.rst, pyproject.toml, github_deploy_key_bluesky_bluesky_github_io.enc, docs/source/context.rst, docs/source/calc.rst
trailing-whitespace docs/source/engine.rst, docs/source/examples/notebooks/resources/LNO_LAO_s14.dat, docs/Makefile, docs/source/util.rst, docs/source/context.rst, docs/source/calc.rst, docs/source/sample.rst
flake8 docs/source/conf.py
isort versioneer.py, setup.py, hkl/util.py, hkl/user.py, hkl/tests/test_util.py, hkl/tests/test_user.py, hkl/tests/test_tardis.py, hkl/tests/test_save_restore_UB.py, ... (isort not used on this package ... yet)
black versioneer.py, hkl/_version.py, .pre-commit-config.yaml
mrakitin commented 9 months ago

I tend to ignore some files/dirs for pre-commit, something like versioneer.py and docs/source/conf.py can be safely ignored by the tool. Some details are discussed here: https://stackoverflow.com/questions/61032281/exclude-some-files-on-running-black-using-pre-commit.