From abca239c445906f964c9fa7c86cf52beb04c915c Mon Sep 17 00:00:00 2001 From: Andrew Grimberg Date: Tue, 4 Jun 2024 06:45:25 -0700 Subject: [PATCH] CI: Use ruff instead of black and flake8 * Start using ruff instead of black and flake8 for code formatting * Pull in the updates from ruff * Update the .yamllint file to stop fighting with prettier Signed-off-by: Andrew Grimberg Change-Id: I7292ac576e5f177dac0fb4691ec316cc73d054e8 --- .pre-commit-config.yaml | 16 +++++++--------- .yamllint.yaml | 4 ++++ docs_conf/__init__.py | 1 + setup.py | 1 + tests/test_simple.py | 1 + 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 30b86c4..7c87b5b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,16 +29,14 @@ repos: - id: prettier stages: [commit] - - repo: https://github.com/ambv/black - rev: 23.3.0 + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: f42857794802b6a77b0e66f08803575aa80d3c8f # frozen: v0.4.7 hooks: - - id: black - - - repo: https://github.com/PyCQA/flake8 - rev: 6.1.0 - hooks: - - id: flake8 - args: ["--max-line-length=88"] + - id: ruff + files: ^.+\.py$ + args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format + files: ^.+\.py$ - repo: https://github.com/pycqa/bandit rev: 1.7.5 diff --git a/.yamllint.yaml b/.yamllint.yaml index b821cb8..fe72814 100644 --- a/.yamllint.yaml +++ b/.yamllint.yaml @@ -5,3 +5,7 @@ rules: max-end: 1 line-length: max: 120 + comments: + # prettier forces 1 space comment separator + min-spaces-from-content: 1 + level: error diff --git a/docs_conf/__init__.py b/docs_conf/__init__.py index b429472..b24a5c6 100644 --- a/docs_conf/__init__.py +++ b/docs_conf/__init__.py @@ -13,5 +13,6 @@ Configure sphinx-doc through an YAML file. """ + __author__ = "Linux Foundation Releng" __summary__ = "Linux Foundation DocsConf" diff --git a/setup.py b/setup.py index 3ffa602..2b7a474 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,5 @@ """Setup for Docs Configuration.""" + from setuptools import setup diff --git a/tests/test_simple.py b/tests/test_simple.py index dfc5ff7..71f853b 100644 --- a/tests/test_simple.py +++ b/tests/test_simple.py @@ -10,6 +10,7 @@ # http://www.eclipse.org/legal/epl-v10.html ############################################################################## """Docs Conf Tests.""" + import importlib import os import pytest -- 2.16.6