Skip to content

Commit da63802

Browse files
committed
ci(prettier): add Prettier code formatting checks (#762)
1 parent c994a34 commit da63802

File tree

10 files changed

+66
-38
lines changed

10 files changed

+66
-38
lines changed

.github/workflows/ci.yml

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,20 @@ jobs:
9090
- name: Check Python code formatting
9191
run: ./run-tests.sh --format-black
9292

93+
format-prettier:
94+
runs-on: ubuntu-24.04
95+
steps:
96+
- name: Checkout
97+
uses: actions/checkout@v4
98+
99+
- name: Setup Node
100+
uses: actions/setup-node@v4
101+
102+
- name: Check Prettier code formatting
103+
run: |
104+
npm install prettier --global
105+
./run-tests.sh --format-prettier
106+
93107
format-shfmt:
94108
runs-on: ubuntu-24.04
95109
steps:
@@ -167,20 +181,6 @@ jobs:
167181
npm install jsonlint --global
168182
./run-tests.sh --lint-jsonlint
169183
170-
lint-markdownlint:
171-
runs-on: ubuntu-24.04
172-
steps:
173-
- name: Checkout
174-
uses: actions/checkout@v4
175-
176-
- name: Setup Node
177-
uses: actions/setup-node@v4
178-
179-
- name: Lint Markdown files
180-
run: |
181-
npm install markdownlint-cli2 --global
182-
./run-tests.sh --lint-markdownlint
183-
184184
lint-manifest:
185185
runs-on: ubuntu-24.04
186186
steps:
@@ -197,6 +197,20 @@ jobs:
197197
- name: Check Python manifest completeness
198198
run: ./run-tests.sh --lint-manifest
199199

200+
lint-markdownlint:
201+
runs-on: ubuntu-24.04
202+
steps:
203+
- name: Checkout
204+
uses: actions/checkout@v4
205+
206+
- name: Setup Node
207+
uses: actions/setup-node@v4
208+
209+
- name: Lint Markdown files
210+
run: |
211+
npm install markdownlint-cli2 --global
212+
./run-tests.sh --lint-markdownlint
213+
200214
lint-pydocstyle:
201215
runs-on: ubuntu-24.04
202216
steps:
@@ -285,22 +299,22 @@ jobs:
285299
release-docker:
286300
runs-on: ubuntu-24.04
287301
if: >
288-
vars.RELEASE_DOCKER == 'true' &&
289-
github.event_name == 'push' &&
302+
vars.RELEASE_DOCKER == 'true' && github.event_name == 'push' &&
290303
startsWith(github.ref, 'refs/tags/')
291304
needs:
292305
- docker-build
293306
- docs-cli-api
294307
- docs-cli-commands
295308
- docs-sphinx
296309
- format-black
310+
- format-prettier
297311
- format-shfmt
298312
- lint-commitlint
299313
- lint-flake8
300314
- lint-hadolint
301315
- lint-jsonlint
302-
- lint-markdownlint
303316
- lint-manifest
317+
- lint-markdownlint
304318
- lint-pydocstyle
305319
- lint-shellcheck
306320
- lint-yamllint

.markdownlint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Allow prompt dollar sign in console examples without showing output
2-
MD014: false
2+
MD014: false

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.pytest_cache
2+
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 },

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-client/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-client/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
@@ -13,6 +13,8 @@ include *.yaml
1313
include *.yml
1414
include .editorconfig
1515
include .flake8
16+
include .prettierignore
17+
include .prettierrc.yaml
1618
include .yamllint.yaml
1719
include Dockerfile
1820
include LICENSE

README.md

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

