-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (48 loc) · 1.61 KB
/
linting.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Linting
on:
push:
paths:
- '**.json'
- '**.yml'
- '**.yaml'
env:
PYTHON_VERSION: 3.11.6
jobs:
check-schemata:
name: Check Schemata
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: python -m pip install check-jsonschema pyyaml
- name: Check JSON Syntax
uses: limitusus/json-syntax-check@v2
with:
pattern: "\\.json$"
- name: Check YAML Syntax
uses: ibiqlik/action-yamllint@v3
with:
file_or_dir: ./*.yml
config_data: |
extends: default
rules:
line-length: disable
- name: Check JSON Schemata
run: check-jsonschema --verbose --check-metaschema *.schema.json
- name: Check Files Schemata
run: |
status=0;
for schema in *.schema.json; do
for ext in "yaml" "yml" "json"; do
if [[ -f "${schema%.schema.json}.$ext" ]]; then
check-jsonschema --verbose --schemafile "$schema" "${schema%.schema.json}.$ext" || status=$?;
fi;
done;
done;
exit $status
- name: Check Custom Signatures
run: |
python -c "import yaml; cs = yaml.load(open('custom_signatures.yml'), yaml.Loader); fs = yaml.load(open('fileformats.yml'), yaml.Loader); ps = set(c['puid'] for c in cs) - set(fs.keys()); assert not ps, f'Some custom signatures PUIDs are not present in file formats file: {sorted(ps)}.'"