Skip to content

Commit f78fb11

Browse files
SorinOlarikr-t
authored andcommitted
scripts: add yml checker script
Signed-off-by: SorinO <sorin.olari2@gmail.com>
1 parent 202bcb0 commit f78fb11

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

scripts/yml_linter.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
# @copyright Copyright (c) contributors to Project Ocre,
3+
# which has been established as Project Ocre a Series of LF Projects, LLC
4+
#
5+
# SPDX-License-Identifier: Apache-2.0
6+
7+
# Simple linter checker for YAML files
8+
# Checks all YAML files with yamllint
9+
10+
set -e
11+
12+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13+
ROOT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
14+
15+
echo "Checking YAML files."
16+
17+
cd "$ROOT_DIR"
18+
19+
find . -type f \( -name '*.yml' -o -name '*.yaml' \) \
20+
! -path '*/build/*' \
21+
! -path './ocre-sdk/*' \
22+
! -path './wasm-micro-runtime/*' \
23+
! -path './tests/*' \
24+
-print0 | \
25+
xargs -0 yamllint -c "$SCRIPT_DIR/yml_linter_rules.yml"

scripts/yml_linter_rules.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# @copyright Copyright (c) contributors to Project Ocre,
2+
# which has been established as Project Ocre a Series of LF Projects, LLC
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
extends: default
7+
8+
rules:
9+
line-length:
10+
max: 150
11+
level: warning
12+
indentation:
13+
spaces: 2
14+
document-start: disable
15+
comments:
16+
min-spaces-from-content: 1
17+
trailing-spaces: enable
18+
empty-lines:
19+
max: 1
20+
truthy: {check-keys: false}

0 commit comments

Comments
 (0)