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
This commit is contained in:
NRK 2023-02-10 11:51:53 +06:00
parent f2f4903de4
commit 157646f54c
3 changed files with 21 additions and 1 deletions

View File

@ -1,4 +1,6 @@
# EditorConfig # EditorConfig
# See this if your editor doesn't have built-in editorconfig support:
# https://editorconfig.org/#download
# apply to all files # apply to all files
[*] [*]

View File

@ -1,3 +1,6 @@
# clang-format doesn't dictate the project's code style and can mess up a
# couple edge cases. However it comes quite close and can be used for fixing
# most style issues automatically on new changes via `git-clang-format`.
--- ---
Standard: c++03 Standard: c++03

View File

@ -23,7 +23,7 @@ Contribution Guideline
When contributing, make sure: When contributing, make sure:
* Your contribution falls under nsxiv's scope and aim * Your contribution falls under nsxiv's scope and aim
* You follow the existing code style (see [.editorconfig](../.editorconfig)) * You follow the existing code style (see the "Code Style" section below)
* You open the pull request from a new branch, not from master * You open the pull request from a new branch, not from master
* To avoid using force pushes, especially for bigger patches. Only use them * To avoid using force pushes, especially for bigger patches. Only use them
when there's merge conflicts. when there's merge conflicts.
@ -44,6 +44,21 @@ to work on. You can also filter the issues via label:
(Intermediate/Experienced) Issues where we require some help. (Intermediate/Experienced) Issues where we require some help.
Code Style
----------
`nsxiv` mostly follows the [suckless code-style][sl], with a few exceptions.
If your editor supports [.editorconfig](../.editorconfig) then you'll already be
off to a good start without needing much manual intervention. Additionally we
provide a [clang-format](./.clang-format) configuration for reference, which you
may use via [`git-clang-format`][cf] to format the changes you've made (please
do not run it globally on the entire code-base since clang-format gets a decent
amount of edge cases wrong).
[sl]: https://suckless.org/coding_style/
[cf]: https://clang.llvm.org/docs/ClangFormat.html#git-integration
Development workflow for maintainers Development workflow for maintainers
------------------------------------ ------------------------------------