From 78c4ffa1e4afe86187576917b538762ae5ab516a Mon Sep 17 00:00:00 2001 From: trajan0x <83933037+trajan0x@users.noreply.github.com> Date: Tue, 23 Aug 2022 02:55:17 +0900 Subject: [PATCH] Add Yaml Linting (terraform + workflows) (#117) Co-authored-by: Trajan0x --- .codecov.yml | 10 ++++++---- .editorconfig | 5 ++++- .github/label-requires-reviews.yml | 1 - .github/labeler.yml | 1 - .github/workflows/changesets.yml | 3 +-- .github/workflows/foundry-tests.yml | 2 +- .github/workflows/go.yml | 10 +++++----- .github/workflows/label-statuses.yml | 4 ++-- .github/workflows/labeler.yml | 5 ++--- .github/workflows/lint.yml | 13 +++++++++++++ .github/workflows/solidity.yml | 6 +++--- .golangci.yml | 8 ++++---- .yamllint.yml | 9 +++++++++ 13 files changed, 50 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/lint.yml create mode 100644 .yamllint.yml diff --git a/.codecov.yml b/.codecov.yml index 474263c1ad..82288f256b 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -6,8 +6,10 @@ coverage: precision: 5 ignore: - - "**/_generated.go" - - "**/*.abigen.go" - - "**/_string.go" + - '**/*_generated.go' + - '**/*.abigen.go' + - '**/*_string.go' # solidity test files - - "packages/contracts/test/*" + - '*/test/*.sol' + - '*/lib/*.sol' + - 'packages/contracts/libs/*.sol' diff --git a/.editorconfig b/.editorconfig index b158e3979b..92a1039143 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,4 +14,7 @@ indent_size = 4 [*.go] indent_size = 4 -indent_style = tab \ No newline at end of file +indent_style = tab + +[*.yml] +quote_type = single diff --git a/.github/label-requires-reviews.yml b/.github/label-requires-reviews.yml index 0563bdfde9..bf9c9dc651 100644 --- a/.github/label-requires-reviews.yml +++ b/.github/label-requires-reviews.yml @@ -1,3 +1,2 @@ ---- - label: 2-reviewers reviews: 2 diff --git a/.github/labeler.yml b/.github/labeler.yml index 2ff7fa7e17..447c8f458e 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,4 +1,3 @@ ---- 2-reviewers: - 'packages/contracts/**/*' diff --git a/.github/workflows/changesets.yml b/.github/workflows/changesets.yml index b4124cf6c1..b8fe7a5b7d 100644 --- a/.github/workflows/changesets.yml +++ b/.github/workflows/changesets.yml @@ -1,4 +1,3 @@ ---- name: Changeset integrity checker on: pull_request_target: @@ -20,7 +19,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - name: "Use NodeJS by nvmrc" + - name: 'Use NodeJS by nvmrc' uses: actions/setup-node@v2 with: node-version: '${{steps.nvmrc.outputs.NVMRC}}' diff --git a/.github/workflows/foundry-tests.yml b/.github/workflows/foundry-tests.yml index a7a9dcaaa2..935c3ef4ad 100644 --- a/.github/workflows/foundry-tests.yml +++ b/.github/workflows/foundry-tests.yml @@ -20,7 +20,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - name: "Use NodeJS by nvmrc" + - name: 'Use NodeJS by nvmrc' uses: actions/setup-node@v2 with: node-version: '${{steps.nvmrc.outputs.NVMRC}}' diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 7de88b164e..8994d33ea0 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -123,7 +123,7 @@ jobs: # For pull requests it's not necessary to checkout the code - uses: dorny/paths-filter@v2 - name: "Check for Go Changes" + name: 'Check for Go Changes' id: filter_go with: filters: | @@ -235,7 +235,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # see: https://github.com/golangci/golangci-lint/issues/337#issuecomment-510136513 GOGC: 20 - GOPRIVATE: "GOPRIVATE=github.com/synapsecns/synapse-node" + GOPRIVATE: 'GOPRIVATE=github.com/synapsecns/synapse-node' # check if we need to rerun go generate as a result of solidity changes. Note, this will only run on solidity changes. check-generation: @@ -262,7 +262,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - name: "Use NodeJS by nvmrc" + - name: 'Use NodeJS by nvmrc' uses: actions/setup-node@v2 with: node-version: '${{steps.nvmrc.outputs.NVMRC}}' @@ -333,7 +333,7 @@ jobs: if: steps.verify-changed-files.outputs.files_changed == 'true' uses: andymckay/labeler@3a4296e9dcdf9576b0456050db78cfd34853f260 with: - add-labels: "needs-go-generate" + add-labels: 'needs-go-generate' repo-token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ steps.find_pr.outputs.pr }} @@ -341,6 +341,6 @@ jobs: if: steps.verify-changed-files.outputs.files_changed != 'true' uses: andymckay/labeler@3a4296e9dcdf9576b0456050db78cfd34853f260 with: - remove-labels: "needs-go-generate" + remove-labels: 'needs-go-generate' repo-token: ${{ secrets.GITHUB_TOKEN }} issue-number: ${{ steps.find_pr.outputs.pr }} diff --git a/.github/workflows/label-statuses.yml b/.github/workflows/label-statuses.yml index 5e9b284952..bf2ac288e3 100644 --- a/.github/workflows/label-statuses.yml +++ b/.github/workflows/label-statuses.yml @@ -17,10 +17,10 @@ jobs: with: mode: exactly count: 0 - labels: "do not merge" + labels: 'do not merge' - uses: mheap/github-action-required-labels@v2 with: mode: exactly count: 0 - labels: "needs go generate" + labels: 'needs go generate' diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index f689dfbc35..1679abe577 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,5 +1,4 @@ ---- -name: "Pull Request Labeler" +name: 'Pull Request Labeler' on: - pull_request_target @@ -9,5 +8,5 @@ jobs: steps: - uses: actions/labeler@main with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" + repo-token: '${{ secrets.GITHUB_TOKEN }}' configuration-path: .github/labeler.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..dd44a52f18 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,13 @@ +name: Yaml Lint +on: [push] +jobs: + # TODO: add editor config linter + # https://github.com/editorconfig-checker/editorconfig-checker#continuous-integration + yaml: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: yaml-lint + uses: ibiqlik/action-yamllint@v3 + with: + config_file: .yamllint.yml diff --git a/.github/workflows/solidity.yml b/.github/workflows/solidity.yml index 5a3f336074..b3d00311f3 100644 --- a/.github/workflows/solidity.yml +++ b/.github/workflows/solidity.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: "Checkout" + - name: 'Checkout' uses: actions/checkout@v2 with: fetch-depth: 0 @@ -24,7 +24,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - name: "Use NodeJS by nvmrc" + - name: 'Use NodeJS by nvmrc' uses: actions/setup-node@v2 with: node-version: '${{steps.nvmrc.outputs.NVMRC}}' @@ -73,7 +73,7 @@ jobs: id: yarn-cache-dir-path run: echo "::set-output name=dir::$(yarn cache dir)" - - name: "Use NodeJS by nvmrc" + - name: 'Use NodeJS by nvmrc' uses: actions/setup-node@v2 with: node-version: '${{steps.nvmrc.outputs.NVMRC}}' diff --git a/.golangci.yml b/.golangci.yml index 0c6ea5b855..9f890f4892 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,8 +4,8 @@ run: skip-dirs-use-default: false timeout: 15m skip-files: - - ".*\\.abigen\\.go$" - - ".*\\.metadata\\.go$" + - '.*\\.abigen\\.go$' + - '.*\\.metadata\\.go$' linters-settings: @@ -95,11 +95,11 @@ issues: linters: - revive - stylecheck - text: "should not use dot imports" + text: 'should not use dot imports' - path: contracts/ linters: - revive - text: "and that stutters; consider calling this" + text: 'and that stutters; consider calling this' - path: ethergo/example/* linters: - wrapcheck diff --git a/.yamllint.yml b/.yamllint.yml new file mode 100644 index 0000000000..4aee6cd8b5 --- /dev/null +++ b/.yamllint.yml @@ -0,0 +1,9 @@ +ignore: | + **/node_modules/** + +rules: + document-start: + present: false + quoted-strings: + quote-type: single + required: false