Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--no-raise is not possible with --debug #1294

Open
diefans opened this issue Nov 18, 2024 · 0 comments
Open

--no-raise is not possible with --debug #1294

diefans opened this issue Nov 18, 2024 · 0 comments

Comments

@diefans
Copy link
Contributor

diefans commented Nov 18, 2024

Description

The actual code is clearly excluding --no-raise if --debug is set (https://github.com/commitizen-tools/commitizen/blob/master/commitizen/cli.py#L640-L648)

    if args.debug:
        logging.getLogger("commitizen").setLevel(logging.DEBUG)
        sys.excepthook = commitizen_debug_excepthook
    elif args.no_raise:
        no_raise_exit_codes = parse_no_raise(args.no_raise)
        no_raise_debug_excepthook = partial(
            commitizen_excepthook, no_raise=no_raise_exit_codes
        )
        sys.excepthook = no_raise_debug_excepthook

Since sys.excepthook is defined here https://github.com/commitizen-tools/commitizen/blob/master/commitizen/cli.py#L564
we can have possible working solution by iteratively precising the partial e.g.:

    if args.debug:
        logging.getLogger("commitizen").setLevel(logging.DEBUG)
        sys.excepthook = commitizen_debug_excepthook
    if args.no_raise:
        no_raise_exit_codes = parse_no_raise(args.no_raise)
        no_raise_debug_excepthook = partial(
            sys.excepthook, no_raise=no_raise_exit_codes
        )
        sys.excepthook = no_raise_debug_excepthook

Steps to reproduce

cz --debug --no-raise 21 bump --yes --changelog --dry-run

Current behavior

The usage of --debug prevents the usage of --no-raise

Desired behavior

I want to use --debug and --no-raise together.

Screenshots

No response

Environment

cz version
3.31.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant