mirror of
https://github.com/espressif/openthread.git
synced 2026-09-05 08:40:06 +00:00
[pretty] downgrade to clang-format/tidy v9.0 (#5761)
This commit is contained in:
@@ -47,7 +47,7 @@ jobs:
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
sudo apt-get --no-install-recommends install -y clang-format-10 clang-tidy-10 shellcheck
|
||||
sudo apt-get --no-install-recommends install -y clang-format-9 clang-tidy-9 shellcheck
|
||||
python3 -m pip install yapf==0.29.0
|
||||
sudo snap install shfmt
|
||||
- name: Check
|
||||
@@ -99,7 +99,7 @@ jobs:
|
||||
- name: Bootstrap
|
||||
run: |
|
||||
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
|
||||
sudo apt-get --no-install-recommends install -y clang-tools-10
|
||||
sudo apt-get --no-install-recommends install -y clang-tools-9
|
||||
- name: Run
|
||||
run: |
|
||||
script/check-scan-build
|
||||
|
||||
+1
-1
@@ -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 `script/make-pretty` and `script/make-pretty check` to automatically reformat code and check for code-style compliance, respectively. OpenThread currently requires [clang-format v10.0.0](http://releases.llvm.org/download.html#10.0.0) for C/C++ and [yapf v0.29.0](https://github.com/google/yapf) for Python.
|
||||
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 v9.0.0](https://releases.llvm.org/download.html#9.0.0) for C/C++ and [yapf v0.29.0](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.
|
||||
|
||||
|
||||
+2
-2
@@ -116,7 +116,7 @@
|
||||
|
||||
- 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.
|
||||
|
||||
- `script/make-pretty` requires [clang-format v10.0.0](http://releases.llvm.org/download.html#10.0.0) for C/C++ and [yapf v0.29.0](https://github.com/google/yapf) for Python.
|
||||
- `script/make-pretty` requires [clang-format v9.0.0](https://releases.llvm.org/download.html#9.0.0) for C/C++ and [yapf v0.29.0](https://github.com/google/yapf) for Python.
|
||||
|
||||
### File Names
|
||||
|
||||
@@ -188,4 +188,4 @@
|
||||
|
||||
## Format and Style
|
||||
|
||||
- All code should adhere to [Google Python Style Guide](http://google.github.io/styleguide/pyguide.html) except maximum line length being 119.
|
||||
- All code should adhere to [Google Python Style Guide](https://google.github.io/styleguide/pyguide.html) except maximum line length being 119.
|
||||
|
||||
+4
-4
@@ -59,7 +59,7 @@ install_packages_apt()
|
||||
echo 'Installing pretty tools useful for code contributions...'
|
||||
|
||||
# add clang-format and clang-tidy for pretty
|
||||
sudo apt-get --no-install-recommends install -y clang-format-10 clang-tidy-10
|
||||
sudo apt-get --no-install-recommends install -y clang-format-9 clang-tidy-9
|
||||
|
||||
# add yapf for pretty
|
||||
python3 -m pip install yapf==0.29.0 || echo 'WARNING: could not install yapf, which is useful if you plan to contribute python code to the OpenThread project.'
|
||||
@@ -104,9 +104,9 @@ install_packages_brew()
|
||||
|
||||
# add clang-format for pretty
|
||||
CLANG_FORMAT_VERSION="clang-format version 10"
|
||||
command -v clang-format-10 || (command -v clang-format && (clang-format --version | grep -q "${CLANG_FORMAT_VERSION}")) || {
|
||||
brew install llvm@10
|
||||
sudo ln -s "$(brew --prefix llvm@10)/bin/clang-format" /usr/local/bin/clang-format-10
|
||||
command -v clang-format-9 || (command -v clang-format && (clang-format --version | grep -q "${CLANG_FORMAT_VERSION}")) || {
|
||||
brew install llvm@9
|
||||
sudo ln -s "$(brew --prefix llvm@9)/bin/clang-format" /usr/local/bin/clang-format-9
|
||||
}
|
||||
|
||||
# add yapf for pretty
|
||||
|
||||
@@ -96,12 +96,12 @@ do_scan_build()
|
||||
)
|
||||
|
||||
export CPPFLAGS="${options[*]} -DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1"
|
||||
scan-build-10 ./configure "${configure_options[@]}"
|
||||
scan-build-10 --status-bugs -analyze-headers -v make -j"${OT_BUILD_JOBS}"
|
||||
scan-build-9 ./configure "${configure_options[@]}"
|
||||
scan-build-9 --status-bugs -analyze-headers -v make -j"${OT_BUILD_JOBS}"
|
||||
|
||||
export CPPFLAGS="${options[*]} -DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1"
|
||||
scan-build-10 ./configure "${configure_options[@]}"
|
||||
scan-build-10 --status-bugs -analyze-headers -v make -j"${OT_BUILD_JOBS}"
|
||||
scan-build-9 ./configure "${configure_options[@]}"
|
||||
scan-build-9 --status-bugs -analyze-headers -v make -j"${OT_BUILD_JOBS}"
|
||||
}
|
||||
|
||||
main()
|
||||
|
||||
+5
-5
@@ -27,7 +27,7 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
CLANG_FORMAT_VERSION="clang-format version 10.0"
|
||||
CLANG_FORMAT_VERSION="clang-format version 9.0"
|
||||
|
||||
die()
|
||||
{
|
||||
@@ -39,18 +39,18 @@ die()
|
||||
# expand_aliases shell option is set using shopt.
|
||||
shopt -s expand_aliases
|
||||
|
||||
if command -v clang-format-10 >/dev/null; then
|
||||
alias clang-format=clang-format-10
|
||||
if command -v clang-format-9 >/dev/null; then
|
||||
alias clang-format=clang-format-9
|
||||
elif command -v clang-format >/dev/null; then
|
||||
case "$(clang-format --version)" in
|
||||
"$CLANG_FORMAT_VERSION"*) ;;
|
||||
|
||||
*)
|
||||
die "$(clang-format --version); clang-format 10.0 required"
|
||||
die "$(clang-format --version); clang-format 9.0 required"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
die "clang-format 10.0 required"
|
||||
die "clang-format 9.0 required"
|
||||
fi
|
||||
|
||||
clang-format "$@" || die
|
||||
|
||||
+16
-16
@@ -27,8 +27,8 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
CLANG_TIDY_VERSION="LLVM version 10.0"
|
||||
CLANG_APPLY_REPLACEMENTS_VERSION="clang-apply-replacements version 10.0"
|
||||
CLANG_TIDY_VERSION="LLVM version 9.0"
|
||||
CLANG_APPLY_REPLACEMENTS_VERSION="clang-apply-replacements version 9.0"
|
||||
|
||||
die()
|
||||
{
|
||||
@@ -36,9 +36,9 @@ die()
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Search for clang-tidy-10
|
||||
if command -v clang-tidy-10 >/dev/null; then
|
||||
clang_tidy=$(command -v clang-tidy-10)
|
||||
# Search for clang-tidy-9
|
||||
if command -v clang-tidy-9 >/dev/null; then
|
||||
clang_tidy=$(command -v clang-tidy-9)
|
||||
elif command -v clang-tidy >/dev/null; then
|
||||
clang_tidy=$(command -v clang-tidy)
|
||||
case "$($clang_tidy --version)" in
|
||||
@@ -49,12 +49,12 @@ elif command -v clang-tidy >/dev/null; then
|
||||
;;
|
||||
esac
|
||||
else
|
||||
die "clang-tidy 10.0 required"
|
||||
die "clang-tidy 9.0 required"
|
||||
fi
|
||||
|
||||
# Search for clang-apply-replacements-10
|
||||
if command -v clang-apply-replacements-10 >/dev/null; then
|
||||
clang_apply_replacements=$(command -v clang-apply-replacements-10)
|
||||
# Search for clang-apply-replacements-9
|
||||
if command -v clang-apply-replacements-9 >/dev/null; then
|
||||
clang_apply_replacements=$(command -v clang-apply-replacements-9)
|
||||
elif command -v clang-apply-replacements >/dev/null; then
|
||||
clang_apply_replacements=$(command -v clang-apply-replacements)
|
||||
case "$($clang_apply_replacements --version)" in
|
||||
@@ -65,20 +65,20 @@ elif command -v clang-apply-replacements >/dev/null; then
|
||||
;;
|
||||
esac
|
||||
else
|
||||
die "clang-apply-replacements 10.0 required"
|
||||
die "clang-apply-replacements 9.0 required"
|
||||
fi
|
||||
|
||||
# Search for run-clang-tidy-10.py
|
||||
if command -v run-clang-tidy-10.py >/dev/null; then
|
||||
run_clang_tidy=$(command -v run-clang-tidy-10.py)
|
||||
elif command -v run-clang-tidy-10 >/dev/null; then
|
||||
run_clang_tidy=$(command -v run-clang-tidy-10)
|
||||
# Search for run-clang-tidy-9.py
|
||||
if command -v run-clang-tidy-9.py >/dev/null; then
|
||||
run_clang_tidy=$(command -v run-clang-tidy-9.py)
|
||||
elif command -v run-clang-tidy-9 >/dev/null; then
|
||||
run_clang_tidy=$(command -v run-clang-tidy-9)
|
||||
elif command -v run-clang-tidy.py >/dev/null; then
|
||||
run_clang_tidy=$(command -v run-clang-tidy.py)
|
||||
elif command -v run-clang-tidy >/dev/null; then
|
||||
run_clang_tidy=$(command -v run-clang-tidy)
|
||||
else
|
||||
die "run-clang-tidy.py 10.0 required"
|
||||
die "run-clang-tidy.py 9.0 required"
|
||||
fi
|
||||
|
||||
$run_clang_tidy -clang-tidy-binary "$clang_tidy" -clang-apply-replacements-binary "$clang_apply_replacements" "$@" || die
|
||||
|
||||
Reference in New Issue
Block a user