Skip to content

Conversation

@Ahzyuan
Copy link
Member

@Ahzyuan Ahzyuan commented Sep 25, 2025

Prep Steps

Before we dive in, let's confirm you've unlocked all these steps

  • πŸ” I've checked for duplicate PRs (click to check)
  • πŸ“œ I've followed contribution guidelines
    • ✨ I've linted and formatted my code (how?)
    • πŸ”§ I've formatted the PR title appropriately (how?)
    • 🎯 I've targeted the master branch (how?)
    • πŸ‘ I've allowed maintainer edits on my branch (how? β†’ See step 6)
  • πŸ›‘οΈ I've added/updated tests to cover my changes if prossible (how?)
  • πŸ“ I've added/updated the documentation for any new logic introduced (how?)
  • ⏳ I understand @Ahzyuan has been busy lately and may need time to review. (we appreciate your patience!)

Type of changes

  • 🐞 Bug fix
  • 🌟 New feature
  • πŸ§ͺ Tests
  • πŸ— Refactoring
  • ⚑ Performance improvement
  • πŸ“– Documentation / docstrings
  • ↩️ Revert
  • 🧩 Other

Description

Purpose

This PR is to improve the readability and maintainability of all shell scripts in misc dir.

Changes:

  • misc/utils.sh: the shared file to store all common helper functions, including colorful output functions, virtual env activation function and path location function.
  • misc/check_meta.sh: add author info and load common helper functions from misc/utils.sh instead of redefining them.
  • misc/docs_preview.sh: same as misc/check_meta.sh + fix Python dependency check logic(rectify the variable name and add empty check for lacking list).
  • misc/lint_format.sh: same as misc/check_meta.sh + use colorful output
  • misc/packaging.sh: same as misc/check_meta.sh
  • misc/validate_pr_title.sh: same as misc/check_meta.sh

- Extracted common functions (e.g., `red_output`, `green_output`, `find_dir`) into a new shared
  `utils.sh` script to reduce duplication across shell scripts.
- Updated existing scripts to source `utils.sh` instead of redefining helper functions.
- Removed redundant or commented-out code blocks (e.g., drawio and xvfb checks in `docs_preview.sh`).
@Ahzyuan Ahzyuan self-assigned this Sep 25, 2025
@github-actions github-actions bot added the refactor Restructure the code for better readability or organization without changing behavior. label Sep 25, 2025
@Ahzyuan Ahzyuan changed the title refactor(misc): Extract common helper functions into shared scripts refactor(misc): Extract common helper functions into a shared script Sep 25, 2025
@Ahzyuan Ahzyuan merged commit c6a2134 into master Sep 25, 2025
2 checks passed
@Ahzyuan Ahzyuan deleted the refactor/reuse-common-shell-func branch September 25, 2025 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Restructure the code for better readability or organization without changing behavior.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant