From 0f4fd1b3dfe3e700a2e334243ef47df2b06afc0f Mon Sep 17 00:00:00 2001
From: Simon Rose <simon.rose@ess.eu>
Date: Fri, 17 Mar 2023 16:38:49 +0100
Subject: [PATCH] Update pre-commit

---
 .flake8                               |  4 ----
 .pre-commit-config.yaml               | 26 +++++++++++---------------
 require-ess/Db/moduleversion.template |  2 +-
 ruff.toml                             |  2 ++
 tests/utils.py                        |  4 +---
 5 files changed, 15 insertions(+), 23 deletions(-)
 delete mode 100644 .flake8
 create mode 100644 ruff.toml

diff --git a/.flake8 b/.flake8
deleted file mode 100644
index 24b8764c..00000000
--- a/.flake8
+++ /dev/null
@@ -1,4 +0,0 @@
-[flake8]
-ignore = E501, E203, W503
-# E501, E203: black
-# W503: PEP8
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ced64ab8..8ab73ffb 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,23 +1,19 @@
 repos:
-  - repo: https://github.com/ambv/black
-    rev: 22.3.0
+  - repo: https://github.com/psf/black
+    rev: 22.8.0
     hooks:
       - id: black
-  - repo: https://github.com/pycqa/flake8
-    rev: 3.9.2
+  - repo: https://github.com/charliermarsh/ruff-pre-commit
+    rev: v0.0.238
     hooks:
-    -   id: flake8
+      - id: ruff
+  - repo: https://github.com/PyCQA/doc8.git
+    rev: v1.0.0 # 1.1.0 drops python3.6 support
+    hooks:
+      - id: doc8
   - repo: https://github.com/pre-commit/pre-commit-hooks
-    rev: v4.0.1
+    rev: v4.0.1 # 4.2.0 drops python3.6 support
     hooks:
       - id: end-of-file-fixer
       - id: trailing-whitespace
-  - repo: https://github.com/timothycrosley/isort
-    rev: 5.10.1
-    hooks:
-    - id: isort
-      args: ["--profile", "black"]
-  - repo: https://github.com/pre-commit/mirrors-clang-format
-    rev: v13.0.0
-    hooks:
-    - id: clang-format
+      - id: check-yaml
diff --git a/require-ess/Db/moduleversion.template b/require-ess/Db/moduleversion.template
index f649f5c4..6546ab11 100644
--- a/require-ess/Db/moduleversion.template
+++ b/require-ess/Db/moduleversion.template
@@ -50,7 +50,7 @@ record(stringin,"$(REQUIRE_IOC):BaseVersion")
 }
 
 # This record contains labels for the created NTTable, named $(REQUIRE_IOC):LoadedModules.
-record(aai, "$(REQUIRE_IOC):Labels") 
+record(aai, "$(REQUIRE_IOC):Labels")
 {
     field(DESC, "Labels for the NTTable")
     field(FTVL, "STRING")
diff --git a/ruff.toml b/ruff.toml
new file mode 100644
index 00000000..d8c478b9
--- /dev/null
+++ b/ruff.toml
@@ -0,0 +1,2 @@
+extend-select = ["D212"]
+extend-ignore = ["D105", "D107", "D202", "D418", "E501"]
diff --git a/tests/utils.py b/tests/utils.py
index 312f9c32..b837ab55 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -153,9 +153,7 @@ EXCLUDE_ARCHS+=debug
 
 
 def run_ioc_get_output(*args, **kwargs):
-    """
-    Run an IOC and try to load the test module
-    """
+    """Run an IOC and try to load the test module."""
     ioc_args = []
     module = kwargs.get("module", None)
     version = kwargs.get("version", None)
-- 
GitLab