Skip to content

wrap yaml into main to avoid it auto-running on validate through the import#163

Open
CIGbalance wants to merge 2 commits intomainfrom
fix/accidental_html_update
Open

wrap yaml into main to avoid it auto-running on validate through the import#163
CIGbalance wants to merge 2 commits intomainfrom
fix/accidental_html_update

Conversation

@CIGbalance
Copy link
Copy Markdown
Collaborator

@CIGbalance CIGbalance commented Apr 21, 2026

This pull request refactors the yaml_to_html.py script to improve code structure, readability, and maintainability. The main changes involve moving data loading and processing into a __main__ guard, reformatting code for clarity, and making minor improvements to table generation.

Code organization and structure:

  • Moved the main script logic (data loading, column selection, and table generation) under the if __name__ == "__main__": block to prevent accidental execution when the module is imported.
  • Reformatted code for better readability, including consistent indentation and line breaks, especially in the linkify_cell function and table generation. [1] [2]

Data loading and processing:

  • Relocated the data loading and column selection logic into the main guard, making the script's execution flow clearer and more modular. [1] [2]

Copilot AI review requested due to automatic review settings April 21, 2026 10:34
@CIGbalance CIGbalance changed the title wrap yaml into main to avoid it auto-running on validate through the … wrap yaml into main to avoid it auto-running on validate through the import Apr 21, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prevents yaml_to_html.py from executing its YAML→HTML generation logic on import (e.g., when utils/validate_yaml.py imports default_columns), by moving runtime behavior behind a __main__ guard.

Changes:

  • Wrapped YAML loading, table generation, and HTML file writing in if __name__ == "__main__":.
  • Moved default_columns to module scope so it remains importable without triggering generation.
  • Minor formatting adjustments (e.g., multiline href assignment, to_html call formatting).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread yaml_to_html.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@CIGbalance CIGbalance requested a review from kvdblom April 21, 2026 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants