Skip to content

Commit fc1e583

Browse files
authored
Refactor VSCode configuration (#28)
* Refactor VSCode configuration: update postAttachCommand and streamline task settings * Update Super-Linter configuration and add Prettier settings * Migrate Prettier configuration from prettierrc.txt to .prettierrc * Fix formatting in Super-Linter and VSCode configuration files * Update permissions in Super-Linter workflow to enable write access for contents and statuses * chore: fix linting issues
1 parent 3b7ef9d commit fc1e583

File tree

7 files changed

+100
-18
lines changed

7 files changed

+100
-18
lines changed

.devcontainer/devcontainer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
},
88
"vscode": {
99
"extensions": [
10-
"mtxr.sqltools-driver-mysql",
1110
"dorzey.vscode-sqlfluff",
12-
"emeraldwalk.RunOnSave"
11+
"gruntfuggly.triggertaskonsave",
12+
"mtxr.sqltools-driver-mysql"
1313
]
1414
}
1515
},
16-
"postStartCommand": "sqlfluff fix",
16+
"postAttachCommand": "sqlfluff fix -v",
1717
"remoteUser": "vscode"
1818
}

.github/workflows/super-linter.yml

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ on:
77
- main
88
pull_request: null
99

10-
permissions: {}
10+
permissions:
11+
contents: write
12+
statuses: write
1113

1214
jobs:
1315
build:
@@ -26,10 +28,43 @@ jobs:
2628
fetch-depth: 0
2729

2830
- name: Super-linter
29-
uses: super-linter/super-linter@v7
31+
uses: super-linter/super-linter/slim@v7
3032
env:
3133
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3234
VALIDATE_ALL_CODEBASE: false
33-
VALIDATE_JSON_PRETTIER: false
34-
SQLFLUFF_CONFIG_FILE: .sqlfluff
35-
FILTER_REGEX_EXCLUDE: "(.devcontainer/Dockerfile|.github/pull_request_template.md|.github/ISSUE_TEMPLATE/*.md)"
35+
FILTER_REGEX_EXCLUDE: '(.devcontainer/Dockerfile|.github/pull_request_template.md|.github/ISSUE_TEMPLATE/*.md)'
36+
37+
fix-lint:
38+
name: Fix Lint
39+
runs-on: ubuntu-latest
40+
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 0
46+
47+
- name: Super-linter
48+
uses: super-linter/super-linter/slim@v7
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
VALIDATE_ALL_CODEBASE: false
52+
FILTER_REGEX_EXCLUDE: '(.github/pull_request_template.md|.github/ISSUE_TEMPLATE/*.md)'
53+
FIX_JSON_PRETTIER: true
54+
FIX_MARKDOWN: true
55+
FIX_MARKDOWN_PRETTIER: true
56+
FIX_SHELL_SHFMT: true
57+
FIX_SQLFLUFF: true
58+
FIX_YAML_PRETTIER: true
59+
VALIDATE_DOCKERFILE_HADOLINT: false
60+
61+
- name: Commit and push linting fixes
62+
if: >
63+
github.event_name == 'pull_request' &&
64+
github.event.pull_request.head.ref != github.event.repository.default_branch
65+
uses: stefanzweifel/git-auto-commit-action@v5
66+
with:
67+
branch: ${{ github.event.pull_request.head.ref }}
68+
commit_message: 'chore: fix linting issues'
69+
commit_user_name: super-linter
70+
commit_user_email: [email protected]

.prettierrc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"overrides": [
3+
{
4+
"files": ["*.yml", "*.yaml", "*.md"],
5+
"options": {
6+
"tabWidth": 2
7+
}
8+
}
9+
],
10+
"printWidth": 80,
11+
"semi": false,
12+
"singleQuote": true,
13+
"tabWidth": 4,
14+
"trailingComma": "es5",
15+
"useTabs": false
16+
}

.vscode/settings.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
{
2-
"editor.rulers": [
3-
100
4-
],
2+
"editor.rulers": [100],
53
"editor.tabSize": 4,
64
"editor.insertSpaces": true,
75
"editor.formatOnSave": true,
86
"files.insertFinalNewline": true,
97
"files.trimFinalNewlines": true,
108
"files.trimTrailingWhitespace": true,
11-
"emeraldwalk.runonsave": {
12-
"commands": [
13-
{
14-
"match": "*.sql",
15-
"cmd": "sqlfluff fix '${fileBasename}'"
16-
}
17-
]
9+
"triggerTaskOnSave.tasks": {
10+
"Lint SQL File": ["**/*.sql"]
1811
}
1912
}

.vscode/tasks.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Lint SQL File",
6+
"type": "shell",
7+
"command": "sqlfluff fix '${fileBasename}' -v",
8+
"group": {
9+
"kind": "none",
10+
"isDefault": true
11+
},
12+
"problemMatcher": [],
13+
"runOptions": {
14+
"runOn": "default"
15+
}
16+
}
17+
]
18+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"message": "Not Found",
3+
"documentation_url": "https://docs.github.com/rest",
4+
"status": "404"
5+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Super-linter summary
2+
3+
| Language | Validation result |
4+
| -------------------------- | ----------------- |
5+
| CHECKOV | Pass ✅ |
6+
| GITHUB_ACTIONS | Pass ✅ |
7+
| GITLEAKS | Pass ✅ |
8+
| GIT_MERGE_CONFLICT_MARKERS | Pass ✅ |
9+
| JSCPD | Pass ✅ |
10+
| JSON | Pass ✅ |
11+
| JSON_PRETTIER | Pass ✅ |
12+
| YAML | Pass ✅ |
13+
| YAML_PRETTIER | Pass ✅ |
14+
15+
All files and directories linted successfully

0 commit comments

Comments
 (0)