Skip to content

Commit e04d1fd

Browse files
author
Michael Buchar
committed
ci(prettier): add Prettier code formatting checks (#737)
Also add .prettierignore for ignored files and .prettierrc.yaml for standard print width.
1 parent d05e5af commit e04d1fd

9 files changed

Lines changed: 45 additions & 14 deletions

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,20 @@ jobs:
149149
sudo apt-get install shfmt
150150
./run-tests.sh --check-shfmt
151151
152+
format-prettier:
153+
runs-on: ubuntu-24.04
154+
steps:
155+
- name: Checkout
156+
uses: actions/checkout@v4
157+
158+
- name: Setup Node
159+
uses: actions/setup-node@v4
160+
161+
- name: Check Prettier code fomatting
162+
run: |
163+
npm install prettier --global
164+
./run-tests.sh --check-prettier
165+
152166
docs-sphinx:
153167
runs-on: ubuntu-24.04
154168
steps:
@@ -240,8 +254,7 @@ jobs:
240254
release-docker:
241255
runs-on: ubuntu-24.04
242256
if: >
243-
vars.RELEASE_DOCKER == 'true' &&
244-
github.event_name == 'push' &&
257+
vars.RELEASE_DOCKER == 'true' && github.event_name == 'push' &&
245258
startsWith(github.ref, 'refs/tags/')
246259
needs:
247260
- docs-sphinx

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.pytest_cache
2+
CHANGELOG.md
3+
docs/openapi.json

.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 },

CONTRIBUTING.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Contributing
22

3-
Bug reports, issues, feature requests, and other contributions are welcome.
4-
If you find a demonstrable problem that is caused by the REANA code, please:
3+
Bug reports, issues, feature requests, and other contributions are welcome. If
4+
you find a demonstrable problem that is caused by the REANA code, please:
55

6-
1. Search for [already reported problems](https://github.com/reanahub/reana-server/issues).
7-
2. Check if the issue has been fixed or is still reproducible on the
8-
latest `master` branch.
6+
1. Search for
7+
[already reported problems](https://github.com/reanahub/reana-server/issues).
8+
2. Check if the issue has been fixed or is still reproducible on the latest
9+
`master` branch.
910
3. Create an issue, ideally with **a test case**.
1011

1112
If you create a pull request fixing a bug or implementing a feature, you can run

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,6 @@ recursive-include tests *.py
2929
recursive-include tests *.txt
3030
global-exclude *.py[co] .DS_Store
3131
exclude .editorconfig
32+
exclude .prettierrc.yaml
33+
exclude .prettierignore
3234
exclude .readthedocs.yaml

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
## About
1111

1212
REANA-Server is a component of the [REANA](http://www.reana.io/) reusable and
13-
reproducible research data analysis platform. It implements the API Server
14-
that takes and performs REST API calls issued by REANA clients.
13+
reproducible research data analysis platform. It implements the API Server that
14+
takes and performs REST API calls issued by REANA clients.
1515

1616
## Features
1717

docs/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222

2323
## REST API
2424

25-
The REANA Server offers a REST API for management workloads
26-
(workflows, jobs, tasks, etc.) running on REANA Cloud.
27-
Detailed REST API documentation can be found <a href="_static/api.html">here</a>.
25+
The REANA Server offers a REST API for management workloads (workflows, jobs,
26+
tasks, etc.) running on REANA Cloud. Detailed REST API documentation can be
27+
found <a href="_static/api.html">here</a>.
2828

2929
```{eval-rst}
3030
.. automodule:: reana_server.rest.ping

run-tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ check_shfmt() {
143143
shfmt -d .
144144
}
145145

146+
check_prettier() {
147+
prettier -c .
148+
}
149+
146150
check_all() {
147151
check_commitlint
148152
check_shellcheck
@@ -159,6 +163,7 @@ check_all() {
159163
check_yamllint
160164
check_shfmt
161165
check_markdownlint
166+
check_prettier
162167
}
163168

164169
if [ $# -eq 0 ]; then
@@ -184,5 +189,6 @@ case $arg in
184189
--check-yamllint) check_yamllint ;;
185190
--check-shfmt) check_shfmt ;;
186191
--check-markdownlint) check_markdownlint ;;
192+
--check-prettier) check_prettier ;;
187193
*) echo "[ERROR] Invalid argument '$arg'. Exiting." && exit 1 ;;
188194
esac

0 commit comments

Comments
 (0)