|
| 1 | +# Contributing |
| 2 | + |
| 3 | +First off, thanks for taking the time to contribute! ❤️ |
| 4 | + |
| 5 | +All contribution types are welcome: bug reports, feature ideas, docs updates, |
| 6 | +tests, and code improvements. 🎉 |
| 7 | + |
| 8 | +## Table of Contents |
| 9 | + |
| 10 | +- [I Have a Question](#i-have-a-question) |
| 11 | + - [I Want To Contribute](#i-want-to-contribute) |
| 12 | + - [Reporting Bugs](#reporting-bugs) |
| 13 | + - [Suggesting Enhancements](#suggesting-enhancements) |
| 14 | + - [Your First Code Contribution](#your-first-code-contribution) |
| 15 | + - [Improving The Documentation](#improving-the-documentation) |
| 16 | +- [Styleguides](#styleguides) |
| 17 | + - [Commit Messages](#commit-messages) |
| 18 | + |
| 19 | +## I Have a Question |
| 20 | + |
| 21 | +Before asking a question: |
| 22 | + |
| 23 | +- Read the official [documentation]. |
| 24 | +- Check existing [issues]. |
| 25 | +- Check [discussions]. |
| 26 | +- Search the internet for existing answers. |
| 27 | + |
| 28 | +If you still need help, open a [discussion] or a question [issue] with your |
| 29 | +relevant context. |
| 30 | + |
| 31 | +### I Want To Contribute |
| 32 | + |
| 33 | +Contributions of all sizes are welcome. Keep changes focused and small. All |
| 34 | +contributions are licensed under the [LICENSE]. |
| 35 | + |
| 36 | +Before opening a [PR]: |
| 37 | + |
| 38 | +- For larger changes, start with an [issue] or [discussion] first. |
| 39 | +- Prefer one clear purpose per [PR]. |
| 40 | +- Include related [tests/] updates when behavior changes. |
| 41 | + |
| 42 | +### Reporting Bugs |
| 43 | + |
| 44 | +Before submitting a bug report, read the official [documentation], check |
| 45 | +[discussions] and existing [issues], and search the internet for similar reports |
| 46 | +or fixes to avoid duplicates and continue existing threads. |
| 47 | + |
| 48 | +When reporting a bug, include: |
| 49 | + |
| 50 | +- Steps to reproduce. |
| 51 | +- Expected result and actual result. |
| 52 | +- Lua version and platform details. |
| 53 | +- Minimal example when possible. |
| 54 | + |
| 55 | +### Suggesting Enhancements |
| 56 | + |
| 57 | +For enhancements, read the official [documentation], check [discussions] and |
| 58 | +existing [issues] to avoid duplicate requests, then open an [issue] and include: |
| 59 | + |
| 60 | +- The problem you want to solve. |
| 61 | +- The proposed behavior. |
| 62 | +- Why it helps most users. |
| 63 | +- Any alternatives you considered. |
| 64 | + |
| 65 | +### Your First Code Contribution |
| 66 | + |
| 67 | +#### Testing |
| 68 | + |
| 69 | +Tests live in [tests/] (named `<name>.test.lua`). Add or update tests there when |
| 70 | +behavior changes. |
| 71 | + |
| 72 | +Run tests with [Busted]: |
| 73 | + |
| 74 | +```sh |
| 75 | +# All tests |
| 76 | +busted |
| 77 | + |
| 78 | +# A specific test file |
| 79 | +busted tests/<name>.test.lua |
| 80 | +``` |
| 81 | + |
| 82 | +#### Linting |
| 83 | + |
| 84 | +Run lint checks before opening a [PR]: |
| 85 | + |
| 86 | +- **Linter** ([LuaCheck]): |
| 87 | + |
| 88 | + ```sh |
| 89 | + luacheck . |
| 90 | + ``` |
| 91 | + |
| 92 | +- **Formatter** ([StyLua]): |
| 93 | + |
| 94 | + ```sh |
| 95 | + stylua . --check |
| 96 | + ``` |
| 97 | + |
| 98 | +- **Static Analysis & Type Checking** ([Lua Language Server]): |
| 99 | + |
| 100 | + We use `lua-language-server` (LLS) for static type checking. You can keep |
| 101 | + standard definitions (like Busted, LuaAssert, and LuaFileSystem) in a |
| 102 | + shareable directory on your machine: |
| 103 | + |
| 104 | + ```sh |
| 105 | + mkdir -p ~/.local/share/lua/types |
| 106 | + cd ~/.local/share/lua/types |
| 107 | + git clone --depth 1 https://github.com/LuaCATS/busted.git |
| 108 | + git clone --depth 1 https://github.com/LuaCATS/luassert.git |
| 109 | + git clone --depth 1 https://github.com/LuaCATS/luafilesystem.git |
| 110 | + ``` |
| 111 | + |
| 112 | + To run the analysis locally: |
| 113 | + |
| 114 | + ```sh |
| 115 | + lua-language-server --check . |
| 116 | + ``` |
| 117 | + |
| 118 | +## Improving The Documentation |
| 119 | + |
| 120 | +- The documentation website code and guides live in the [bluelua.github.io] |
| 121 | + repository. |
| 122 | +- For website updates, guides, or layout improvements, please open [pull |
| 123 | + requests] there. |
| 124 | +- For inline API documentation changes, update the annotations under the |
| 125 | + [types/] directory. Do not write documentation directly in the source code |
| 126 | + under the [src/] directory. |
| 127 | + |
| 128 | +## Styleguides |
| 129 | + |
| 130 | +### Commit Messages |
| 131 | + |
| 132 | +This project follows [Conventional Commits] 1.0.0. |
| 133 | + |
| 134 | +[bluelua.github.io]: https://github.com/BlueLua/bluelua.github.io |
| 135 | +[Busted]: https://github.com/lunarmodules/busted |
| 136 | +[Conventional Commits]: https://www.conventionalcommits.org/en/v1.0.0/ |
| 137 | +[discussion]: https://github.com/BlueLua/tty/discussions |
| 138 | +[discussions]: https://github.com/BlueLua/tty/discussions |
| 139 | +[documentation]: https://bluelua.github.io/tty |
| 140 | +[issue]: https://github.com/BlueLua/tty/issues |
| 141 | +[issues]: https://github.com/BlueLua/tty/issues |
| 142 | +[LICENSE]: LICENSE |
| 143 | +[LuaCheck]: https://github.com/mpeterv/luacheck |
| 144 | +[Lua Language Server]: https://github.com/LuaLS/lua-language-server |
| 145 | +[PR]: https://github.com/BlueLua/tty/pulls |
| 146 | +[pull requests]: https://github.com/BlueLua/bluelua.github.io/pulls |
| 147 | +[StyLua]: https://github.com/JohnnyMorganz/StyLua |
| 148 | +[tests/]: tests/ |
| 149 | +[types/]: types/ |
| 150 | +[src/]: src/ |
0 commit comments