Skip to content

Commit

Permalink
Use ruff formatter as pre-commit (#347)
Browse files Browse the repository at this point in the history
* Use ruff formatter as pre-commit

* Format code and docstrings

* Format documentation

* Fix audb.info docstring
  • Loading branch information
hagenw authored Jan 23, 2024
1 parent ed34c1f commit 58b56d4
Show file tree
Hide file tree
Showing 45 changed files with 2,408 additions and 2,427 deletions.
10 changes: 0 additions & 10 deletions .flake8

This file was deleted.

4 changes: 3 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ default_language_version:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.276
rev: v0.1.8
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
hooks:
Expand Down
5 changes: 3 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Coding Convention
-----------------

We follow the PEP8_ convention for Python code
and check for correct syntax with ruff_.
and use ruff_ as a linter and code formatter.
In addition,
we check for common spelling errors with codespell_.
Both tools and possible exceptions
Expand All @@ -61,7 +61,8 @@ You can also install ruff_ and codespell_
and call it directly::

pip install ruff codespell # consider system wide installation
ruff check .
ruff check --fix . # lint all Python files, and fix any fixable errors
ruff format . # format code of all Python files
codespell

It can be restricted to specific folders::
Expand Down
1 change: 1 addition & 0 deletions audb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
# Dynamically get the version of the installed module
try:
import importlib.metadata

__version__ = importlib.metadata.version(__name__)
except Exception: # pragma: no cover
importlib = None # pragma: no cover
Expand Down
Loading

0 comments on commit 58b56d4

Please sign in to comment.