From b3b02eb52943fdc8ba74af3b485e9d11655bc9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dundar=20G=C3=B6c?= Date: Fri, 24 Sep 2021 21:19:34 +0200 Subject: [PATCH] docs(CONTRIBUTING.md): how to use uncrustify #15780 close #15780 --- CONTRIBUTING.md | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2a565574fa..88d2989f13 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -217,13 +217,20 @@ You can lint a single file (but this will _not_ exclude legacy errors): ### Style -The repo includes a `.clang-format` config file which (mostly) matches the -[style-guide]. You can use `clang-format` to format code with the `gq` -operator in Nvim: - - if !empty(findfile('.clang-format', ';')) - setlocal formatprg=clang-format\ -style=file - endif +- Style rules are (mostly) defined by `src/uncrustify.cfg` which tries to match + the [style-guide]. To use the Nvim `gq` command with `uncrustify`: + ``` + if !empty(findfile('src/.uncrustify', ';')) + setlocal formatprg=uncrustify\ -q\ -c\ src/uncrustify.cfg\ --replace\ --no-backup + endif + ``` +- There is also `.clang-format` which has drifted from the [style-guide], but + is available for reference. To use the Nvim `gq` command with `clang-format`: + ``` + if !empty(findfile('.clang-format', ';')) + setlocal formatprg=clang-format\ -style=file + endif + ``` ### Navigate @@ -263,7 +270,7 @@ as context, use the `-W` argument as well. [1820]: https://github.com/neovim/neovim/pull/1820 [hub]: https://hub.github.com/ [conventional_commits]: https://www.conventionalcommits.org -[style-guide]: http://neovim.io/develop/style-guide.xml +[style-guide]: https://neovim.io/doc/user/dev_style.html#dev-style [ASan]: http://clang.llvm.org/docs/AddressSanitizer.html [run-tests]: https://github.com/neovim/neovim/blob/master/test/README.md#running-tests [wiki-faq]: https://github.com/neovim/neovim/wiki/FAQ @@ -278,3 +285,4 @@ as context, use the `-W` argument as well. [wiki-contribute-help]: https://github.com/neovim/neovim/wiki/contribute-%3Ahelp [pr-draft]: https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request [pr-ready]: https://docs.github.com/en/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-stage-of-a-pull-request +[uncrustify]: https://formulae.brew.sh/formula/uncrustify