CONTRIBUTING.md 2.5 KB
Newer Older
1 2 3 4
# Contributing to darktable

The darktable project welcomes contributions:

supertobi's avatar
supertobi committed
5 6
* [Code](https://www.darktable.org/development/)
* [Documentation](https://www.darktable.org/resources/)
7 8 9 10 11
* Testing (and any backtraces if you happpen to crash darktable)
* Translations
* [Camera profiles](https://www.darktable.org/resources/camera-support/).
* Tutorials, screencasts, etc.

supertobi's avatar
supertobi committed
12
See the [darktable development page](https://www.darktable.org/development/) for
13 14 15 16 17 18 19 20
more information.

## Code

Before you spend a lot of time working on a new feature, it's always best to
discuss your proposed changes with us first.  The best place to do that is in
our IRC channel on **irc.freenode.net**, channel **#darktable** or the
development mailing list, [see here for more
supertobi's avatar
supertobi committed
21
information](https://www.darktable.org/contact/).  This will dramatically
22 23
improve your chances of having your code merged, especially if we think you'll
hang around to maintain it.
24 25 26 27 28 29 30 31 32 33 34

### Coding style

We like our code to be properly formatted. We have a well-defined coding style, 
and [.clang-format](.clang-format) style file represents it fully.
You can enforce your commits to follow it:

1. Install [clang-format](http://clang.llvm.org/docs/ClangFormat.html) clang tool. Probably, any version will be ok, but the newer the better.
2. You'll need to integrate `git` and `clang-format`.
  * For that, you will need to download `git-clang-format` from [here](https://github.com/llvm-mirror/clang/blob/master/tools/clang-format/git-clang-format) or [here](https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/git-clang-format).
  * Read it to check for nastiness.
35
  * Warning: apparently, it only works with Python2, and does not work with Python3!
36 37 38 39 40
  * Put it somewhere in your path (e.g. `~/bin` or `/usr/local/bin`) and ensure that it is executable (`chmod +x`).
3. Now, step into your local clone of repository:
  * `cd darktable/.git/hooks`
  * If you previously did not have a `pre-commit` hook:
    * `cp pre-commit.sample pre-commit && chmod +x pre-commit`
41
  * Open `pre-commit` with your favourite text editor, and append before the last block, here is how the end should look:
42 43 44 45 46 47 48 49 50
```
# format everything
res=$(git clang-format --diff | wc -l)
if [ $res -ne 1 ]
then
	git clang-format
	echo "Commit did not match clang-format"
	exit 1;
fi
51 52 53

# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --
54
```
supertobi's avatar
supertobi committed
55
* Also, there is a [Coding Style](https://redmine.darktable.org/projects/darktable/wiki/Coding_Style) page on our redmine wiki.