Skip to content

Commit

Permalink
tests: fix doc validation
Browse files Browse the repository at this point in the history
  • Loading branch information
slyon committed Jul 12, 2022
1 parent 9cd058d commit 7633a6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,13 @@ test_env = [
'NETPLAN_GENERATE_PATH=' + join_paths(meson.current_build_dir(), 'src', 'generate'),
'NETPLAN_DBUS_CMD=' + join_paths(meson.current_build_dir(), 'dbus', 'netplan-dbus'),
]
#FIXME: exclude doc/env/
test('linting',
pyflakes,
args: [meson.current_source_dir()])
test('codestyle',
pycodestyle,
args: ['--max-line-length=130', meson.current_source_dir()])
args: ['--max-line-length=130', '--exclude=doc/env', meson.current_source_dir()])
test('documentation',
find_program('tests/validate_docs.sh'),
workdir: meson.current_source_dir())
Expand Down
10 changes: 5 additions & 5 deletions tests/validate_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# sanity check: make sure none have disappeared, as might happen from a reformat.
count=$(sed -n 's/[ ]\+{"\([a-z0-9-]\+\)", YAML_[A-Z]\+_NODE.*/\1/p' src/parse.c | sort | wc -l)
# 144 is based on 0.99+da6f776 definitions, and should be updated periodically.
if [ $count -lt 144 ]; then
if [ $count -lt 202 ]; then
echo "ERROR: fewer YAML keys defined in src/parse.c than expected!"
echo " Has the file been reformatted or refactored? If so, modify"
echo " validate_docs.sh appropriately."
Expand All @@ -16,13 +16,13 @@ fi
# iterate through the keys
for term in $(sed -n 's/[ ]\+{"\([a-z0-9-]\+\)", YAML_[A-Z]\+_NODE.*/\1/p' src/parse.c | sort | uniq); do
# it can be documented in the following ways.
# 1. "Properties for device type ``blah:``
if egrep "## Properties for device type \`\`$term:\`\`" doc/netplan-yaml.md > /dev/null; then
# 1. "Properties for device type **blah:**
if egrep "## Properties for device type \`$term:\`" doc/netplan-yaml.md > /dev/null; then
continue
fi

# 2. "[blah, ]``blah``[, ``blah2``]: (scalar|bool|...)
if egrep "\`\`$term\`\`.*\((scalar|bool|mapping|sequence of scalars|sequence of mappings|sequence of sequence of scalars)" doc/netplan-yaml.md > /dev/null; then
# 2. "[blah, ]**blah**[, **blah2**]: (scalar|bool|...)
if egrep "\*\*$term\*\*.*\((scalar|bool|mapping|sequence of scalars|sequence of mappings|sequence of sequence of scalars)" doc/netplan-yaml.md > /dev/null; then
continue
fi

Expand Down

0 comments on commit 7633a6b

Please sign in to comment.