@@ -47,29 +47,53 @@ People *love* thorough bug reports.
4747## Use a Consistent Coding Style
4848
4949* We use clang-format tool to check code style.
50- * In project we have two different code style:
51- - Style config file for Windows driver /.clang-format
52- - Style config file for VirtIO library /VirtIO/.clang-format
53- * To run code style check locally on Linux or Windows (with MSYS or cygwin) use ` Tools/clang-format-helper.sh ` helper
54- - on Linux helper uses ` clang-format-16 ` from PATH (because EWDK Win11 24H2 contains clang-format version 16.0.5)
55- - on Windows helper uses ` clang-format ` from EWDK Win11 24H2
56- - CLI:
57- - For all Windows drivers
58- ``` bash
59- bash Tools/clang-format-helper.sh check ' .' ' ' ' ./VirtIO'
60- ```
61- - For VirtIO library
62- ` ` ` bash
63- bash Tools/clang-format-helper.sh check ' VirtIO' ' ' ' '
64- ` ` `
65- * Tools/clang-format-helper.sh uses positional arguments
66- 1. Action: ` check` or ` format`
67- 1. Directory where needs to check format
68- 1. Path to .clang-format file (default: ` ${2} /.clang-format` )
69- 1. Exclude regexp (default: ` ^$` )
70- 1. Include regexp (default: ` ^.* \. (( ((c| C)(c| pp| xx| \+ \+ )? $)| ((h| H)h? (pp| xx| \+ \+ )? $)) )$` )
71-
72- - To use default just put ' ' as argument
50+ * In project we have two different code styles:
51+ - Style config file for Windows driver: ` /.clang-format `
52+ - Style config file for VirtIO library: ` /VirtIO/.clang-format `
53+ * To run code style check locally on Linux or Windows (with MSYS or cygwin) use the ` Tools/clang-format-helper.sh ` helper
54+ - on Linux, the helper uses ` clang-format-16 ` from PATH (because EWDK Win11 24H2 contains clang-format version 16.0.5)
55+ - on Windows, the helper uses ` clang-format ` from EWDK Win11 24H2
56+
57+ * Usage for clang-format helper tool:
58+ ``` bash
59+ bash Tools/clang-format-helper.sh < check| format> < target directory> < path to .clang-format file> < exclude regexp> < include regexp>
60+ ```
61+
62+ <details >
63+ <summary >More information on positional arguments and defaults...</summary >
64+ <br >
65+
66+ Positional parameters:
67+
68+ * 1\. Action: ` check ` or ` format ` . Required.
69+ * 2\. Directory to perform action. Required.
70+ * 3\. Path to .clang-format file (default: ` ${2}/.clang-format ` )
71+ * 4\. Exclude regexp (default: ` ^$ ` )
72+ * 5\. Include regexp (default: ` ^.*\.((((c|C)(c|pp|xx|\+\+)?$)|((h|H)h?(pp|xx|\+\+)?$)))$ ` )
73+
74+ Note: to use a default parameter use two single quotes, i.e. ` '' `
75+ </details >
76+
77+ <details >
78+ <summary >Usage Examples</summary >
79+ <br >
80+
81+ For all Windows drivers:
82+
83+ ``` bash
84+ bash Tools/clang-format-helper.sh check ' .' ' ' ' ./VirtIO'
85+ ```
86+ For ` vioscsi ` driver:
87+
88+ ``` bash
89+ bash Tools/clang-format-helper.sh check ' ./vioscsi' ' ./.clang-format' ' .*/*trace.h|.*/wpp_.*_path.*.h' ' '
90+ ```
91+ For ` VirtIO ` library:
92+
93+ ``` bash
94+ bash Tools/clang-format-helper.sh check ' VirtIO' ' ' ' '
95+ ```
96+ </details >
7397
7498## HCK\HLK tests
7599* The contributions should pass Microsoft certification tests. We are running CI to check that the changes in the pull request can pass. If you submit a lot of PRs, you can setup AutoHCK on your premises to test your code changes: [ auto-hck setup] ( https://github.com/HCK-CI/HCK-CI-DOCS/blob/master/installing-hck-ci-from-scratch.txt )
0 commit comments