From b42d6d02b59ad7cebbae82ffe1e5dbc5e51a1688 Mon Sep 17 00:00:00 2001
From: Dorian Turba <froggit.commit.z3jqj@simplelogin.com>
Date: Tue, 10 Oct 2023 18:00:45 +0200
Subject: [PATCH] add toml-sort pre-commit and tool

---
 .pre-commit-config.yaml | 13 +++++++++----
 CONTRIBUTING.md         |  7 +++++++
 pyproject.toml          | 34 ++++++++++++++++++++++------------
 3 files changed, 38 insertions(+), 16 deletions(-)

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 7abc2ee..c08df26 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,5 +1,10 @@
 repos:
-- repo: https://github.com/jackdewinter/pymarkdown
-  rev: v0.9.13.3
-  hooks:
-  - id: pymarkdown
+    -   repo: https://github.com/jackdewinter/pymarkdown
+        rev: v0.9.13.3
+        hooks:
+            -   id: pymarkdown
+    -   repo: https://github.com/pappasam/toml-sort
+        rev: v0.23.1
+        hooks:
+            -   id: toml-sort
+                args: [ --check ]
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b645028..dc7ca77 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -27,3 +27,10 @@ pre-commit run --all-files
 This will run the following hooks:
 
 - `pymarkdown`
+- `toml-sort`
+
+#### Sort Toml files
+
+```bash
+toml-sort --in-place pyproject.toml 
+```
diff --git a/pyproject.toml b/pyproject.toml
index 61f7768..a7992c4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,23 +1,20 @@
 [build-system]
-requires = ["hatchling"]
 build-backend = "hatchling.build"
-
-[tool.hatch.metadata]
-allow-direct-references = true
+requires = ["hatchling"]
 
 [project]
 name = "r2devops_catalog"
 version = "0.1.0"
 authors = [
-    { name = "Dorian Turba", email = "author.name@example.com" },
+    {email = "contact.7ltt4@8shield.net", name = "Dorian Turba"},
 ]
-description = "A description of what the package is for."
+description = "Catalog of r2devops projects"
 dependencies = [
     "black_project @ {root:uri}/tests/black_project",
     "flake8_project @ {root:uri}/tests/flake8_project",
     "isort_project @ {root:uri}/tests/isort_project",
-    "pytest_project @ {root:uri}/tests/pytest_project",
     "mypy_project @ {root:uri}/tests/mypy_project",
+    "pytest_project @ {root:uri}/tests/pytest_project",
 ]
 
 [project.optional-dependencies]
@@ -25,16 +22,29 @@ QUALITY = [
     "black",
     "mypy",
     "pre-commit",
+    "toml-sort",
 ]
 
-[tool.pymarkdown]
-strict-config = true
-plugins.line-length.enabled = false
+[tool.hatch.metadata]
+allow-direct-references = true
 
 [[tool.mypy.overrides]]
+ignore_missing_imports = true
 module = [
+    "packaging",
     "packaging.requirements",
     "packaging.specifiers",
-    "packaging",
 ]
-ignore_missing_imports = true
\ No newline at end of file
+
+[tool.pymarkdown]
+strict-config = true
+plugins.line-length.enabled = false
+
+[tool.tomlsort]
+all = true
+in_place = true
+spaces_indent_inline_array = 4
+trailing_comma_inline_array = true
+
+[tool.tomlsort.overrides."project"]
+table_keys = false
-- 
GitLab