From d27092f3d16c077b70216e47635d1d29247a5dde Mon Sep 17 00:00:00 2001
From: Guilhem Saurel <guilhem.saurel@laas.fr>
Date: Thu, 31 Mar 2022 09:44:48 +0200
Subject: [PATCH] update tooling

- add pre-commit and its CI
- switch to black
- configure flake8 & isort for black
- add badges
---
 .pre-commit-config.yaml | 30 ++++++++++++++++++++++++++++++
 README.md               |  2 ++
 pyproject.toml          |  2 ++
 setup.cfg               |  4 ++++
 4 files changed, 38 insertions(+)
 create mode 100644 .pre-commit-config.yaml
 create mode 100644 pyproject.toml
 create mode 100644 setup.cfg

diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..24f0530
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,30 @@
+exclude: tests/test_python-syntax_error.py
+repos:
+-   repo: https://github.com/pre-commit/mirrors-clang-format
+    rev: v13.0.1
+    hooks:
+    -   id: clang-format
+        args: [-i, --style=Google]
+-   repo: https://github.com/pre-commit/pre-commit-hooks
+    rev: v4.1.0
+    hooks:
+    -   id: trailing-whitespace
+    -   id: check-added-large-files
+    -   id: check-ast
+    -   id: check-merge-conflict
+    -   id: check-symlinks
+    -   id: check-toml
+    -   id: check-yaml
+    -   id: debug-statements
+    -   id: detect-private-key
+    -   id: end-of-file-fixer
+    -   id: mixed-line-ending
+    -   id: trailing-whitespace
+-   repo: https://github.com/psf/black
+    rev: 22.3.0
+    hooks:
+    -   id: black
+-   repo: https://github.com/PyCQA/flake8
+    rev: 4.0.1
+    hooks:
+    -   id: flake8
diff --git a/README.md b/README.md
index ff0419c..514c78a 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,8 @@
 [![conde version](https://img.shields.io/conda/vn/conda-forge/example-robot-data.svg)](https://anaconda.org/conda-forge/example-robot-data)
 [![conde download](https://anaconda.org/conda-forge/example-robot-data/badges/downloads.svg)](https://anaconda.org/conda-forge/example-robot-data)
 [![PyPI version](https://badge.fury.io/py/example-robot-data.svg)](https://badge.fury.io/py/example-robot-data)
+[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/gepetto/example-robot-data/master.svg)](https://results.pre-commit.ci/latest/github/gepetto/example-robot-data/master)
+[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
 
 
 This repository includes a set of robot descriptions that are aimed to be used in benchmarking, unit-tests, teachings,
diff --git a/pyproject.toml b/pyproject.toml
new file mode 100644
index 0000000..1a17557
--- /dev/null
+++ b/pyproject.toml
@@ -0,0 +1,2 @@
+[tool.isort]
+line_length = 88
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..4155cd4
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,4 @@
+[flake8]
+max-line-length = 88
+exclude = tests/test_python-syntax_error.py
+ignore = E226, E704, E24, E121, W504, E126, E123, W503, E203
-- 
GitLab