Skip to content

Commit ad22603

Browse files
committed
chore(#3271): add new format-check, rename style-fix to format-fix
1 parent fa3c458 commit ad22603

3 files changed

Lines changed: 28 additions & 7 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ jobs:
7777

7878
- run: make style-doc
7979

80+
- run: make format-check
81+
8082
- name: build Nvim from source
8183
run: |
8284
mkdir -p "${DIR_NVIM_SRC}"

CONTRIBUTING.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ markdown-toc --maxdepth=2 -i CONTRIBUTING.md
1515
- [Quality](#quality)
1616
* [lint](#lint)
1717
* [style](#style)
18+
* [format-fix](#format-fix)
1819
* [check](#check)
20+
* [format-check](#format-check)
1921
- [Diagnostics](#diagnostics)
2022
- [Backwards Compatibility](#backwards-compatibility)
2123
- [:help Documentation](#help-documentation)
@@ -36,10 +38,10 @@ Language server: [luals](https://luals.github.io)
3638

3739
Lint: [luacheck](https://github.com/lunarmodules/luacheck/)
3840

39-
Style Fixing: [EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle): `CodeCheck`
40-
4141
nvim-tree.lua migrated from stylua to EmmyLuaCodeStyle ~2024/10. `vim.lsp.buf.format()` may be used as it is the default formatter for luals, using an embedded [EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle)
4242

43+
Formatting: [EmmyLuaCodeStyle](https://github.com/CppCXY/EmmyLuaCodeStyle): `CodeFormat` executable
44+
4345
You can install them via you OS package manager e.g. `pacman`, `brew` or other via other package managers such as `cargo` or `luarocks`
4446

4547
# Quality
@@ -67,10 +69,12 @@ make lint
6769
make style
6870
```
6971

70-
You can automatically fix style issues using `CodeCheck`:
72+
## format-fix
73+
74+
You can automatically fix most style issues using `CodeFormat`:
7175

7276
```sh
73-
make style-fix
77+
make format-fix
7478
```
7579

7680
## check
@@ -96,6 +100,17 @@ curl -L "https://github.com/LuaLS/lua-language-server/releases/download/3.15.0/l
96100
PATH="luals/bin:${PATH}" make check
97101
```
98102

103+
## format-check
104+
105+
This is run in CI. Commit or stage your changes and run:
106+
107+
```sh
108+
make format-check
109+
```
110+
111+
- Re-runs `make format-fix`
112+
- Checks that `git diff` is empty, to ensure that all content has been generated. This is why a stage or commit is necessary.
113+
99114
# Diagnostics
100115

101116
Diagnostics issues may not be suppressed. See [luals](https://luals.github.io) documentation for details on how to structure the code and comments.

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ luals:
2525
scripts/luals-check.sh
2626

2727
#
28-
# fixes
28+
# format
2929
#
30-
style-fix:
30+
format-fix:
3131
CodeFormat format --config .editorconfig --workspace lua
3232

33+
format-check:
34+
CodeFormat format --config .editorconfig --workspace lua
35+
git diff --exit-code lua
36+
3337
#
3438
# utility
3539
#
@@ -46,5 +50,5 @@ help-check: help-update
4650
git diff --ignore-blank-lines --exit-code doc/nvim-tree-lua.txt
4751

4852

49-
.PHONY: all lint style check luacheck style-check style-doc luals style-fix help-update help-check
53+
.PHONY: all lint style check luacheck style-check style-doc luals format-fix format-check help-update help-check
5054

0 commit comments

Comments
 (0)