Skip to content

Commit

Permalink
Use ruff for linting instead of pycodestyle (#344)
Browse files Browse the repository at this point in the history
* fix README.rst

* Set up ruff

* Fix ruff errors

* Use ruff instead of pycodestyle in workflow

* Update GitHub actions

* Use f-string
  • Loading branch information
carnisj authored Jan 30, 2024
1 parent 96e5af7 commit 1eb5dfe
Show file tree
Hide file tree
Showing 151 changed files with 455 additions and 838 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/pr_lint_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
python-version: ['3.9', '3.11']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -34,7 +34,7 @@ jobs:
- name: Cache dependencies
id: myCache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{env.LD_LIBRARY_PATH}}/python${{ matrix.python-version }}/site-packages
key: ${{ runner.os }}-pip-v0-${{ hashFiles('**/requirements.txt') }}
Expand All @@ -53,8 +53,8 @@ jobs:
- name: Check imports with isort
run: python -m isort --profile black bcdi

- name: Lint with pycodestyle
run: python -m pycodestyle bcdi --max-line-length=88 --ignore=E24,E121,E123,E126,E203,E226,E704,W503
- name: Lint with ruff
run: python -m ruff check .

- name: Check docstrings with pydocstyle
run: python -m pydocstyle bcdi --ignore=D102,D107,D212,D203
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. image:: https://readthedocs.org/projects/bcdi/badge/?version=latest
:target: https://bcdi.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://img.shields.io/github/actions/workflow/status/carnisj/bcdi/python-package-3.10.yml?logo=GitHub
.. image:: https://img.shields.io/github/actions/workflow/status/carnisj/bcdi/pr_lint_test.yml?logo=GitHub
:alt: GitHub Workflow Status
.. image:: https://deepsource.io/gh/carnisj/bcdi.svg/?label=active+issues&show_trend=true&token=N3Z0cklmQrG8kzZOVwGJhLd9
.. image:: https://img.shields.io/pypi/pyversions/bcdi?logo=PyPI&logoColor=%23FFFF00
Expand Down
7 changes: 5 additions & 2 deletions bcdi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

# BCDI: tools for pre(post)-processing Bragg coherent X-ray diffraction imaging data
# (c) 07/2017-06/2019 : CNRS UMR 7344 IM2NP
# (c) 07/2019-05/2021 : DESY PHOTON SCIENCE
Expand All @@ -10,6 +8,11 @@

from subprocess import PIPE, Popen

try: # for P10, hdf5plugin should be imported before h5py or PyTables
import hdf5plugin # noqa: F401
except ModuleNotFoundError:
pass


def get_git_version() -> str:
"""
Expand Down
2 changes: 0 additions & 2 deletions bcdi/algorithms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

# BCDI: tools for pre(post)-processing Bragg coherent X-ray diffraction imaging data
# (c) 07/2017-06/2019 : CNRS UMR 7344 IM2NP
# (c) 07/2019-05/2021 : DESY PHOTON SCIENCE
Expand Down
2 changes: 0 additions & 2 deletions bcdi/algorithms/algorithms_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

# BCDI: tools for pre(post)-processing Bragg coherent X-ray diffraction imaging data
# (c) 07/2017-06/2019 : CNRS UMR 7344 IM2NP
# (c) 07/2019-05/2021 : DESY PHOTON SCIENCE
Expand Down
2 changes: 0 additions & 2 deletions bcdi/constants.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

# BCDI: tools for pre(post)-processing Bragg coherent X-ray diffraction imaging data
# (c) 07/2017-06/2019 : CNRS UMR 7344 IM2NP
# (c) 07/2019-05/2021 : DESY PHOTON SCIENCE
Expand Down
2 changes: 0 additions & 2 deletions bcdi/examples/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

# BCDI: tools for pre(post)-processing Bragg coherent X-ray diffraction imaging data
# (c) 07/2017-06/2019 : CNRS UMR 7344 IM2NP
# (c) 07/2019-05/2021 : DESY PHOTON SCIENCE
Expand Down
2 changes: 0 additions & 2 deletions bcdi/experiment/beamline.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

# BCDI: tools for pre(post)-processing Bragg coherent X-ray diffraction imaging data
# (c) 07/2017-06/2019 : CNRS UMR 7344 IM2NP
# (c) 07/2019-05/2021 : DESY PHOTON SCIENCE
Expand Down
2 changes: 0 additions & 2 deletions bcdi/experiment/beamline_factory.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

# BCDI: tools for pre(post)-processing Bragg coherent X-ray diffraction imaging data
# (c) 07/2017-06/2019 : CNRS UMR 7344 IM2NP
# (c) 07/2019-05/2021 : DESY PHOTON SCIENCE
Expand Down
2 changes: 0 additions & 2 deletions bcdi/experiment/detector.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

# BCDI: tools for pre(post)-processing Bragg coherent X-ray diffraction imaging data
# (c) 07/2017-06/2019 : CNRS UMR 7344 IM2NP
# (c) 07/2019-05/2021 : DESY PHOTON SCIENCE
Expand Down
2 changes: 0 additions & 2 deletions bcdi/experiment/diffractometer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-

# BCDI: tools for pre(post)-processing Bragg coherent X-ray diffraction imaging data
# (c) 07/2017-06/2019 : CNRS UMR 7344 IM2NP
# (c) 07/2019-05/2021 : DESY PHOTON SCIENCE
Expand Down
Loading

0 comments on commit 1eb5dfe

Please sign in to comment.