Skip to content

Commit d94decf

Browse files
committed
CLAUDE.md: Suggest method for checking generated Kconfig files
Claude was struggling a bit with how to validate the whitespace in .j2 files used to generate Kconfig menus. We stumbled on this method: generate a sample menu file and check that. Generated-by: Claude AI Signed-off-by: Chuck Lever <[email protected]>
1 parent 6386b3d commit d94decf

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

CLAUDE.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,28 @@ make fix-whitespace-last-commit
527527

528528
This will fix all white space only for new files you add.
529529

530+
### Testing Generated Kconfig Files
531+
532+
When working with scripts that generate Kconfig files (like `terraform/*/scripts/gen_kconfig_*`),
533+
the indentation checker cannot properly validate Jinja2 template files (.j2) because they
534+
can generate any kind of output, not just Kconfig.
535+
536+
**Correct approach**: Generate the output to a file named with "Kconfig" prefix and test that:
537+
538+
```bash
539+
# Example: Testing AWS AMI Kconfig generation
540+
cd terraform/aws/scripts
541+
python3 gen_kconfig_ami --quiet > /tmp/Kconfig.ami.test 2>&1
542+
python3 ../../../scripts/detect_indentation_issues.py /tmp/Kconfig.ami.test
543+
```
544+
545+
The indentation checker recognizes files starting with "Kconfig" and applies the correct
546+
rules (tabs for indentation, tab+2spaces for help text is valid).
547+
548+
**Why this matters**: Jinja2 templates (.j2) are generic and can generate Python, YAML,
549+
Kconfig, or any other format. The style checker cannot determine the output format from
550+
the template filename alone. Always test the generated output, not the template.
551+
530552
## Complex System Interactions
531553

532554
kdevops integrates multiple subsystems (Ansible, Kconfig, Git, Make) that often

0 commit comments

Comments
 (0)