Skip to content

Commit 128ca8d

Browse files
CameronMcClymonttiborsimko
authored andcommitted
ci(prettier): add Prettier code formatting checks (reanahub#491)
1 parent 3809916 commit 128ca8d

File tree

9 files changed

+53
-32
lines changed

9 files changed

+53
-32
lines changed

.github/workflows/ci.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,20 @@ jobs:
168168
sudo apt-get install shfmt
169169
./run-tests.sh --check-shfmt
170170
171+
format-prettier:
172+
runs-on: ubuntu-24.04
173+
steps:
174+
- name: Checkout
175+
uses: actions/checkout@v4
176+
177+
- name: Setup Node
178+
uses: actions/setup-node@v4
179+
180+
- name: Check Prettier code formatting
181+
run: |
182+
npm install prettier --global
183+
./run-tests.sh --check-prettier
184+
171185
docs-sphinx:
172186
runs-on: ubuntu-24.04
173187
steps:
@@ -251,8 +265,7 @@ jobs:
251265
release-docker:
252266
runs-on: ubuntu-24.04
253267
if: >
254-
vars.RELEASE_DOCKER == 'true' &&
255-
github.event_name == 'push' &&
268+
vars.RELEASE_DOCKER == 'true' && github.event_name == 'push' &&
256269
startsWith(github.ref, 'refs/tags/')
257270
needs:
258271
- 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-job-controller/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-job-controller/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
@@ -34,3 +34,5 @@ recursive-include etc *.yaml
3434
recursive-include etc *.sh
3535
include etc/ngbauth-submit
3636
include krb5/Dockerfile
37+
exclude .editorconfig
38+
exclude .prettierignore

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-Job-Controller is a component of the [REANA](http://www.reana.io/)
13-
reusable and reproducible research data analysis platform. It takes care
14-
of executing and managing jobs on compute clouds.
13+
reusable and reproducible research data analysis platform. It takes care of
14+
executing and managing jobs on compute clouds.
1515

1616
## Features
1717

docs/index.md

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ compute backends.
2323
```
2424

2525
```{image} /_static/reana-job-manager.png
26+
2627
```
2728

2829
### Kubernetes
@@ -32,10 +33,8 @@ compute backends.
3233
:members:
3334
```
3435

35-
:::{note}
36-
REANA-Job-Controller supports the Kubernetes job manager by default, no need
37-
to pass any build argument.
38-
:::
36+
Note that REANA-Job-Controller supports the Kubernetes job manager by default,
37+
no need to pass any build argument.
3938

4039
### HTCondor
4140

@@ -44,45 +43,36 @@ to pass any build argument.
4443
:members:
4544
```
4645

47-
:::{note}
48-
To build REANA-Job-Controller Docker image with HTCondor dependencies use build
49-
argument `COMPUTE_BACKENDS=kubernetes,htcondorcern`.
46+
Note that in order to build REANA-Job-Controller Docker image with HTCondor
47+
dependencies, you need to use a build argument
48+
`COMPUTE_BACKENDS=kubernetes,htcondorcern`:
5049

5150
```console
5251
$ reana-dev docker-build -c reana-job-controller \
5352
-b COMPUTE_BACKENDS=kubernetes,htcondorcern
5453
```
5554

56-
:::
57-
5855
### Slurm
5956

6057
```{eval-rst}
6158
.. automodule:: reana_job_controller.slurmcern_job_manager
6259
:members:
6360
```
6461

65-
:::{note}
66-
To build REANA-Job-Controller Docker image with Slum dependencies use build
67-
argument `COMPUTE_BACKENDS=kubernetes,slurmcern`.
62+
Note that in order to build REANA-Job-Controller Docker image with Slurm
63+
dependencies, you need to use a build argument
64+
`COMPUTE_BACKENDS=kubernetes,slurmcern`:
6865

6966
```console
7067
$ reana-dev docker-build -c reana-job-controller \
7168
-b COMPUTE_BACKENDS=kubernetes,slurmcern
7269
```
7370

74-
:::
75-
76-
:::{note}
77-
Please note that CERN Slurm cluster access is not granted by
78-
[default](https://batchdocs.web.cern.ch/linuxhpc/access.html).
79-
:::
80-
8171
## REST API
8272

8373
The REANA Job Controller API offers different endpoints to create, manage and
84-
monitor jobs.
85-
Detailed REST API documentation can be found <a href="_static/api.html">here</a>.
74+
monitor jobs. Detailed REST API documentation can be found
75+
<a href="_static/api.html">here</a>.
8676

8777
```{eval-rst}
8878
.. automodule:: reana_job_controller.rest

run-tests.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ check_markdownlint() {
131131
markdownlint-cli2 "**/*.md" -i "node_modules/**"
132132
}
133133

134+
check_prettier() {
135+
prettier -c .
136+
}
137+
134138
check_pytest() {
135139
clean_old_db_container
136140
start_db_container
@@ -164,6 +168,7 @@ check_all() {
164168
check_shfmt
165169
check_jsonlint
166170
check_markdownlint
171+
check_prettier
167172
}
168173

169174
check_all_darwin() {
@@ -215,6 +220,7 @@ case $arg in
215220
--check-jsonlint) check_jsonlint ;;
216221
--check-pytest) check_pytest ;;
217222
--check-shfmt) check_shfmt ;;
223+
--check-prettier) check_prettier ;;
218224
--check-markdownlint) check_markdownlint ;;
219225
--check-yamllint) check_yamllint ;;
220226
--check-all) check_all ;;

0 commit comments

Comments
 (0)