Skip to content

Commit 97361e9

Browse files
bkioshnstevenj
andauthored
fix: spectral linter (#340)
* fix: remove minify json Signed-off-by: bkioshn <[email protected]> * fix: replace tab with space Signed-off-by: bkioshn <[email protected]> * fix: update spectral linter Signed-off-by: bkioshn <[email protected]> * fix: update spectral linter Signed-off-by: bkioshn <[email protected]> * fix: move openapi linter Signed-off-by: bkioshn <[email protected]> --------- Signed-off-by: bkioshn <[email protected]> Co-authored-by: Steven Johnson <[email protected]>
1 parent 16fd122 commit 97361e9

File tree

6 files changed

+333
-364
lines changed

6 files changed

+333
-364
lines changed

Earthfile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,4 @@ edit-docs:
5757
LOCALLY
5858

5959
RUN ./earthly/docs/dev/local.py cat-ci-docs:latest
60-
61-
# check-lint-openapi - OpenAPI linting from a given directory
62-
check-lint-openapi:
63-
FROM spectral-ci+spectral-base
64-
DO spectral-ci+BUILD_SPECTRAL --dir="./examples/openapi" --file_type="json"
60+

earthly/spectral/Earthfile

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,20 @@ VERSION 0.8
33
# cspell: words ruleset
44

55
spectral-base:
6-
FROM stoplight/spectral
6+
FROM stoplight/spectral:6.13.1
77
WORKDIR /work
8-
COPY . .
9-
RUN chmod +x ./minify-json.sh
10-
SAVE ARTIFACT minify-json.sh
118

12-
BUILD_SPECTRAL:
9+
LINT:
1310
FUNCTION
14-
15-
# Specify what file type to lint
16-
ARG file_type = "json"
11+
12+
# FIle type to be linted, default linting only JSON files
13+
ARG file_type = json
14+
# Directory to lint
1715
ARG dir = .
18-
ARG src = .
1916
# Rule set for spectral
20-
ARG rule_set=.spectral.yml
21-
22-
COPY $src .
23-
24-
COPY +spectral-base/minify-json.sh minify-json.sh
25-
# If file type is json, minify the JSON
26-
RUN ./minify-json.sh
17+
ARG rule_set = .spectral.yml
2718

2819
RUN spectral \
2920
lint \
30-
$dir/"**/*.{yml,json}" \
31-
--ruleset $rule_set
21+
$dir/"**/*.$file_type" \
22+
--ruleset $rule_set

earthly/spectral/minify-json.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.
File renamed without changes.

examples/openapi/Earthfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
VERSION 0.8
2+
IMPORT ../../earthly/spectral AS spectral-ci
3+
4+
# check-lint-openapi - OpenAPI linting from a given directory
5+
check-lint-openapi:
6+
FROM spectral-ci+spectral-base
7+
COPY . .
8+
DO spectral-ci+LINT --dir=. --rule_set=.spectral.yml

0 commit comments

Comments
 (0)