From 48326bbdf7163a74758f311afe12393c72a23ebd Mon Sep 17 00:00:00 2001 From: Francois Beutin Date: Wed, 3 Apr 2024 08:59:30 +0200 Subject: [PATCH] Add yamllint CI and codespell CI --- .github/workflows/codeql_checks.yml | 6 +-- .github/workflows/python-client.yml | 62 +++++++++++++------------- .github/workflows/scripts_checking.yml | 30 +++++++++++++ .yamllint.yml | 7 +++ src_nbgl/ui_settings.c | 16 +++++-- 5 files changed, 83 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/scripts_checking.yml create mode 100644 .yamllint.yml diff --git a/.github/workflows/codeql_checks.yml b/.github/workflows/codeql_checks.yml index fb9506442a..75d1d1a38c 100644 --- a/.github/workflows/codeql_checks.yml +++ b/.github/workflows/codeql_checks.yml @@ -18,9 +18,9 @@ jobs: name: Analyse strategy: matrix: - sdk: [ "$NANOS_SDK", "$NANOX_SDK", "$NANOSP_SDK", "$STAX_SDK" ] - #'cpp' covers C and C++ - language: [ 'cpp' ] + sdk: ["$NANOS_SDK", "$NANOX_SDK", "$NANOSP_SDK", "$STAX_SDK"] + # 'cpp' covers C and C++ + language: ['cpp'] runs-on: ubuntu-latest container: image: ghcr.io/ledgerhq/ledger-app-builder/ledger-app-builder-legacy:latest diff --git a/.github/workflows/python-client.yml b/.github/workflows/python-client.yml index 2c8745bb94..21a0abdd84 100644 --- a/.github/workflows/python-client.yml +++ b/.github/workflows/python-client.yml @@ -44,37 +44,37 @@ jobs: needs: [lint, mypy] steps: - - name: Clone - uses: actions/checkout@v4 - with: - fetch-depth: 0 + - name: Clone + uses: actions/checkout@v4 + with: + fetch-depth: 0 - - name: Build Python package - run: | - pip install --upgrade pip build twine - cd client/ - python -m build; - python -m twine check dist/* - pip install .; - echo "TAG_VERSION=$(python -c 'from ledger_app_clients.ethereum import __version__; print(__version__)')" >> "$GITHUB_ENV" + - name: Build Python package + run: | + pip install --upgrade pip build twine + cd client/ + python -m build; + python -m twine check dist/* + pip install .; + echo "TAG_VERSION=$(python -c 'from ledger_app_clients.ethereum import __version__; print(__version__)')" >> "$GITHUB_ENV" - - name: Check version against CHANGELOG - if: startsWith(github.ref, 'refs/tags/') - run: | - CHANGELOG_VERSION=$(grep -Po '(?<=## \[)(\d+\.)+[^\]]' client/CHANGELOG.md | head -n 1) - if [ "${{ env.TAG_VERSION }}" == "${CHANGELOG_VERSION}" ]; - then - echo 'Package and CHANGELOG versions match!'; - exit 0; - else - echo "Tag '${{ env.TAG_VERSION }}' and CHANGELOG '${CHANGELOG_VERSION}' versions mismatch!"; - exit 1; - fi + - name: Check version against CHANGELOG + if: startsWith(github.ref, 'refs/tags/') + run: | + CHANGELOG_VERSION=$(grep -Po '(?<=## \[)(\d+\.)+[^\]]' client/CHANGELOG.md | head -n 1) + if [ "${{ env.TAG_VERSION }}" == "${CHANGELOG_VERSION}" ]; + then + echo 'Package and CHANGELOG versions match!'; + exit 0; + else + echo "Tag '${{ env.TAG_VERSION }}' and CHANGELOG '${CHANGELOG_VERSION}' versions mismatch!"; + exit 1; + fi - - name: Publish Python package on pypi.org - if: success() && github.event_name == 'push' - run: (cd client && python -m twine upload --verbose dist/*) - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_PUBLIC_API_TOKEN }} - TWINE_NON_INTERACTIVE: 1 + - name: Publish Python package on pypi.org + if: success() && github.event_name == 'push' + run: (cd client && python -m twine upload --verbose dist/*) + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_PUBLIC_API_TOKEN }} + TWINE_NON_INTERACTIVE: 1 diff --git a/.github/workflows/scripts_checking.yml b/.github/workflows/scripts_checking.yml new file mode 100644 index 0000000000..625dd44fcd --- /dev/null +++ b/.github/workflows/scripts_checking.yml @@ -0,0 +1,30 @@ +name: Scripts quality CI + +on: + workflow_dispatch: + push: + branches: + - master + - main + - develop + pull_request: + +jobs: + misspell: + name: Check misspellings + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Check misspellings + uses: codespell-project/actions-codespell@v1 + with: + builtin: clear,rare + check_filenames: true + path: src, src_bagl, src_common, src_features, src_nbgl, src_plugin_sdk, src_plugins, doc + + yamllint: + name: Check yaml files + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: yamllint . diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000000..cbd9dc5686 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,7 @@ +--- +extends: default + +rules: + document-start: disable + line-length: disable + truthy: disable diff --git a/src_nbgl/ui_settings.c b/src_nbgl/ui_settings.c index 9d3656cc97..f488f77275 100644 --- a/src_nbgl/ui_settings.c +++ b/src_nbgl/ui_settings.c @@ -34,19 +34,25 @@ static bool navCallback(uint8_t page, nbgl_pageContent_t* content) { switches[index++] = (nbgl_layoutSwitch_t){.initState = N_storage.dataAllowed ? ON_STATE : OFF_STATE, .text = "Blind signing", - .subText = "Enable transaction blind\nsigning", + .subText = + "Enable transaction blind\n" + "signing", .token = BLIND_SIGNING_TOKEN, .tuneId = TUNE_TAP_CASUAL}; switches[index++] = (nbgl_layoutSwitch_t){.initState = N_storage.contractDetails ? ON_STATE : OFF_STATE, .text = "Debug", - .subText = "Display contract data\ndetails", + .subText = + "Display contract data\n" + "details", .token = DEBUG_TOKEN, .tuneId = TUNE_TAP_CASUAL}; switches[index++] = (nbgl_layoutSwitch_t){.initState = N_storage.displayNonce ? ON_STATE : OFF_STATE, .text = "Nonce", - .subText = "Display account nonce\nin transaction", + .subText = + "Display account nonce\n" + "in transaction", .token = NONCE_TOKEN, .tuneId = TUNE_TAP_CASUAL}; @@ -60,7 +66,9 @@ static bool navCallback(uint8_t page, nbgl_pageContent_t* content) { switches[index++] = (nbgl_layoutSwitch_t){.initState = N_storage.verbose_eip712 ? ON_STATE : OFF_STATE, .text = "Verbose EIP712", - .subText = "Ignore filtering and\ndisplay raw content", + .subText = + "Ignore filtering and\n" + "display raw content", .token = EIP712_VERBOSE_TOKEN, .tuneId = TUNE_TAP_CASUAL}; #endif // HAVE_EIP712_FULL_SUPPORT