diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2017-03-24 09:13:24 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2017-04-07 16:32:33 +0800 |
commit | 2f0a8449f37b978eb202082b9113039b00c6931a (patch) | |
tree | 06333d75b6058f6ee64918ddbf1b52398dc72f09 /CONTRIBUTING.md | |
parent | 85d5aa7602fcc5e0561f93eff155353cbf903816 (diff) | |
download | libva-intel-driver-2f0a8449f37b978eb202082b9113039b00c6931a.tar.gz |
Add pre-commit hook
Check that the code follows a consistant coding style before committing.
The current command will be interrupted if the commit doesn't follow the
code style
This fixes https://github.com/01org/intel-vaapi-driver/issues/99
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Diffstat (limited to 'CONTRIBUTING.md')
-rw-r--r-- | CONTRIBUTING.md | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dde531ed..7f3abdfe 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,7 +4,39 @@ Intel-vaapi-driver is an open source project licensed under the [MIT License] (h ## Coding Style -Intel-vaapi-driver does not have a defined coding style at this time, but that will be updated. +In our project we follow the Linux coding style with a few changes. You may run 'astyle --style=linux -cnpUH -s4 -M120 <file>' +to format/indent a single file or run './style_unify' in the top-level directory to handle all .c/.h files in the src directory. + +You will fail to commit your patch if your patch doesn't follow the coding style and the pre-commit hook will prompt you to fix +the coding style. + +For example: + +``` +Checking coding style... + +--- .merge_file_tZMQ4C 2017-03-31 11:02:36.244617415 +0800 ++++ /tmp/.merge_file_tZMQ4C.D0V 2017-03-31 11:02:36.274617276 +0800 +@@ -438,8 +438,7 @@ intel_batchbuffer_align(struct intel_bat + assert((pad_size & 3) == 0); + assert(intel_batchbuffer_space(batch) >= pad_size); + +- while (pad_size >= 4) +- { ++ while (pad_size >= 4) { + intel_batchbuffer_emit_dword(batch, 0); + pad_size -= 4; + } + +************************************************************************** + Coding style error in src/intel_batchbuffer.c + + Please fix the coding style before committing. You may run the command + below to fix the coding style from the top-level directory + + astyle --style=linux -cnpUH -s4 -M120 src/intel_batchbuffer.c +************************************************************************** +``` ## Certificate of Origin |