Skip to content

Push, Pull Request, Coding Style Check

Michael Zhang edited this page Feb 14, 2024 · 3 revisions

Push

  • This SDK only allows the collaborators to direct to Push codes into SDK.
  • Merging Pull Request is considered as a Push of commit.
  • After every Push GitHub Action Check mbed coding style will run automatically
    • If check passed you should see green tick
    • 2024-2-6_17-40-54

Pull Request (PR)

  • It is a way to contribute codes to the opensource SDK. Please refer the following steps for doing PR to this SDK
    1. Login your GitHub account
    2. fork the SDK
    3. Edit SDK, make a commit, and Push the commit to the fork SDK
    4. Compare to the original SDK and follow the PULL_REQUEST_TEMPLATE to create a PR
    5. Wait for all GitHub Actions check to pass. If not commit the fix of the PR, the GitHub Actions check will run again automatically.
    6. When all checks passed, the collaborators will merge the PR into the original SDK
  • After every PR created GitHub Action Check mbed coding style will run automatically
    • If check passed you should see green tick
    • 2024-2-6_17-40-16

Coding Style Check

  • This SDK is using mbed coding style
  • All collaborators and contributors should follow the coding style to maintain the SDK.
  • There is a mbed coding check for all Push and PR. It is based on clang format 17. Refer to Coding_Style for detail settings.
  • You can refer to the following steps to do coding style formatting
    • Install clang-format 17 at any platform you comfortable with. Then run clang-format-17 -n --Werror --style=file:"Coding_Style/.clang-format" $file-name for the target file to be formatting.
    • Example using VScode, windows 10.
      1. Install VScode
      2. open VScode and go to extension page
      • 2024-2-6_17-23-9
      1. open extension setting
      • 2024-2-14_11-18-19
      1. find Clang-format: Style and set as file
      • 2024-2-14_11-20-59
      1. The .clang-format and .clang-format-ignore should placed at workspace
        • current folder
        • parents folder
      2. open the file and right click choose Format Document
      • 2024-2-6_17-26-7