mirror of
https://github.com/espressif/openthread.git
synced 2025-05-17 15:26:16 +08:00
[script] update make-pretty to bash (#4698)
- Also update CONTRIBUTING.md and STYLE_GUIDE.md.
This commit is contained in:
@ -109,7 +109,7 @@ This will open up a text editor where you can specify which commits to squash.
|
||||
|
||||
#### Coding Conventions and Style
|
||||
|
||||
OpenThread uses and enforces the [OpenThread Coding Conventions and Style](STYLE_GUIDE.md) on all code, except for code located in [third_party](third_party). Use the `script/make-pretty` and `script/make-pretty check` targets to automatically reformat code and check for code-style compliance, respectively. OpenThread currently requires [clang-format v6.0.0](http://releases.llvm.org/download.html#6.0.0) and [yapf](https://github.com/google/yapf) for `script/make-pretty` and `script/make-pretty check`.
|
||||
OpenThread uses and enforces the [OpenThread Coding Conventions and Style](STYLE_GUIDE.md) on all code, except for code located in [third_party](third_party). Use `script/make-pretty` and `script/make-pretty check` to automatically reformat code and check for code-style compliance, respectively. OpenThread currently requires [clang-format v6.0.0](http://releases.llvm.org/download.html#6.0.0) for C/C++ and [yapf](https://github.com/google/yapf) for Python.
|
||||
|
||||
As part of the cleanup process, you should also run `script/make-pretty check` to ensure that your code passes the baseline code style checks.
|
||||
|
||||
|
@ -114,9 +114,9 @@
|
||||
|
||||
## Format and Style
|
||||
|
||||
- OpenThread uses the `make pretty` build target to reformat code and enforce code format and style. The `make pretty-check` build target is included in OpenThread's continuous integration and must pass before a pull request is merged.
|
||||
- OpenThread uses `script/make-pretty` to reformat code and enforce code format and style. `script/make-pretty check` build target is included in OpenThread's continuous integration and must pass before a pull request is merged.
|
||||
|
||||
- The `make pretty` and `make pretty-check` build targets require [clang-format v6.0.0](http://releases.llvm.org/download.html#6.0.0).
|
||||
- `script/make-pretty` requires [clang-format v6.0.0](http://releases.llvm.org/download.html#6.0.0) for C/C++ and [yapf](https://github.com/google/yapf) for Python.
|
||||
|
||||
### File Names
|
||||
- File names should match the names and types of what is described in the file. If a file contains many declarations and definitions, the author should choose the one that predominantly describes or that makes the most sense.
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2018, The OpenThread Authors.
|
||||
# All rights reserved.
|
@ -45,6 +45,6 @@ die() {
|
||||
|
||||
for file in "$@"; do
|
||||
echo "Checking ${file}"
|
||||
"$(dirname "$0")"/clang-format.sh -style=file "${file}" | diff -u "${file}" - || die "${file} is not pretty."
|
||||
"$(dirname "$0")"/clang-format -style=file "${file}" | diff -u "${file}" - || die "${file} is not pretty."
|
||||
[ -z "$(tail -c1 "${file}")" ] || die "${file} misses EOF newline."
|
||||
done
|
@ -62,7 +62,7 @@ do_clang_format()
|
||||
echo -e '====================='
|
||||
|
||||
git ls-files "${OT_CLANG_SOURCES[@]}" | grep -E "^($(echo "${OT_CLANG_DIRS[@]}" | tr ' ' '|'))" \
|
||||
| xargs -n3 -P"${OT_BUILD_JOBS}" script/clang-format.sh -style=file -i -verbose
|
||||
| xargs -n3 -P"${OT_BUILD_JOBS}" script/clang-format -style=file -i -verbose
|
||||
}
|
||||
|
||||
do_clang_check()
|
||||
@ -72,7 +72,7 @@ do_clang_check()
|
||||
echo -e '====================='
|
||||
|
||||
git ls-files "${OT_CLANG_SOURCES[@]}" | grep -E "^($(echo "${OT_CLANG_DIRS[@]}" | tr ' ' '|'))" \
|
||||
| xargs -n3 -P"${OT_BUILD_JOBS}" script/clang-format-check.sh
|
||||
| xargs -n3 -P"${OT_BUILD_JOBS}" script/clang-format-check
|
||||
}
|
||||
|
||||
do_python_format()
|
||||
|
Reference in New Issue
Block a user