Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fix linting issues automatically #1334

Merged
merged 1 commit into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,21 @@ on:
pull_request:
branches: [main, develop]

permissions: read-all
permissions:
contents: read

###############
# Set the Job #
###############
jobs:
super-linter:
# Name the Job
name: Lint Code Base (super-linter)
permissions:
# To write linting fixes
contents: write
# To write Super-linter status checks
statuses: write
# Set the agent to run on
runs-on: ubuntu-22.04

Expand All @@ -43,20 +50,39 @@ jobs:
# Full git history is needed to get a proper list
# of changed files within `super-linter`
fetch-depth: 0
token: ${{ secrets.SUPER_LINTER_TOKEN }}

################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: super-linter/[email protected]
env:
VALIDATE_CPP: false # Use clang-formt instead
VALIDATE_CPP: false # Use clang-formt instead
VALIDATE_ANSIBLE: false
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
FIX_MARKDOWN_PRETTIER: true
FIX_YAML_PRETTIER: true
FIX_JSON_PRETTIER: true
FIX_SHELL_SHFMT: true
DEFAULT_BRANCH: develop
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# CMake Format
- name: Commit and push linting fixes
# Run only on:
# - Pull requests
# - Not on the default branch
if: >
github.event_name == 'pull_request' &&
github.ref_name != github.event.repository.default_branch
uses: stefanzweifel/git-auto-commit-action@v5
with:
branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
commit_message: "chore: fix linting issues"
commit_user_name: super-linter
commit_user_email: [email protected]

# CMake Format
cmake-format-linter:
name: Lint Code Base (cmake-format-lint)
runs-on: ubuntu-22.04
Expand Down
5 changes: 5 additions & 0 deletions github_conf/branch_protection_rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"message": "Not Found",
"documentation_url": "https://docs.github.com/rest",
"status": "404"
}
17 changes: 17 additions & 0 deletions super-linter-output/super-linter-summary.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Super-linter summary

| Language | Validation result |
| ----------------- | ----------------- |
| CHECKOV | Pass ✅ |
| GITHUB_ACTIONS | Pass ✅ |
| GITLEAKS | Pass ✅ |
| JSCPD | Pass ✅ |
| JSON | Pass ✅ |
| JSON_PRETTIER | Pass ✅ |
| MARKDOWN | Pass ✅ |
| MARKDOWN_PRETTIER | Pass ✅ |
| NATURAL_LANGUAGE | Pass ✅ |
| YAML | Pass ✅ |
| YAML_PRETTIER | Pass ✅ |

All files and directories linted successfully
Loading