CI: Use ruff instead of black and flake8 22/72922/1
authorAndrew Grimberg <agrimberg@linuxfoundation.org>
Tue, 4 Jun 2024 13:45:25 +0000 (06:45 -0700)
committerAndrew Grimberg <agrimberg@linuxfoundation.org>
Tue, 4 Jun 2024 13:45:25 +0000 (06:45 -0700)
* 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 <agrimberg@linuxfoundation.org>
Change-Id: I7292ac576e5f177dac0fb4691ec316cc73d054e8

.pre-commit-config.yaml
.yamllint.yaml
docs_conf/__init__.py
setup.py
tests/test_simple.py

index 30b86c4..7c87b5b 100644 (file)
@@ -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
index b821cb8..fe72814 100644 (file)
@@ -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
index b429472..b24a5c6 100644 (file)
@@ -13,5 +13,6 @@
 
 Configure sphinx-doc through an YAML file.
 """
+
 __author__ = "Linux Foundation Releng"
 __summary__ = "Linux Foundation DocsConf"
index 3ffa602..2b7a474 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,5 @@
 """Setup for Docs Configuration."""
+
 from setuptools import setup
 
 
index dfc5ff7..71f853b 100644 (file)
@@ -10,6 +10,7 @@
 # http://www.eclipse.org/legal/epl-v10.html
 ##############################################################################
 """Docs Conf Tests."""
+
 import importlib
 import os
 import pytest