diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6fda36ac8..7ad921d8a 100755 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -13,7 +13,6 @@ Fixes # (GitHub issue) ## All Submissions - [ ] Do all unit tests pass locally? Attach a log. -- [ ] Have you formatted the code using clang-format? ## New interfaces diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2840fcbd6..7781b9c6e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -81,7 +81,16 @@ The general principle is to follow the style of existing/surrounding code. If yo ```sh clang-format -style=file -i foo.cpp ``` -This formats code using the `_clang_format` file found in the oneMKL top-level directory. +This formats code using the `_clang_format` file found in the oneMKL top-level directory. The version of `clang-format` is specified in [`.pre-commit-config.yaml`](https://github.com/oneapi-src/oneMKL/blob/develop/.pre-commit-config.yaml). Alternatively, you can install and run `pre-commit`, which will install the specified `clang-format` version automatically: +```sh +python3 -m venv +source /bin/activate +pip install pre-commit +cd +pre-commit run --all-files +deactivate +``` +By default, `pre-commit` caches data in `~/.cache/pre-commit`. You can set `PRE_COMMIT_HOME` to use another location. ### GN: General Naming diff --git a/scripts/generate_backend_api.py b/scripts/generate_backend_api.py index c3866270e..cc76a20b7 100755 --- a/scripts/generate_backend_api.py +++ b/scripts/generate_backend_api.py @@ -33,7 +33,7 @@ def usage(err = None): print('error: %s' % err) print('''\ Script to generate backend library header based on base_header.h -Note: requires clang-format 9.0.0 tool to be installed +Note: requires clang-format tool to be installed Usage: {script} diff --git a/scripts/generate_ct_instant.py b/scripts/generate_ct_instant.py index acc02e3ea..a30f53f21 100755 --- a/scripts/generate_ct_instant.py +++ b/scripts/generate_ct_instant.py @@ -33,7 +33,7 @@ def usage(err = None): print('error: %s' % err) print('''\ Script to generate CT API instantiations for backend based on general_ct_templates.hpp -Note: requires clang-format 9.0.0 tool to be installed +Note: requires clang-format tool to be installed Usage: {script} diff --git a/scripts/generate_ct_templates.py b/scripts/generate_ct_templates.py index 7f54d4f08..4827c43e1 100755 --- a/scripts/generate_ct_templates.py +++ b/scripts/generate_ct_templates.py @@ -33,7 +33,7 @@ def usage(err = None): print('error: %s' % err) print('''\ Script to generate header file for templated compile-time API based on base_header.h -Note: requires clang-format 9.0.0 tool to be installed +Note: requires clang-format tool to be installed Usage: {script} diff --git a/scripts/generate_wrappers.py b/scripts/generate_wrappers.py index 29947273f..c4e18d648 100755 --- a/scripts/generate_wrappers.py +++ b/scripts/generate_wrappers.py @@ -33,7 +33,7 @@ def usage(err = None): print('error: %s' % err) print('''\ Script to generate blank wrappers and pointers table based on header.hpp -Note: requires clang-format 9.0.0 tool +Note: requires clang-format tool Usage: {script}