Skip to content

Commit 2db4b79

Browse files
author
Gonzalo Diaz
committed
[CONFIG] [Github Actions] lint JSON files
1 parent 95343a3 commit 2db4b79

File tree

3 files changed

+70
-14
lines changed

3 files changed

+70
-14
lines changed

.github/workflows/prettier-json.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Prettier JSON Lint
3+
4+
on: # yamllint disable-line rule:truthy
5+
push:
6+
branches: ['main']
7+
pull_request:
8+
# The branches below must be a subset of the branches above
9+
branches: ['main']
10+
workflow_dispatch:
11+
12+
jobs:
13+
json-lint:
14+
name: 'Prettier JSON Lint'
15+
runs-on: ['ubuntu-24.04']
16+
steps:
17+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
18+
19+
- name: Set up Node.js
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: 24.x
23+
24+
- name: Install Prettier
25+
run: |
26+
npm install -g prettier@3.5.3
27+
28+
- name: Prettier LINT / Style JSON
29+
run: >
30+
prettier --check ./src/**/*.json

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ WORKDIR ${WORKDIR}
2121

2222
RUN apk add --update --no-cache make nodejs npm\
2323
&& apk add --update --no-cache yamllint \
24-
&& npm install -g --ignore-scripts markdownlint-cli
24+
&& npm install -g --ignore-scripts markdownlint-cli \
25+
&& npm install -g --ignore-scripts markdownlint-cli prettier
2526

2627
# [!TIP] Use a bind-mount to "/app" to override following "copys"
2728
# for lint and test against "current" sources in this stage

Makefile

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,60 @@ env:
4343
@printenv | grep -E "LOG_LEVEL|BRUTEFORCE|BUILDKIT_PROGRESS"
4444
@echo "################################################################################"
4545

46+
## Dependency management
4647
dependencies:
4748
@echo "################################################################################"
4849
@echo "## Dependencies: ###############################################################"
4950
@echo "################################################################################"
50-
$(GRADLE) dependencies
51+
$(GRADLE) dependencies --refresh-dependencies
5152
@echo "################################################################################"
5253

54+
outdated:
55+
$(GRADLE) dependencyUpdates
56+
57+
update: # TODO: Implement dependency update (dependency file)
58+
@echo "NOT IMPLEMENTED YET"
59+
60+
upgrade: # TODO: Implement dependency upgrade (download and install latest)
61+
@echo "NOT IMPLEMENTED YET"
62+
63+
clean:
64+
$(GRADLE) clean
65+
66+
## Building process
67+
build: env
68+
$(GRADLE) --console=verbose clean build \
69+
--exclude-task test \
70+
--exclude-task checkstyleMain \
71+
--exclude-task checkstyleTest
72+
73+
## Source code linting and formatting
74+
lint/json:
75+
prettier --check ./algorithm-exercises-java/**/*.json
76+
5377
lint/markdown:
5478
markdownlint '**/*.md' --ignore node_modules && echo '✔ Your code looks good.'
79+
5580
lint/yaml:
5681
yamllint --stric . && echo '✔ Your code looks good.'
5782

58-
lint: lint/markdown lint/yaml test/styling test/static
83+
lint: lint/markdown lint/yaml lint/json test/styling test/static
5984

85+
format/json:
86+
prettier --write ./algorithm-exercises-java/**/*.json
87+
88+
format/sources: # TODO: Implement source code formatting
89+
@echo "NOT IMPLEMENTED YET"
90+
91+
format: format/sources format/json
92+
93+
## Static code analysis
6094
test/styling: dependencies
6195
$(GRADLE) --console=verbose clean checkstyleMain checkstyleTest
6296

6397
test/static: dependencies
6498

99+
## Unit tests and coverage
65100
test: env
66101
$(GRADLE) --console=verbose clean test -x checkstyleMain checkstyleTest
67102

@@ -70,17 +105,7 @@ coverage: test
70105
coverage/html: test
71106
open algorithm-exercises-java/build/reports/jacoco/test/html/index.html
72107

73-
outdated:
74-
75-
clean:
76-
$(GRADLE) clean
77-
78-
build: env
79-
$(GRADLE) --console=verbose clean build \
80-
--exclude-task test \
81-
--exclude-task checkstyleMain \
82-
--exclude-task checkstyleTest
83-
108+
## Docker Compose commands
84109
compose/build: env
85110
${DOCKER_COMPOSE} --profile lint build
86111
${DOCKER_COMPOSE} --profile testing build

0 commit comments

Comments
 (0)