From 278364799e74b35a39ffe3f4e6739dbc214a0d2d Mon Sep 17 00:00:00 2001 From: Moul <moul@moul.re> Date: Sun, 5 Mar 2023 18:39:48 +0100 Subject: [PATCH] Introduce Ruff (#458) pre-commit and gitlab-ci configurations Add ruff configuration --- .gitlab-ci.yml | 8 ++++++++ .pre-commit-config.yaml | 5 +++++ pyproject.toml | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bf895f2d..0103828a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -80,6 +80,14 @@ pre-commit:hooks: - pre-commit run -a insert-license - pre-commit run -a mdformat +ruff: + extends: + - .code_changes + - .pre-commit + stage: checks + script: + - pre-commit run -a ruff + .tests: extends: .changes stage: tests diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a773956b..5c6a040d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -10,6 +10,11 @@ repos: - id: end-of-file-fixer - id: mixed-line-ending - id: trailing-whitespace +- repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.0.254 + hooks: + - id: ruff + args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/psf/black rev: 23.1.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index 23e2a263..0cefdc06 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,3 +43,10 @@ classifiers = [ [tool.mypy] ignore_missing_imports = true + +[tool.ruff] +line-length = 101 +target-version = "py37" +select = ["W", "I", "UP", "YTT", "B", "A", "DTZ", "T10", +"EXE", "ISC", "ICN", "G", "INP", "PIE", "PYI", "Q", "RSE", "SLF", "TID", +"COM", "C4", "PT", "RET", "SIM", "PTH", "PGH", "PL", "TRY", "RUF"] -- GitLab