Skip to content

Commit 0723f22

Browse files
committed
[skip changelog] Add linting/formatting tasks and CI checks for docs and config files
1 parent a2f63fb commit 0723f22

File tree

5 files changed

+74
-1
lines changed

5 files changed

+74
-1
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ indent_size = 4
1515
indent_style = space
1616
indent_size = 4
1717

18-
[*.yml,*.tmpl]
18+
[*.yml,*.yaml,*.tmpl]
1919
indent_style = space
2020
indent_size = 2
2121

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: 'Verify files formatting'
2+
3+
on:
4+
push:
5+
paths:
6+
- '**/*.md'
7+
- '**/*.yml'
8+
- '**/*.yaml'
9+
- '.prettierrc'
10+
- '.prettierignore'
11+
- '!.github/ISSUE_TEMPLATE/**/*'
12+
- '!.github/PULL_REQUEST_TEMPLATE.md'
13+
pull_request:
14+
paths:
15+
- '**/*.md'
16+
- '**/*.yml'
17+
- '**/*.yaml'
18+
- '.prettierrc'
19+
- '.prettierignore'
20+
- '!.github/ISSUE_TEMPLATE/**/*'
21+
- '!.github/PULL_REQUEST_TEMPLATE.md'
22+
23+
jobs:
24+
verify-formatting:
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@master
30+
31+
- name: Install Taskfile
32+
uses: Arduino/actions/setup-taskfile@master
33+
with:
34+
repo-token: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Verify formatting of all files
37+
run: task docs:check config:check

.prettierignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# IDE files
2+
.idea/
3+
.vscode/
4+
.vs/
5+
.ionide/
6+
7+
# GitHub templates
8+
.github/ISSUE_TEMPLATE/**/*
9+
.github/PULL_REQUEST_TEMPLATE.md

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true
4+
}

Taskfile.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ tasks:
4949
cmds:
5050
- mkdocs serve
5151

52+
docs:check:
53+
desc: Run documentation linting
54+
cmds:
55+
- npx {{ .PRETTIER }} --check "**/*.md"
56+
57+
docs:format:
58+
desc: Automatically formats documentation
59+
cmds:
60+
- npx {{ .PRETTIER }} --write "**/*.md"
61+
5262
protoc:
5363
desc: Compile protobuf definitions
5464
cmds:
@@ -105,6 +115,18 @@ tasks:
105115
- "'{{.GOLINTBIN}}' {{.GOLINTFLAGS}} {{ default .DEFAULT_TARGETS .TARGETS }}"
106116
- task: i18n:check
107117
- task: python:check
118+
- task: docs:check
119+
- task: config:check
120+
121+
config:check:
122+
desc: Check linting of configuration and supporting files
123+
cmds:
124+
- npx {{ .PRETTIER }} --check "**/*.{yml,yaml}"
125+
126+
config:format:
127+
desc: Automatically formats configuration and supporting files
128+
cmds:
129+
- npx {{ .PRETTIER }} --write "**/*.{yml,yaml}"
108130

109131
python:check:
110132
desc: Linting for Python files
@@ -183,3 +205,4 @@ vars:
183205
DOCS_VERSION: dev
184206
DOCS_ALIAS: ""
185207
DOCS_REMOTE: "origin"
208+

0 commit comments

Comments
 (0)