1313
REANA-Client is a component of the [REANA](https://www.reana.io/) reusable and
14-
reproducible research data analysis platform. It provides a command-line
15-
tool that allows researchers to submit, run, and manage their computational
14+
reproducible research data analysis platform. It provides a command-line tool
15+
that allows researchers to submit, run, and manage their computational
1616
workflows.
1717

1818
- seed workspace with input code and data

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
<!-- markdownlint-disable MD033 -->
33

44
% The title is set to `REANA-Client docs` instead of `REANA-Client` as this is a
5-
% workaround to avoid having multiple HTML objects with the same id/anchor,
6-
% as the tile clashes with the CLI API documentation generated by sphinx_click
5+
% workaround to avoid having multiple HTML objects with the same id/anchor, % as
6+
the tile clashes with the CLI API documentation generated by sphinx_click
77

88
# REANA-Client docs
99

run-tests.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,22 +90,22 @@ lint_flake8() {
9090
flake8 .
9191
}
9292

93-
lint_jsonlint() {
94-
find . -name "*.json" -exec jsonlint -q {} \+
95-
}
96-
9793
lint_hadolint() {
9894
docker run -i --rm docker.io/hadolint/hadolint:v2.12.0 <Dockerfile
9995
}
10096

101-
lint_markdownlint() {
102-
markdownlint-cli2 "**/*.md"
97+
lint_jsonlint() {
98+
find . -name "*.json" -exec jsonlint -q {} \+
10399
}
104100

105101
lint_manifest() {
106102
check-manifest
107103
}
108104

105+
lint_markdownlint() {
106+
markdownlint-cli2 "**/*.md"
107+
}
108+
109109
lint_pydocstyle() {
110110
pydocstyle reana_client
111111
}
@@ -129,13 +129,14 @@ all() {
129129
docs_cli_commands
130130
docs_sphinx
131131
format_black
132+
format_prettier
132133
format_shfmt
133134
lint_commitlint
134135
lint_flake8
135136
lint_hadolint
136137
lint_jsonlint
137-
lint_markdownlint
138138
lint_manifest
139+
lint_markdownlint
139140
lint_pydocstyle
140141
lint_shellcheck
141142
lint_yamllint
@@ -152,14 +153,15 @@ help() {
152153
echo " --docs-cli-commands Check CLI commands list"
153154
echo " --docs-sphinx Check Sphinx docs build"
154155
echo " --format-black Check formatting of Python code"
156+
echo " --format-prettier Check formatting of Markdown etc files"
155157
echo " --format-shfmt Check formatting of shell scripts"
156158
echo " --help Display this help message"
157159
echo " --lint-commitlint Check linting of commit messages"
158160
echo " --lint-flake8 Check linting of Python code"
159161
echo " --lint-hadolint Check linting of Dockerfiles"
160162
echo " --lint-jsonlint Check linting of JSON files"
161-
echo " --lint-markdownlint Check linting of Markdown files"
162163
echo " --lint-manifest Check linting of Python manifest"
164+
echo " --lint-markdownlint Check linting of Markdown files"
163165
echo " --lint-pydocstyle Check linting of Python docstrings"
164166
echo " --lint-shellcheck Check linting of shell scripts"
165167
echo " --lint-yamllint Check linting of YAML files"
@@ -181,13 +183,14 @@ case $arg in
181183
--docs-cli-commands) docs_cli_commands ;;
182184
--docs-sphinx) docs_sphinx ;;
183185
--format-black) format_black ;;
186+
--format-prettier) format_prettier ;;
184187
--format-shfmt) format_shfmt ;;
185188
--lint-commitlint) lint_commitlint "$@" ;;
186189
--lint-flake8) lint_flake8 ;;
187190
--lint-hadolint) lint_hadolint ;;
188191
--lint-jsonlint) lint_jsonlint ;;
189-
--lint-markdownlint) lint_markdownlint ;;
190192
--lint-manifest) lint_manifest ;;
193+
--lint-markdownlint) lint_markdownlint ;;
191194
--lint-pydocstyle) lint_pydocstyle ;;
192195
--lint-shellcheck) lint_shellcheck ;;
193196
--lint-yamllint) lint_yamllint ;;

0 commit comments

Comments
 (0)