Skip to content

Commit eb9f7cd

Browse files
committed
ci: document checks and fixes
1 parent e14aa5a commit eb9f7cd

File tree

2 files changed

+42
-23
lines changed

2 files changed

+42
-23
lines changed

.hooks/pre-commit.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env bash
1+
#!/bin/sh
22

3-
stylua . --check || exit 1
4-
luacheck . || exit 1
3+
make

CONTRIBUTING.md

Lines changed: 40 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,72 @@ Thank you for contributing.
44

55
See [Development](https://github.com/nvim-tree/nvim-tree.lua/wiki/Development) for environment setup, tips and tools.
66

7+
# Tools
8+
9+
Following are used during CI and strongly recommended during local development.
10+
11+
Lint: [luacheck](https://github.com/lunarmodules/luacheck/)
12+
13+
Style: [stylua]
14+
15+
Language server: [luals](https://luals.github.io)
16+
17+
You can install them via you OS package manager e.g. `pacman`, `brew` or other via other package managers such as `cargo` or `luarocks`
18+
719
# Quality
820

9-
The following quality checks are mandatory and are performed during CI:
21+
The following quality checks are mandatory and are performed during CI. They run on the entire `lua` directory` return 1 on any failure.
1022

11-
## Styling and formatting
23+
You can run them all via `make` or `make all`
1224

13-
Code is formatted using luacheck, and linted using stylua.
14-
You may install these via your package manager or with:
25+
You can setup the git hooks by running `scripts/setup-hooks.sh`
1526

16-
```bash
17-
luarocks install luacheck
18-
cargo install stylua
27+
## lint
28+
29+
```sh
30+
make lint
1931
```
2032

21-
Run:
33+
1. Runs luacheck quietly using `.luacheck` settings
34+
1. Runs `scripts/doc-comments.sh` to validate annotated documentation
35+
36+
## style
37+
38+
Runs stylua using `.stylua.toml` settings:
39+
2240
```sh
23-
stylua lua
24-
luacheck lua
41+
make style
2542
```
2643

27-
You can setup the git hooks by running `scripts/setup-hooks.sh`.
44+
You can automatically fix style issues via:
2845

29-
## Check
46+
```sh
47+
make style-fix
48+
```
49+
50+
## check
3051

31-
[luals](https://luals.github.io) check is run with:
52+
Runs the checks that the LSP lua language server runs inside nvim using `.luarc.json`
3253

3354
```sh
34-
scripts/luals-check.sh
55+
make check
3556
```
3657

37-
Requires `lua-language-server` on your path.
58+
Assumes `$VIMRUNTIME` is `/usr/share/nvim/runtime`. Adjust as necessary e.g.
3859

39-
Assumes neovim's `$VIMRUNTIME` is `"/usr/share/nvim/runtime"`. Override with:
4060
```sh
41-
VIMRUNTIME="/my/path/to/runtime" scripts/luals-check.sh
61+
VIMRUNTIME="/my/path/to/runtime" make check
4262
```
4363

44-
# Adding new actions
64+
# Adding New Actions
4565

4666
To add a new action, add a file in `actions/name-of-the-action.lua`. You should export a `setup` function if some configuration is needed.
47-
Once you did, you should run the `scripts/update-help.sh`.
67+
68+
Once you did, you should run `make update-help`
4869

4970
# Documentation
5071

5172
When adding new options, you should declare the defaults in the main `nvim-tree.lua` file.
52-
Once you did, you should run the `scripts/update-help.sh`.
5373

5474
Documentation for options should also be added to `nvim-tree-opts` in `doc/nvim-tree-lua.txt`
5575

0 commit comments

Comments
 (0)