diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 603aba6d4..5fb7473dd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,7 +50,7 @@ jobs: run: | sudo rm /etc/apt/sources.list.d/* && sudo apt-get update sudo apt-get --no-install-recommends install -y clang-format-9 clang-tidy-9 shellcheck - python3 -m pip install yapf==0.29.0 + python3 -m pip install yapf==0.31.0 sudo snap install shfmt - name: Check run: | diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c33dbad96..18560c95d 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 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. +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.31.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 04f96aba6..0feed0524 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 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. +- `script/make-pretty` requires [clang-format v9.0.0](https://releases.llvm.org/download.html#9.0.0) for C/C++ and [yapf v0.31.0](https://github.com/google/yapf) for Python. ### File Names diff --git a/script/bootstrap b/script/bootstrap index 1fcd8324e..3af33a367 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -41,7 +41,7 @@ install_packages_pretty_format() sudo apt-get --no-install-recommends install -y clang-format-9 clang-tidy-9 || echo 'WARNING: could not install clang-format-9 and clang-tidy-9, which is useful if you plan to contribute C/C++ code to the OpenThread project.' # 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.' + python3 -m pip install yapf==0.31.0 || echo 'WARNING: could not install yapf, which is useful if you plan to contribute python code to the OpenThread project.' # add mdv for local size report python3 -m pip install mdv || echo 'WARNING: could not install mdv, which is required to post markdown size report for OpenThread.' diff --git a/tests/scripts/thread-cert/command.py b/tests/scripts/thread-cert/command.py index 4014153c3..e1944932b 100644 --- a/tests/scripts/thread-cert/command.py +++ b/tests/scripts/thread-cert/command.py @@ -388,15 +388,15 @@ def check_prefix(prefix): def check_child_update_request_from_child( - command_msg, - source_address=CheckType.OPTIONAL, - leader_data=CheckType.OPTIONAL, - challenge=CheckType.OPTIONAL, - time_out=CheckType.OPTIONAL, - address_registration=CheckType.OPTIONAL, - tlv_request_tlv=CheckType.OPTIONAL, - active_timestamp=CheckType.OPTIONAL, - CIDs=(), + command_msg, + source_address=CheckType.OPTIONAL, + leader_data=CheckType.OPTIONAL, + challenge=CheckType.OPTIONAL, + time_out=CheckType.OPTIONAL, + address_registration=CheckType.OPTIONAL, + tlv_request_tlv=CheckType.OPTIONAL, + active_timestamp=CheckType.OPTIONAL, + CIDs=(), ): command_msg.assertMleMessageContainsTlv(mle.Mode) @@ -485,16 +485,16 @@ def check_child_update_request_from_parent( def check_child_update_response( - command_msg, - timeout=CheckType.OPTIONAL, - address_registration=CheckType.OPTIONAL, - address16=CheckType.OPTIONAL, - leader_data=CheckType.OPTIONAL, - network_data=CheckType.OPTIONAL, - response=CheckType.OPTIONAL, - link_layer_frame_counter=CheckType.OPTIONAL, - mle_frame_counter=CheckType.OPTIONAL, - CIDs=(), + command_msg, + timeout=CheckType.OPTIONAL, + address_registration=CheckType.OPTIONAL, + address16=CheckType.OPTIONAL, + leader_data=CheckType.OPTIONAL, + network_data=CheckType.OPTIONAL, + response=CheckType.OPTIONAL, + link_layer_frame_counter=CheckType.OPTIONAL, + mle_frame_counter=CheckType.OPTIONAL, + CIDs=(), ): """Verify a properly formatted Child Update Response from parent """ diff --git a/tests/scripts/thread-cert/test_coap.py b/tests/scripts/thread-cert/test_coap.py index 96502b874..368bd9851 100755 --- a/tests/scripts/thread-cert/test_coap.py +++ b/tests/scripts/thread-cert/test_coap.py @@ -108,7 +108,7 @@ def any_uri_path(): class TestCoapMessageOptionHeader(unittest.TestCase): def test_should_return_passed_on_value_when_read_extended_value_is_called_with_value_different_than_13_and_14( - self): + self): # GIVEN value = any_4bits_value_different_than_13_and_14() @@ -119,7 +119,7 @@ class TestCoapMessageOptionHeader(unittest.TestCase): self.assertEqual(value, actual_value) def test_should_return_value_stored_in_first_byte_plus_13_when_read_extended_value_is_called_with_value_equal_13( - self): + self): # GIVEN value = 13 extended_value = any_value() @@ -133,7 +133,7 @@ class TestCoapMessageOptionHeader(unittest.TestCase): self.assertEqual(extended_value + 13, actual_value) def test_should_return_value_stored_in_first_byte_plus_269_when_read_extended_value_is_called_with_value_equal_14( - self): + self): # GIVEN value = 14 extended_value = any_value() diff --git a/tools/harness-thci/OpenThread.py b/tools/harness-thci/OpenThread.py index db354e018..43f6c2fba 100644 --- a/tools/harness-thci/OpenThread.py +++ b/tools/harness-thci/OpenThread.py @@ -2246,12 +2246,11 @@ class OpenThreadTHCI(object): if 'recv' in infoValue else PlatformDiagnosticPacket_Direction.OUT if 'send' in infoValue else PlatformDiagnosticPacket_Direction.UNKNOWN) elif 'type' in infoType: - EncryptedPacket.Type = (PlatformDiagnosticPacket_Type.JOIN_FIN_req - if 'JOIN_FIN.req' in infoValue else - PlatformDiagnosticPacket_Type.JOIN_FIN_rsp if 'JOIN_FIN.rsp' in infoValue - else PlatformDiagnosticPacket_Type.JOIN_ENT_req if 'JOIN_ENT.ntf' in - infoValue else PlatformDiagnosticPacket_Type.JOIN_ENT_rsp if 'JOIN_ENT.rsp' - in infoValue else PlatformDiagnosticPacket_Type.UNKNOWN) + EncryptedPacket.Type = (PlatformDiagnosticPacket_Type.JOIN_FIN_req if 'JOIN_FIN.req' in infoValue + else PlatformDiagnosticPacket_Type.JOIN_FIN_rsp if 'JOIN_FIN.rsp' + in infoValue else PlatformDiagnosticPacket_Type.JOIN_ENT_req if + 'JOIN_ENT.ntf' in infoValue else PlatformDiagnosticPacket_Type.JOIN_ENT_rsp + if 'JOIN_ENT.rsp' in infoValue else PlatformDiagnosticPacket_Type.UNKNOWN) elif 'len' in infoType: bytesInEachLine = 16 EncryptedPacket.TLVsLength = int(infoValue) diff --git a/tools/harness-thci/OpenThread_WpanCtl.py b/tools/harness-thci/OpenThread_WpanCtl.py index bcd1d51d9..95c2b3f6e 100644 --- a/tools/harness-thci/OpenThread_WpanCtl.py +++ b/tools/harness-thci/OpenThread_WpanCtl.py @@ -2149,12 +2149,11 @@ class OpenThread_WpanCtl(IThci): if 'recv' in infoValue else PlatformDiagnosticPacket_Direction.OUT if 'send' in infoValue else PlatformDiagnosticPacket_Direction.UNKNOWN) elif 'type' in infoType: - EncryptedPacket.Type = (PlatformDiagnosticPacket_Type.JOIN_FIN_req - if 'JOIN_FIN.req' in infoValue else - PlatformDiagnosticPacket_Type.JOIN_FIN_rsp if 'JOIN_FIN.rsp' in infoValue - else PlatformDiagnosticPacket_Type.JOIN_ENT_req if 'JOIN_ENT.ntf' in - infoValue else PlatformDiagnosticPacket_Type.JOIN_ENT_rsp if 'JOIN_ENT.rsp' - in infoValue else PlatformDiagnosticPacket_Type.UNKNOWN) + EncryptedPacket.Type = (PlatformDiagnosticPacket_Type.JOIN_FIN_req if 'JOIN_FIN.req' in infoValue + else PlatformDiagnosticPacket_Type.JOIN_FIN_rsp if 'JOIN_FIN.rsp' + in infoValue else PlatformDiagnosticPacket_Type.JOIN_ENT_req if + 'JOIN_ENT.ntf' in infoValue else PlatformDiagnosticPacket_Type.JOIN_ENT_rsp + if 'JOIN_ENT.rsp' in infoValue else PlatformDiagnosticPacket_Type.UNKNOWN) elif 'len' in infoType: bytesInEachLine = 16 EncryptedPacket.TLVsLength = int(infoValue)