Skip to content

Commit 14e3919

Browse files
author
Michael Buchar
committed
ci(prettier): add prettier code formatting checks (#655)
Also add .prettierignore for ingored files and .prettierrc.yaml for standard print width.
1 parent c722f21 commit 14e3919

8 files changed

Lines changed: 61 additions & 84 deletions

File tree

.github/workflows/ci.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,20 @@ jobs:
157157
npm install markdownlint-cli2 --global
158158
./run-tests.sh --check-markdownlint
159159
160+
format-prettier:
161+
runs-on: ubuntu-24.04
162+
steps:
163+
- name: Checkout
164+
uses: actions/checkout@v4
165+
166+
- name: Setup Node
167+
uses: actions/setup-node@v4
168+
169+
- name: Check Prettier code fomatting
170+
run: |
171+
npm install prettier --global
172+
./run-tests.sh --check-prettier
173+
160174
docs-sphinx:
161175
runs-on: ubuntu-24.04
162176
steps:
@@ -204,8 +218,8 @@ jobs:
204218

205219
- name: Run pytest
206220
run: |
207-
mkdir /tmp/reana
208-
SHARED_VOLUME_PATH=/tmp/reana ./run-tests.sh --check-pytest
221+
mkdir /tmp/reana
222+
SHARED_VOLUME_PATH=/tmp/reana ./run-tests.sh --check-pytest
209223
210224
- name: Codecov Coverage
211225
uses: codecov/codecov-action@v4
@@ -234,8 +248,7 @@ jobs:
234248
release-docker:
235249
runs-on: ubuntu-24.04
236250
if: >
237-
vars.RELEASE_DOCKER == 'true' &&
238-
github.event_name == 'push' &&
251+
vars.RELEASE_DOCKER == 'true' && github.event_name == 'push' &&
239252
startsWith(github.ref, 'refs/tags/')
240253
needs:
241254
- docs-sphinx

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHANGELOG.md

.prettierrc.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
printWidth: 80
2+
proseWrap: always

.release-please-config.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@
55
".": {
66
"changelog-sections": [
77
{ "type": "build", "section": "Build", "hidden": false },
8-
{ "type": "feat", "section": "Features", "hidden": false },
8+
{ "type": "feat", "section": "Features", "hidden": false },
99
{ "type": "fix", "section": "Bug fixes", "hidden": false },
10-
{ "type": "perf", "section": "Performance improvements", "hidden": false },
10+
{
11+
"type": "perf",
12+
"section": "Performance improvements",
13+
"hidden": false
14+
},
1115
{ "type": "refactor", "section": "Code refactoring", "hidden": false },
1216
{ "type": "style", "section": "Code style", "hidden": false },
1317
{ "type": "test", "section": "Test suite", "hidden": false },

MANIFEST.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ include Dockerfile
1515
include LICENSE
1616
include pytest.ini
1717
include docs/openapi.json
18-
include .editorconfig
18+
exclude .editorconfig
19+
exclude .prettierrc
20+
exclude .prettierignore
1921
exclude .readthedocs.yaml
2022
prune docs/_build
2123
recursive-include docs *.py

docs/index.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<!-- markdownlint-disable MD041 -->
2-
<!-- markdownlint-disable MD033 -->
32

43
```{include} ../README.md
54
:end-before: "## About"
@@ -13,8 +12,8 @@
1312
## REST API
1413

1514
The REANA-Workflow-Controller component offers a REST API for managing
16-
workflows. Detailed REST API documentation can be found
17-
<a href="_static/api.html">here</a>.
15+
workflows.
16+
[Detailed REST API documentation can be found here]("_static/api.html").
1817

1918
```{eval-rst}
2019
.. automodule:: reana_workflow_controller.rest.workflows

docs/openapi.json

Lines changed: 24 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@
112112
"type": "string"
113113
}
114114
],
115-
"produces": [
116-
"application/json"
117-
],
115+
"produces": ["application/json"],
118116
"responses": {
119117
"200": {
120118
"description": "Requests succeeded. The response contains the current workflows for a given user.",
@@ -324,9 +322,7 @@
324322
}
325323
}
326324
],
327-
"produces": [
328-
"application/json"
329-
],
325+
"produces": ["application/json"],
330326
"responses": {
331327
"201": {
332328
"description": "Request succeeded. The workflow has been created along with its workspace",
@@ -369,9 +365,7 @@
369365
},
370366
"/api/workflows/move_files/{workflow_id_or_name}": {
371367
"put": {
372-
"consumes": [
373-
"application/json"
374-
],
368+
"consumes": ["application/json"],
375369
"description": "This resource moves files within the workspace. Resource is expecting a workflow UUID.",
376370
"operationId": "move_files",
377371
"parameters": [
@@ -404,9 +398,7 @@
404398
"type": "string"
405399
}
406400
],
407-
"produces": [
408-
"application/json"
409-
],
401+
"produces": ["application/json"],
410402
"responses": {
411403
"200": {
412404
"description": "Request succeeded. Message about successfully moved files is returned.",
@@ -506,17 +498,13 @@
506498
"type": "string"
507499
}
508500
],
509-
"produces": [
510-
"application/json"
511-
],
501+
"produces": ["application/json"],
512502
"responses": {
513503
"200": {
514504
"description": "Request succeeded. Info about a workflow, including the status is returned.",
515505
"examples": {
516506
"application/json": {
517-
"reana_specification": [
518-
"- nevents: 100000\n+ nevents: 200000"
519-
],
507+
"reana_specification": ["- nevents: 100000\n+ nevents: 200000"],
520508
"workspace_listing": {
521509
"Only in workspace a: code": null
522510
}
@@ -567,9 +555,7 @@
567555
},
568556
"/api/workflows/{workflow_id_or_name}/close": {
569557
"post": {
570-
"consumes": [
571-
"application/json"
572-
],
558+
"consumes": ["application/json"],
573559
"description": "This resource is expecting a workflow to close an interactive session within its workspace.",
574560
"operationId": "close_interactive_session",
575561
"parameters": [
@@ -588,9 +574,7 @@
588574
"type": "string"
589575
}
590576
],
591-
"produces": [
592-
"application/json"
593-
],
577+
"produces": ["application/json"],
594578
"responses": {
595579
"200": {
596580
"description": "Request succeeded. The interactive session has been closed.",
@@ -679,9 +663,7 @@
679663
"type": "integer"
680664
}
681665
],
682-
"produces": [
683-
"application/json"
684-
],
666+
"produces": ["application/json"],
685667
"responses": {
686668
"200": {
687669
"description": "Request succeeded. Info about workflow, including the status is returned.",
@@ -740,9 +722,7 @@
740722
},
741723
"/api/workflows/{workflow_id_or_name}/open/{interactive_session_type}": {
742724
"post": {
743-
"consumes": [
744-
"application/json"
745-
],
725+
"consumes": ["application/json"],
746726
"description": "This resource is expecting a workflow to start an interactive session within its workspace.",
747727
"operationId": "open_interactive_session",
748728
"parameters": [
@@ -783,9 +763,7 @@
783763
}
784764
}
785765
],
786-
"produces": [
787-
"application/json"
788-
],
766+
"produces": ["application/json"],
789767
"responses": {
790768
"200": {
791769
"description": "Request succeeded. The interactive session has been opened.",
@@ -846,9 +824,7 @@
846824
"type": "string"
847825
}
848826
],
849-
"produces": [
850-
"application/json"
851-
],
827+
"produces": ["application/json"],
852828
"responses": {
853829
"200": {
854830
"description": "Request succeeded. Workflow input parameters, including the status are returned.",
@@ -934,9 +910,7 @@
934910
"type": "string"
935911
}
936912
],
937-
"produces": [
938-
"application/json"
939-
],
913+
"produces": ["application/json"],
940914
"responses": {
941915
"200": {
942916
"description": "Request succeeded. The response contains the list of all the retention rules.",
@@ -1066,16 +1040,12 @@
10661040
"type": "string"
10671041
}
10681042
},
1069-
"required": [
1070-
"user_email_to_share_with"
1071-
],
1043+
"required": ["user_email_to_share_with"],
10721044
"type": "object"
10731045
}
10741046
}
10751047
],
1076-
"produces": [
1077-
"application/json"
1078-
],
1048+
"produces": ["application/json"],
10791049
"responses": {
10801050
"200": {
10811051
"description": "Request succeeded. The workflow has been shared with the user.",
@@ -1152,9 +1122,7 @@
11521122
"type": "string"
11531123
}
11541124
],
1155-
"produces": [
1156-
"application/json"
1157-
],
1125+
"produces": ["application/json"],
11581126
"responses": {
11591127
"200": {
11601128
"description": "Request succeeded. The response contains the share status of the workflow.",
@@ -1253,9 +1221,7 @@
12531221
"type": "string"
12541222
}
12551223
],
1256-
"produces": [
1257-
"application/json"
1258-
],
1224+
"produces": ["application/json"],
12591225
"responses": {
12601226
"200": {
12611227
"description": "Request succeeded. Info about workflow, including the status is returned.",
@@ -1345,11 +1311,7 @@
13451311
},
13461312
{
13471313
"description": "Required. New status.",
1348-
"enum": [
1349-
"start",
1350-
"stop",
1351-
"deleted"
1352-
],
1314+
"enum": ["start", "stop", "deleted"],
13531315
"in": "query",
13541316
"name": "status",
13551317
"required": true,
@@ -1387,9 +1349,7 @@
13871349
}
13881350
}
13891351
],
1390-
"produces": [
1391-
"application/json"
1392-
],
1352+
"produces": ["application/json"],
13931353
"responses": {
13941354
"200": {
13951355
"description": "Request succeeded. Info about workflow, including the status is returned.",
@@ -1505,9 +1465,7 @@
15051465
"type": "string"
15061466
}
15071467
],
1508-
"produces": [
1509-
"application/json"
1510-
],
1468+
"produces": ["application/json"],
15111469
"responses": {
15121470
"200": {
15131471
"description": "Request succeeded. The workflow has been unshared with the user.",
@@ -1665,9 +1623,7 @@
16651623
"type": "string"
16661624
}
16671625
],
1668-
"produces": [
1669-
"multipart/form-data"
1670-
],
1626+
"produces": ["multipart/form-data"],
16711627
"responses": {
16721628
"200": {
16731629
"description": "Requests succeeded. The list of code|input|output files has been retrieved.",
@@ -1728,9 +1684,7 @@
17281684
"summary": "Returns the workspace file list."
17291685
},
17301686
"post": {
1731-
"consumes": [
1732-
"application/octet-stream"
1733-
],
1687+
"consumes": ["application/octet-stream"],
17341688
"description": "This resource is expecting a workflow UUID and a file to place in the workspace.",
17351689
"operationId": "upload_file",
17361690
"parameters": [
@@ -1765,9 +1719,7 @@
17651719
"type": "string"
17661720
}
17671721
],
1768-
"produces": [
1769-
"application/json"
1770-
],
1722+
"produces": ["application/json"],
17711723
"responses": {
17721724
"200": {
17731725
"description": "Request succeeded. The file has been added to the workspace.",
@@ -1838,9 +1790,7 @@
18381790
"type": "string"
18391791
}
18401792
],
1841-
"produces": [
1842-
"application/json"
1843-
],
1793+
"produces": ["application/json"],
18441794
"responses": {
18451795
"200": {
18461796
"description": "Request succeeded. Details about deleted files and failed deletions are returned.",

run-tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ check_markdownlint() {
123123
markdownlint-cli2 "**/*.md"
124124
}
125125

126+
check_prettier() {
127+
prettier -c .
128+
}
129+
126130
check_pytest() {
127131
clean_old_db_container
128132
start_db_container
@@ -154,6 +158,7 @@ check_all() {
154158
check_shfmt
155159
check_yamllint
156160
check_markdownlint
161+
check_prettier
157162
}
158163

159164
if [ $# -eq 0 ]; then
@@ -177,5 +182,6 @@ case $arg in
177182
--check-shfmt) check_shfmt ;;
178183
--check-yamllint) check_yamllint ;;
179184
--check-markdownlint) check_markdownlint ;;
185+
--check-prettier) check_prettier ;;
180186
*) echo "[ERROR] Invalid argument '$arg'. Exiting." && exit 1 ;;
181187
esac

0 commit comments

Comments
 (0)