Skip to content

Latest commit

 

History

History
48 lines (32 loc) · 2.01 KB

contributing.md

File metadata and controls

48 lines (32 loc) · 2.01 KB

Some guidelines and tips for development.

git

Feel free to fork this repository and create a pull request. Before making a large change, please open an issue to discuss it.

Make descriptive, granular commits. No need to squash them for the pull request.

If you drift too far from the master branch, please merge rather than rebasing. This will preserve the commit history that shows the context in which the code was written.

style

  • Tabs for indenting. Spaces for alignment.
  • Wrap discrete chunks of code in functions. This makes writing tests easier.
  • See .editorconfig for more specifics and exceptions.
  • Follow the style you see in the code that's already here.

testing

Have bats installed.

Groups of tests are in .bats files in the repository root. You can run tests manually or use the ./watch script (requires entr) to automatically run them when any file is changed.

Discrete chunks of code should have a discrete set of tests. If possible, tests should call the relevant function rather than running the whole script.

Write tests like executable specifications.

Group together tests that share a common subject by indenting test names with spaces, to achieve output similar to Mocha or RSpec.

For anything that involves touching the file system, use setup() & teardown() functions to create a temporary directory:

setup() {
	run mktemp -dt deploy_test.XXXX
	assert_success
	tmp=$output
	pushd "$tmp" >/dev/null
}
teardown() {
	popd >/dev/null
	rm -rf "$tmp"
}

Finally, make sure the .bats files are in a path that's accounted-for in circle.yml.