1
0
mirror of https://github.com/janet-lang/janet synced 2024-12-01 04:19:55 +00:00

Add astyle guidelines to the contributing document.

This commit is contained in:
Calvin Rose 2019-02-19 20:59:34 -05:00
parent 9d4effc02e
commit c022a1cf1a

View File

@ -29,7 +29,12 @@ may require changes before being merged.
run tests with `make test`. If you want to add a new test suite, simply add a file to run tests with `make test`. If you want to add a new test suite, simply add a file to
the test folder and make sure it is run when`make test` is invoked. the test folder and make sure it is run when`make test` is invoked.
* Be consistent with the style. For C this means follow the indentation and style in * Be consistent with the style. For C this means follow the indentation and style in
other files (files have MIT license at top, 4 spaces indentation, no trailing whitespace, cuddled brackets, etc.) other files (files have MIT license at top, 4 spaces indentation, no trailing
whitespace, cuddled brackets, etc.) Use `make format` to
automatically format your C code with
[astyle](http://astyle.sourceforge.net/astyle.html). You will probably need
to install this, but it can be installed with most package managers.
For janet code, the use lisp indentation with 2 spaces. One can use janet.vim to For janet code, the use lisp indentation with 2 spaces. One can use janet.vim to
do this indentation, or approximate as close as possible. do this indentation, or approximate as close as possible.
@ -51,6 +56,11 @@ Code should compile warning free and run valgrind clean. I find that these two c
of the easiest ways to protect against a large number of bugs in an unsafe language like C. To check for of the easiest ways to protect against a large number of bugs in an unsafe language like C. To check for
valgrind errors, run `make valtest` and check the output for undefined or flagged behavior. valgrind errors, run `make valtest` and check the output for undefined or flagged behavior.
### Formatting
Use [astyle](http://astyle.sourceforge.net/astyle.html) via `make format` to
ensure a consistent code style for C.
## Janet style ## Janet style
All janet code in the project should be formatted similar to the code in core.janet. All janet code in the project should be formatted similar to the code in core.janet.