Skip to content

Make the generated navigation and the repository's YAML yamllint-clean - #263

Open
seebi wants to merge 3 commits into
feature/zensicalfrom
feature/zensical-yamllint
Open

Make the generated navigation and the repository's YAML yamllint-clean#263
seebi wants to merge 3 commits into
feature/zensicalfrom
feature/zensical-yamllint

Conversation

@seebi

@seebi seebi commented Sep 5, 2026

Copy link
Copy Markdown
Member

nav.yml is generated, and its output satisfied none of yamllint's default
rules. Fixing that turned out to be worth doing properly, so this also brings
the rest of the repository's YAML in line and adds a check so it stays that way.

poetry run yamllint . now exits 0 across all 79 YAML files, up from 999
findings on nav.yml alone.

Three commits, in order

nav: generate yamllint-clean YAML — the generator emits a --- and dumps
through a Dumper subclass that indents block sequences beneath their parent
key, which is what indent-sequences expects. The regenerated nav.yml parses
equal to its predecessor: the diff is entirely whitespace and no page moves.

yaml: fix style issues across the tracked YAML files — the backlog that had
accumulated while nothing enforced style. Mostly the 64 .pages sources gaining
a document start and a final newline. Verified afterwards that the generated
nav.yml is byte-identical, so none of it touches the navigation.

check: add a yamllint stage backed by a committed configtask check:yamllint, wired into task check and pre-commit.

Two decisions worth reviewing

The indent is two, not four. Four is unreachable, not merely unchosen.
indentation defaults to spaces: consistent, so every step in the file must be
the same width, and a - item prefix already costs two columns for the mapping
key inside a sequence item. PyYAML's indent=4 pads the dash to - key: and
trips hyphens; re-indenting by hand to - key: trips indentation
instead, at 279 findings. Measured all four variants before settling.

The config is committed rather than left user-level. CI runs task check,
and a GitHub runner has no ~/.config/yamllint/config — without a repository
config the stage would fall back to yamllint's upstream defaults, line-length: 80 above all, and fail on nearly every file while passing locally. .yamllint
also has to name .pages explicitly in yaml-files, since yamllint selects by
filename and would otherwise skip the 65 extensionless sources that nav.yml is
generated from.

Escape hatches, both deliberate

A few nav entries pair a long title with a long path and exceed 120 columns.
YAML folds plain scalars only at internal spaces, never after the : , so they
cannot be wrapped — the generated header carries a yamllint disable rule:line-length directive rather than relaxing the rule repo-wide. Likewise
.github/ISSUE_TEMPLATE/bug.yml gets a disable-line: the URL alone exceeds the
limit, and a fold inside a folded scalar becomes a space and would break the
Markdown link.

Verification

yamllint . exit 0 · 53 unit tests pass · dec-tool build-navigation --check
in sync · poetry check --lock clean · zensical still resolves INHERIT: nav.yml to all 9 sections · nav.yml parses equal to the pre-change file.

🤖 Generated with Claude Code

https://claude.ai/code/session_014iAoGhmhEkcj4rAfGd7d8Z

nav.yml is generated by tools/build_navigation.py, and its output satisfied
none of yamllint's default rules: no document start, and block sequences
emitted at the same column as their parent key rather than indented under it.
That is 280 indentation findings plus a missing `---` on a file nothing hand
edits.

Emit a `---`, and dump through a Dumper subclass whose increase_indent forces
`indentless=False` so sequences nest beneath their key, as `indent-sequences`
expects.

The indent stays at two. Four is unreachable: `indentation` defaults to
`spaces: consistent`, so every step in the file must be the same width, and a
`- ` item prefix already costs two columns for the mapping key inside a
sequence item. PyYAML's `indent=4` pads the dash to `-   key:` and trips
`hyphens`; re-indenting by hand to `    - key:` trips `indentation` instead.
Both are recorded in a comment next to the dump so this does not get reopened.

A handful of entries pair a long title with a long docs-relative path and
exceed 120 columns. YAML folds plain scalars only at internal spaces, never
after the `: `, so they cannot be wrapped - the generated header carries a
`yamllint disable rule:line-length` directive rather than relaxing the rule
for the whole repository.

The regenerated nav.yml parses equal to its predecessor; the diff is entirely
whitespace and the navigation is unchanged.
Preparation for the yamllint check added next: these are every finding it
reports, fixed so the check can be turned on green.

The .pages navigation sources make up the bulk. 64 gain a `---` document
start and 30 a missing newline at end of file. One,
deploy-and-configure/configuration/explore/dataplatform/.pages, is the only
nested one and the only real error: its sub-list sat at column 8 where
`spaces: consistent` wants 10, since the key it hangs off is at column 6 and
the file's step is 4. Verified afterwards that the generated nav.yml is
byte-identical, so none of this moves a page in the navigation.

The three Helm values files under docs/ are downloadable examples rather than
snippet-included, so nothing on a rendered page changes. They pick up an
off-by-one nested indent, a doubled space after `secretName:`, bracket
spacing, a missing final newline, a document start, and a comment reflowed
under 120 columns.

.github/ISSUE_TEMPLATE/bug.yml keeps its over-long line: the URL alone
exceeds the limit and a folded scalar cannot help, because a line break
inside one becomes a space and would break the Markdown link. It gets a
`yamllint disable-line` directive instead, and the file still parses
identically.

mkdocs.yml and .gitpod.yml pick up comment spacing and a document start.
Nothing in this repository ran yamllint, so YAML style was unenforced and
drifted - the previous two commits are the backlog that had accumulated.

The config is committed rather than left to a user-level one. CI runs
`task check`, and a GitHub runner has no ~/.config/yamllint/config, so without
a repository config the stage would silently fall back to yamllint's stricter
upstream defaults - line-length 80 above all - and fail on nearly every file
while passing locally. .yamllint therefore restates the settings it is meant
to mirror, and says so in a comment.

`yaml-files` has to name `.pages` explicitly. yamllint selects by filename and
its built-in globs only cover *.yaml, *.yml and .yamllint, so the 65
extensionless navigation sources - the files nav.yml is generated from - would
otherwise go unchecked while the generated output was held to the rules.

truthy is relaxed for keys so that `on:` in a GitHub workflow stops being read
as the boolean.

Wired into `task check` between check:rumdl and check:navigation, and into
pre-commit with a filter that also fires on .pages. yamllint joins the dev
dependency group; the lock file is refreshed because CI installs from it.
@seebi
seebi requested a review from rpietzsch September 5, 2026 08:45
@github-actions

github-actions Bot commented Sep 5, 2026

Copy link
Copy Markdown

Test Results

1 files  ±0  2 suites  ±0   0s ⏱️ ±0s
2 tests ±0  0 ✅ ±0  0 💤 ±0  2 ❌ ±0 
2 runs  ±0  -7 ✅ ±0  0 💤 ±0  9 ❌ ±0 

For more details on these failures, see this check.

Results for commit 1411bd2. ± Comparison against base commit 7b0e371.

♻️ This comment has been updated with latest results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant