diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b40f31c..67bebb0 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,12 +7,12 @@ }, "vscode": { "extensions": [ - "mtxr.sqltools-driver-mysql", "dorzey.vscode-sqlfluff", - "emeraldwalk.RunOnSave" + "gruntfuggly.triggertaskonsave", + "mtxr.sqltools-driver-mysql" ] } }, - "postStartCommand": "sqlfluff fix", + "postAttachCommand": "sqlfluff fix -v", "remoteUser": "vscode" } diff --git a/.github/workflows/super-linter.yml b/.github/workflows/super-linter.yml index 91b756b..f9fdaa6 100644 --- a/.github/workflows/super-linter.yml +++ b/.github/workflows/super-linter.yml @@ -7,7 +7,9 @@ on: - main pull_request: null -permissions: {} +permissions: + contents: write + statuses: write jobs: build: @@ -26,10 +28,43 @@ jobs: fetch-depth: 0 - name: Super-linter - uses: super-linter/super-linter@v7 + uses: super-linter/super-linter/slim@v7 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VALIDATE_ALL_CODEBASE: false - VALIDATE_JSON_PRETTIER: false - SQLFLUFF_CONFIG_FILE: .sqlfluff - FILTER_REGEX_EXCLUDE: "(.devcontainer/Dockerfile|.github/pull_request_template.md|.github/ISSUE_TEMPLATE/*.md)" + FILTER_REGEX_EXCLUDE: '(.devcontainer/Dockerfile|.github/pull_request_template.md|.github/ISSUE_TEMPLATE/*.md)' + + fix-lint: + name: Fix Lint + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Super-linter + uses: super-linter/super-linter/slim@v7 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VALIDATE_ALL_CODEBASE: false + FILTER_REGEX_EXCLUDE: '(.github/pull_request_template.md|.github/ISSUE_TEMPLATE/*.md)' + FIX_JSON_PRETTIER: true + FIX_MARKDOWN: true + FIX_MARKDOWN_PRETTIER: true + FIX_SHELL_SHFMT: true + FIX_SQLFLUFF: true + FIX_YAML_PRETTIER: true + VALIDATE_DOCKERFILE_HADOLINT: false + + - name: Commit and push linting fixes + if: > + github.event_name == 'pull_request' && + github.event.pull_request.head.ref != github.event.repository.default_branch + uses: stefanzweifel/git-auto-commit-action@v5 + with: + branch: ${{ github.event.pull_request.head.ref }} + commit_message: 'chore: fix linting issues' + commit_user_name: super-linter + commit_user_email: super-linter@super-linter.dev diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..a94092b --- /dev/null +++ b/.prettierrc @@ -0,0 +1,16 @@ +{ + "overrides": [ + { + "files": ["*.yml", "*.yaml", "*.md"], + "options": { + "tabWidth": 2 + } + } + ], + "printWidth": 80, + "semi": false, + "singleQuote": true, + "tabWidth": 4, + "trailingComma": "es5", + "useTabs": false +} diff --git a/.vscode/settings.json b/.vscode/settings.json index 822d160..f890e3e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,19 +1,12 @@ { - "editor.rulers": [ - 100 - ], + "editor.rulers": [100], "editor.tabSize": 4, "editor.insertSpaces": true, "editor.formatOnSave": true, "files.insertFinalNewline": true, "files.trimFinalNewlines": true, "files.trimTrailingWhitespace": true, - "emeraldwalk.runonsave": { - "commands": [ - { - "match": "*.sql", - "cmd": "sqlfluff fix '${fileBasename}'" - } - ] + "triggerTaskOnSave.tasks": { + "Lint SQL File": ["**/*.sql"] } } diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..7ba7e53 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,18 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Lint SQL File", + "type": "shell", + "command": "sqlfluff fix '${fileBasename}' -v", + "group": { + "kind": "none", + "isDefault": true + }, + "problemMatcher": [], + "runOptions": { + "runOn": "default" + } + } + ] +} diff --git a/github_conf/branch_protection_rules.json b/github_conf/branch_protection_rules.json new file mode 100644 index 0000000..e545d76 --- /dev/null +++ b/github_conf/branch_protection_rules.json @@ -0,0 +1,5 @@ +{ + "message": "Not Found", + "documentation_url": "https://docs.github.com/rest", + "status": "404" +} \ No newline at end of file diff --git a/super-linter-output/super-linter-summary.md b/super-linter-output/super-linter-summary.md new file mode 100644 index 0000000..f6ba74d --- /dev/null +++ b/super-linter-output/super-linter-summary.md @@ -0,0 +1,15 @@ +# Super-linter summary + +| Language | Validation result | +| -------------------------- | ----------------- | +| CHECKOV | Pass ✅ | +| GITHUB_ACTIONS | Pass ✅ | +| GITLEAKS | Pass ✅ | +| GIT_MERGE_CONFLICT_MARKERS | Pass ✅ | +| JSCPD | Pass ✅ | +| JSON | Pass ✅ | +| JSON_PRETTIER | Pass ✅ | +| YAML | Pass ✅ | +| YAML_PRETTIER | Pass ✅ | + +All files and directories linted successfully