Skip to content

Answer --help and Refuse Unknown Arguments in Every Python Script #539

Closed

Description

@ptr727

Summary

The fleet's CODESTYLE.md "Command-Line Arguments" says every command-line script answers --help and -h with its usage on stdout, exits 0, and changes nothing, and that it refuses an argument it does not recognize. Several of Blog's Python scripts do neither:

  • checks/env_docs_gate.py, checks/github_env_gate.py, checks/media_metadata_gate.py, and checks/media_redactions_gate.py ignore --help and run the gate. github_env_gate.py therefore reads the repository's variables and secrets from GitHub.
  • checks/url_parity_gate.py reads --help as the built site's path and fails with --help is not a directory.
  • capture/build_redirects.py refuses --help as an unknown option.

The scripts that already answer --help, such as csp_gate.py, text_pii_gate.py, and normalize_media.py, use argparse.

Done

Every script above answers --help and -h and refuses an unknown argument, and each gate's tests/ file covers both.

🤖 Generated with Claude Code

Activity

  1. added
    bug
    pre-existing
    python
    on Oct 26, 2026
  2. ptr727 commented on Oct 26, 2026

    @ptr727
    OwnerAuthor

    deploy/make-release.sh belongs on this list too, and it is the riskiest of them. It reads its first argument as the deploy root, so deploy/make-release.sh --help takes --help as that root and starts a release. It restores file mtimes and runs the build against the default environment file before anything refuses the root. On 2026-10-25 such a run stopped during the build and installed nothing. Its answer to --help should come before it sources any environment file.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpre-existingpython

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions