Skip to content

Commit 12eae26

Browse files
committed
fix: replace broken validate.sh by validate.js
BASH script has several issues: 1. Doesn't failed on error, because in bash variable (like `exampled_failed`) updated into a while loop are not updated outside the loop, because a while loop is a subprocess, you can look at https://www.baeldung.com/linux/while-loop-variable-scope 2. find: warning: you have specified the global option -maxdepth after the argument -type, but global options are not positional, i.e., -maxdepth affects tests specified before it as well as those specified after it. Please specify global options before other arguments. Because 1. is a symptom of the limit of bash for this script, and the tools already require the javascript stack (nodejs/bun/...) I replace the validate.sh by validate.js
1 parent b96af53 commit 12eae26

6 files changed

Lines changed: 325 additions & 289 deletions

File tree

.editorconfig

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# https://editorconfig.org/
2+
3+
root = true
4+
5+
[*]
6+
indent_style = space
7+
indent_size = 2
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
end_of_line = lf
11+
charset = utf-8
12+
13+
[*.md]
14+
#inside code block, indentation could be anything
15+
indent_size = unset
16+
17+
[*.py]
18+
indent_size = 4
19+
# 88 is the default for black formatter
20+
# 79 is PEP8's recommendation
21+
# 119 is django's recommendation
22+
max_line_length = 88
23+
24+
# The JSON files contain newlines inconsistently
25+
[*.json]
26+
insert_final_newline = unset
27+
28+
# Makefiles always use tabs for indentation
29+
[Makefile]
30+
indent_style = tab
31+
indent_size = 4

.github/workflows/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ jobs:
5959
cache: npm
6060
cache-dependency-path: tools/package-lock.json
6161
- name: Install dependencies
62-
run: |
63-
cd tools
64-
npm install -g --no-fund ajv-cli ajv-formats
62+
run: npm ci --no-fund
63+
working-directory: tools
6564
- name: Run Validate
66-
run: ./tools/validate.sh
65+
run: npm run validate
66+
working-directory: tools
6767

6868
spellcheck:
6969
name: Spellcheck (en_US)

tools/package-lock.json

Lines changed: 65 additions & 194 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"name": "cdevents-tools",
3+
"scripts": {
4+
"validate": "node validate.js"
5+
},
36
"dependencies": {
4-
"ajv-cli": "^5.0.0",
5-
"ajv-formats": "^3.0.1"
7+
"ajv": "^8.17",
8+
"ajv-formats": "^3.0",
9+
"glob": "^13.0"
610
}
711
}

0 commit comments

Comments
 (0)