diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3bd323237..45199b268 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5fca49804..b043d6a28 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/STYLE_GUIDE.md b/STYLE_GUIDE.md index 74e9c698c..04f96aba6 100644 --- a/STYLE_GUIDE.md +++ b/STYLE_GUIDE.md @@ -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. diff --git a/script/bootstrap b/script/bootstrap index e84eda6ef..b2ea32ba6 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -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 diff --git a/script/check-scan-build b/script/check-scan-build index fd327f78f..38323717e 100755 --- a/script/check-scan-build +++ b/script/check-scan-build @@ -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() diff --git a/script/clang-format b/script/clang-format index addb7fa47..01b9535e0 100755 --- a/script/clang-format +++ b/script/clang-format @@ -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 diff --git a/script/clang-tidy b/script/clang-tidy index 48f03db25..b2dfb4d4d 100755 --- a/script/clang-tidy +++ b/script/clang-tidy @@ -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