Krolyxon
Commit 157646f

Branches

Refs →

nsxiv157646f

etc changes related to code-style docs

* Add a "Code Style" section in CONTRIBUTING
* Move .clang-format to etc/
* Add a short comment on clang-format and editorconfig file
Author
NRK
Date
2023-02-10 11:51 +0600
Committer
NRK · 2023-03-11 18:37 +0600
Parent
f2f4903
Commit
157646f54cd010c8c884998319954006260f960e

+21 −1

3 files changed

  1. M .editorconfig +2 −0
  2. R .clang-format → etc/.clang-format +3 −0
  3. M etc/CONTRIBUTING.md +16 −1
M .editorconfig View
@@ -1,4 +1,6 @@
11 # EditorConfig
2+# See this if your editor doesn't have built-in editorconfig support:
3+# https://editorconfig.org/#download
24
35 # apply to all files
46 [*]
R .clang-format → etc/.clang-format View
@@ -1,3 +1,6 @@
1+# clang-format doesn't dictate the project's code style and can mess up a
2+# couple edge cases. However it comes quite close and can be used for fixing
3+# most style issues automatically on new changes via `git-clang-format`.
14 ---
25
36 Standard: c++03
M etc/CONTRIBUTING.md View
@@ -23,7 +23,7 @@ Contribution Guideline
2323 When contributing, make sure:
2424
2525 * Your contribution falls under nsxiv's scope and aim
26− * You follow the existing code style (see [.editorconfig](../.editorconfig))
26+ * You follow the existing code style (see the "Code Style" section below)
2727 * You open the pull request from a new branch, not from master
2828 * To avoid using force pushes, especially for bigger patches. Only use them
2929 when there's merge conflicts.
@@ -44,6 +44,21 @@ to work on. You can also filter the issues via label:
4444 (Intermediate/Experienced) Issues where we require some help.
4545
4646
47+Code Style
48+----------
49+
50+`nsxiv` mostly follows the [suckless code-style][sl], with a few exceptions.
51+If your editor supports [.editorconfig](../.editorconfig) then you'll already be
52+off to a good start without needing much manual intervention. Additionally we
53+provide a [clang-format](./.clang-format) configuration for reference, which you
54+may use via [`git-clang-format`][cf] to format the changes you've made (please
55+do not run it globally on the entire code-base since clang-format gets a decent
56+amount of edge cases wrong).
57+
58+[sl]: https://suckless.org/coding_style/
59+[cf]: https://clang.llvm.org/docs/ClangFormat.html#git-integration
60+
61+
4762 Development workflow for maintainers
4863 ------------------------------------
4964