1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00

adding topic_maps yml linting config

fix _topic_maps/_topic_map.yml linting errors

fix linting errors in _topic_map.yml

gabriel's feedback
This commit is contained in:
aireilly
2023-11-14 12:40:10 +00:00
committed by openshift-cherrypick-robot
parent 1ccd360a75
commit fbd2179655
2 changed files with 43 additions and 0 deletions

11
.yamllint Normal file
View File

@@ -0,0 +1,11 @@
---
extends: relaxed
rules:
indentation: { spaces: 2, indent-sequences: false }
line-length: disable
colons:
max-spaces-before: 0
max-spaces-after: 1
empty-lines: disable
trailing-spaces: enable
new-line-at-end-of-file: enable

32
scripts/lint-topicmaps.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
# Use yamllint to lint and report errors for modified topic_map.yml files
# Ensure yamllint is installed
if ! command -v yamllint &>/dev/null; then
echo "yamllint is not installed. Please install it and try again 👻"
exit 127
fi
# List of modified topic_map files
FILES=$(git diff --name-only HEAD~1 HEAD --diff-filter=d "./_topic_maps/*.yml")
if [ -n "${FILES}" ]; then
has_errors=0
for FILE in ${FILES[@]}; do
if ! yamllint "$FILE"; then
echo "YAML error(s) found in $FILE 😥"
has_errors=1
fi
done
if [ $has_errors -eq 1 ]; then
exit 1
else
echo "No YAML errors found 🥳"
exit 0
fi
else
echo "No updated topic_maps... 😙"
exit 0
fi