|
| 1 | +Hello and thank-you for considering contributing to lua-http! |
| 2 | + |
| 3 | +If you haven't already, see the [getting started](https://github.com/daurnimator/lua-http#getting-started) section of the main readme. |
| 4 | + |
| 5 | +# Contributing |
| 6 | + |
| 7 | +To submit your code for inclusion, please [send a "pull request" using github](https://github.com/daurnimator/lua-http/pulls). |
| 8 | +For a speedy approval, please: |
| 9 | + |
| 10 | + - Follow the [coding style](#coding-style) |
| 11 | + - Run [`luacheck`](https://github.com/mpeterv/luacheck) to lint your code |
| 12 | + - Include [tests](#tests) |
| 13 | + - Bug fixes should add a test exhibiting the issue |
| 14 | + - Enhancements must add tests for the new feature |
| 15 | + - [Sign off](#dco) your code |
| 16 | + |
| 17 | + |
| 18 | +If you are requested by a project maintainer to fix an issue with your pull request, please edit your existing commits (using e.g. `git commit --amend` or [`git fixup`](https://github.com/hashbang/dotfiles/blob/master/git/.local/bin/git-fixup)) rather than pushing new commits on top of the old ones. |
| 19 | + |
| 20 | +All commits *should* have the project in an operational state. |
| 21 | + |
| 22 | + |
| 23 | +# Coding Style |
| 24 | + |
| 25 | +When editing an existing file, please follow the coding style used in that file. |
| 26 | +If not clear from context or if you're starting a new file: |
| 27 | + |
| 28 | + - Indent with tabs |
| 29 | + - Alignment should not be done; when unavoidable, align with spaces |
| 30 | + - Remove any trailing whitespace (unless whitespace is significant as it can be in e.g. markdown) |
| 31 | + - Things (e.g. table fields) should be ordered by: |
| 32 | + 1. Required vs optional |
| 33 | + 2. Importance |
| 34 | + 3. Lexographically (alphabetically) |
| 35 | + |
| 36 | + |
| 37 | +## Lua conventions |
| 38 | + |
| 39 | + - Add a `__name` field to metatables |
| 40 | + - Use a separate table than the metatable itself for `__index` |
| 41 | + - Single-line table definitions should use commas (`,`) for delimiting elements |
| 42 | + - Multi-line table definitions should use semicolons (`;`) for delimiting elements |
| 43 | + |
| 44 | + |
| 45 | +## Markdown conventions |
| 46 | + |
| 47 | + - Files should have two blank lines at the end of a section |
| 48 | + - Repository information files (e.g. README.md/CONTRIBUTING.md) should use github compatible markdown features |
| 49 | + - Files used to generate documentation can use any `pandoc` features they want |
| 50 | + |
| 51 | + |
| 52 | +# Tests |
| 53 | + |
| 54 | +The project has a test suite using the [`busted`](https://github.com/Olivine-Labs/busted) framework. |
| 55 | +Coverage is measured using [`luacov`](https://github.com/keplerproject/luacov). |
| 56 | + |
| 57 | +Tests can be found in the `spec/` directory at the root of the repository. Each source file should have its own file full of tests. |
| 58 | + |
| 59 | +Tests should avoid running any external processes. Use `cqueues` to start up various test servers and clients in-process. |
| 60 | + |
| 61 | +A successful test should close any file handles and sockets to avoid resource exhaustion. |
| 62 | + |
| 63 | + |
| 64 | +# Legal |
| 65 | + |
| 66 | +All code in the repository is covered by `LICENSE.md`. |
| 67 | + |
| 68 | +## DCO |
| 69 | + |
| 70 | +A git `Signed-off-by` statement in a commit message in this repository refers to the [Developer Certificate of Origin](https://developercertificate.org/) (DCO). |
| 71 | +By signing off your commit you are making a legal statement that the work is contributed under the license of this project. |
| 72 | +You can add the statement to your commit by passing `-s` to `git commit` |
| 73 | + |
| 74 | + |
| 75 | +# Security |
| 76 | + |
| 77 | +If you find a security vulnerabilities in the project and do not wish to file it publically on the [issue tracker](https://github.com/daurnimator/lua-http/issues) then you may email [lua-http-security@daurnimator.com](mailto:lua-http-security@daurnimator.com). You may encrypt your mail using PGP to the key with fingerprint [954A3772D62EF90E4B31FBC6C91A9911192C187A](https://daurnimator.com/post/109075829529/gpg-key). |
0 commit comments