1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107# Contributing guide
Contributions are more than welcome!
## Commit messages / PR title
Please ensure your pull request title conforms to [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/).
## CI
CI checks are run using [`nix`](https://nixos.org/download.html#download-nix).
## Development
### Dev environment
I use the following tools:
#### Formatting
- [`.editorconfig`](https://editorconfig.org/) (with [`editorconfig-checker`](https://github.com/editorconfig-checker/editorconfig-checker))
- [`stylua`](https://github.com/JohnnyMorganz/StyLua) [Lua]
- [`alejandra`](https://github.com/kamadorueda/alejandra) [Nix]
#### Linting
- [`luacheck`](https://github.com/mpeterv/luacheck) [Lua]
- [`markdownlint`](https://github.com/DavidAnson/markdownlint) [Markdown]
#### Static type checking
- [`lua-language-server`](https://github.com/LuaLS/lua-language-server/wiki/Diagnosis-Report#create-a-report)
### Nix devShell
- Requires [flakes](https://nixos.wiki/wiki/Flakes) to be enabled.
This project provides a `flake.nix` that can
bootstrap all of the above development tools.
To enter a development shell:
```console
nix develop
```
To apply formatting, while in a devShell, run
```console
pre-commit run --all
```
If you use [`direnv`](https://direnv.net/),
just run `direnv allow` and you will be dropped in this devShell.
### Running tests
I use [`busted`](https://lunarmodules.github.io/busted/) for testing,
but with Neovim as the Lua interpreter.
The easiest way to run tests is with Nix (see below).
If you do not use Nix, you can also run the test suite using `luarocks test`.
For more information on how to set up Neovim as a Lua interpreter, see
- The [neorocks tutorial](https://github.com/nvim-neorocks/neorocks#without-neolua).
Or
- [`nlua`](https://github.com/mfussenegger/nlua).
> [!NOTE]
>
> The Nix devShell sets up `luarocks test` to use Neovim as the interpreter.
### Running tests and checks with Nix
If you just want to run all checks that are available, run:
```console
nix flake check -L --option sandbox false
```
To run tests locally, using Nix:
```console
nix build .#checks.<your-system>.integration-nightly -L --option sandbox false
```
For example:
```console
nix build .#checks.x86_64-linux.integration-nightly -L --option sandbox false
```
For formatting and linting:
```console
nix build .#checks.<your-system>.pre-commit-check -L
```
For static type checking:
```console
nix build .#checks.<your-system>.type-check-nightly -L
```