]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
docs: document code formatting in HACKING.md
authorHarald Hoyer <harald@redhat.com>
Thu, 25 Feb 2021 09:53:22 +0000 (10:53 +0100)
committerHarald Hoyer <harald@hoyer.xyz>
Sat, 13 Mar 2021 19:10:43 +0000 (20:10 +0100)
HACKING.md

index dbd2327d06b71e19b6921d4a1782795acc47958d..b8aed6125a94e43d92dfc6e93abd167d6e537815 100644 (file)
@@ -9,6 +9,31 @@ Currently dracut lives on github.com and kernel.org.
 
 Pull requests should be filed preferably on github nowadays.
 
+### Code Format
+
+It is recommended, that you install a plugin for your editor, which reads in `.editorconfig`.
+Additionally `emacs` and `vim` config files are provided for convenience.
+
+To reformat C files use `indent`:
+```console
+$ indent -i8 -nut -br -linux -l120 <FILE>
+```
+
+For convenience there is also a Makefile `indent` target `make indent`.
+
+To reformat shell files use `shfmt`:
+
+```console
+$ shfmt_version=3.0.1
+$ wget "https://github.com/mvdan/sh/releases/download/v${shfmt_version}/shfmt_v${shfmt_version}_linux_amd64" -O shfmt
+$ chmod u+x shfmt
+$ ./shfmt -w -s .
+```
+
+Some IDEs already have support for shfmt.
+
+For convenience the `make indent` Makefile target also calls shfmt, if it is in `$PATH`.
+
 ### Commit Messages
 
 Commit messages should answer these questions: