From 30a2cf8d109f4dc588f5b67639abe365ccc983fb Mon Sep 17 00:00:00 2001 From: slowy07 Date: Mon, 28 Oct 2024 17:47:45 +0700 Subject: [PATCH] chore: introduce ruff pre-commit hoooks Signed-off-by: slowy07 --- .pre-commit-config.yaml | 11 ++++++----- pyproject.toml | 13 +++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 15f00414c9..52458a5a6a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,9 +1,10 @@ repos: -- repo: https://github.com/psf/black - rev: 23.7.0 - hooks: - - id: black - args: ["qlib", "-l 120"] +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.7.1 + hooks: + - id: ruff + args: [ --fix ] + - id: ruff-format - repo: https://github.com/PyCQA/flake8 rev: 4.0.1 diff --git a/pyproject.toml b/pyproject.toml index 6350d092c7..5dc337b234 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,2 +1,15 @@ [build-system] requires = ["setuptools", "numpy", "Cython"] + +# configuration for black -l 120 +line-length = 120 + +# configuration for lint flake8 implementing +# on ruff lint +# W503 == W504 +[tool.ruff.lint] +ignore = ["E501","F541","E266","E402","E731","E203"] + +[tool.ruff.format] +# automatically detecting appropriate line ending +line-ending = "auto"