From 67e423edb25a3b565cd649a04ae73aa6446115d4 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Wed, 16 Jul 2025 15:54:54 +0200 Subject: [enh] CI - add shell script formatter Implement rules and functions to format shell scripts: $ make format.shell or alternatively to format all source code: $ make format The formatter `shfmt` reads the rules from the editorconfig[1] If any EditorConfig files are found, they will be used to apply formatting options. If any parser or printer flags are given to the tool, no EditorConfig files will be used. [1] https://github.com/patrickvane/shfmt?tab=readme-ov-file#description Signed-off-by: Markus Heiser --- docs/dev/makefile.rst | 22 ++++++++++------------ docs/dev/quickstart.rst | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) (limited to 'docs') diff --git a/docs/dev/makefile.rst b/docs/dev/makefile.rst index 4781b2ce6..ea7ddecd8 100644 --- a/docs/dev/makefile.rst +++ b/docs/dev/makefile.rst @@ -188,24 +188,22 @@ sources of the theme need to be rebuild. You can do that by running:: $ LIVE_THEME=simple make run -.. _make format.python: +.. _make format: -``make format.python`` +``make format`` ====================== -Format Python source code using `Black code style`_. See ``$BLACK_OPTIONS`` -and ``$BLACK_TARGETS`` in :origin:`Makefile`. - -.. attention:: +.. _Black code style: + https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html +.. _shfmt: https://github.com/mvdan/sh?tab=readme-ov-file#shfmt +.. _EditorConfig: https://github.com/patrickvane/shfmt?tab=readme-ov-file#description - We stuck at Black 22.12.0, please read comment in PR `Bump black from 22.12.0 - to 23.1.0`_ +- Format Python source code using `Black code style`_. See ``$BLACK_OPTIONS`` + and ``$BLACK_TARGETS`` in :origin:`Makefile`. -.. _Bump black from 22.12.0 to 23.1.0: - https://github.com/searxng/searxng/pull/2159#pullrequestreview-1284094735 +- Format Shell scripts using shfmt_. The formatter ``shfmt`` reads the rules + from the EditorConfig_ files. -.. _Black code style: - https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html .. _make clean: diff --git a/docs/dev/quickstart.rst b/docs/dev/quickstart.rst index 1f3fee7cc..305a8686e 100644 --- a/docs/dev/quickstart.rst +++ b/docs/dev/quickstart.rst @@ -27,7 +27,7 @@ Here is how a minimal workflow looks like: 1. *start* hacking 2. *run* your code: :ref:`make run` -3. *format & test* your code: :ref:`make format.python` and :ref:`make test` +3. *format & test* your code: :ref:`make format` and :ref:`make test` If you think at some point something fails, go back to *start*. Otherwise, choose a meaningful commit message and we are happy to receive your pull -- cgit v1.2.3