From 9d32d440ebf1ebd0684f5349316a15602bea5421 Mon Sep 17 00:00:00 2001 From: John Bampton Date: Sun, 11 Apr 2021 12:51:28 +1000 Subject: feat(CI): add the GitHub Super Linter The GitHub Super Linter is a more robust and better supported tool than the current GitHub Actions we are using. Running these checks: ERROR_ON_MISSING_EXEC_BIT: true VALIDATE_BASH: true VALIDATE_BASH_EXEC: true VALIDATE_EDITORCONFIG: true VALIDATE_MARKDOWN: true VALIDATE_SHELL_SHFMT: true VALIDATE_YAML: true https://github.com/marketplace/actions/super-linter https://github.com/github/super-linter Added the GitHub Super Linter badge to the README. Also updated the pre-commit framework and added more documentation on pre-commit. Added one more pre-commit check: check-executables-have-shebangs Added one extra check for merge conflicts to our GitHub Actions. EditorConfig and Markdown linting. Minor grammar and spelling fixes. Update linter.yml --- .github/linters/.ecrc | 12 ++++++++++ .github/linters/.markdown-lint.yml | 12 ++++++++++ .github/linters/.yaml-lint.yml | 8 +++++++ .github/workflows/lint.yml | 48 +++++++++++--------------------------- .github/workflows/linter.yml | 25 ++++++++++++++++++++ 5 files changed, 71 insertions(+), 34 deletions(-) create mode 100644 .github/linters/.ecrc create mode 100644 .github/linters/.markdown-lint.yml create mode 100644 .github/linters/.yaml-lint.yml create mode 100644 .github/workflows/linter.yml (limited to '.github') diff --git a/.github/linters/.ecrc b/.github/linters/.ecrc new file mode 100644 index 000000000..fb885d02a --- /dev/null +++ b/.github/linters/.ecrc @@ -0,0 +1,12 @@ +{ + "verbose": false, + "ignore_defaults": false, + "exclude": ["oss-fuzz/", "src/"], + "disable": { + "end_of_line": false, + "trim_trailing_whitespace": false, + "insert_final_newline": false, + "indent_size": true, + "indent_style": true + } +} diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml new file mode 100644 index 000000000..8020fc062 --- /dev/null +++ b/.github/linters/.markdown-lint.yml @@ -0,0 +1,12 @@ +MD001: false +MD003: false +MD005: false +MD007: false +MD010: false +MD013: false +MD014: false +MD024: false +MD025: false +MD026: false +MD040: false +MD046: false diff --git a/.github/linters/.yaml-lint.yml b/.github/linters/.yaml-lint.yml new file mode 100644 index 000000000..88f3b4eb9 --- /dev/null +++ b/.github/linters/.yaml-lint.yml @@ -0,0 +1,8 @@ +--- + +extends: default + +rules: + document-start: disable + line-length: disable + truthy: false diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fb7f62d4a..f949c5bbc 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,52 +1,32 @@ -name: โ„๏ธ Lint +name: Lint on: [pull_request] jobs: - markdownlint: - name: ๐Ÿธ Markdown - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: ๐Ÿš€ Use Node.js - uses: actions/setup-node@v2.1.5 - with: - node-version: '14' - - run: npm install -g markdownlint-cli@0.27.1 - - run: markdownlint '**/*.md' misspell: - name: ๐Ÿฅ› Check Spelling + name: Check Spelling runs-on: ubuntu-latest steps: - - name: ๐Ÿ’ Check Out + - name: Check Out uses: actions/checkout@v2 - - name: ๐Ÿ… Install + - name: Install run: | wget -O - -q https://git.io/misspell | sh -s -- -b . - - name: ๐ŸŒถ๏ธ Misspell + - name: Misspell run: | git ls-files --empty-directory | xargs ./misspell -error - trailing-whitespace: - name: ๐Ÿง‹ Trailing whitespace + merge-conflict: + name: Merge Conflict runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: ๐Ÿงน Check for trailing whitespace - run: "! git grep -EIn $'[ \t]+$'" - yamllint: - name: ๐Ÿถ YAML + - name: Check merge conflict + run: | + grep "^<<<<<<< HEAD" $(git ls-files | xargs) && exit 1 || true + trailing-whitespace: + name: Trailing whitespace runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax - architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install yamllint - - name: ๐Ÿงน YAML Lint - run: | - # return non-zero exit code on warnings - yamllint --strict . + - name: Check for trailing whitespace + run: "! git grep -EIn $'[ \t]+$'" diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 000000000..306060c3f --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,25 @@ +name: Lint Code Base + +on: + push: + branches-ignore: [master] + # Remove the line above to run when pushing to master + pull_request: + branches: [master] + +jobs: + build: + name: Lint Code Base + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: github/super-linter@v3 + env: + ERROR_ON_MISSING_EXEC_BIT: true + VALIDATE_BASH: true + # VALIDATE_BASH_EXEC: true + # VALIDATE_EDITORCONFIG: true + VALIDATE_MARKDOWN: true + # VALIDATE_SHELL_SHFMT: true + VALIDATE_YAML: true + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -- cgit v1.2.3