Skip to content

cz commit -s should fail with deprecation warning BEFORE going through dialog, --help should reflect behavior #1135

Description

@yarikoptic

Description

Bad Dev Experience if asks for all the questions to only fail after

Steps to reproduce

Run cz commit -s -a

Current behavior

❯ cz commit -s -a
? Select the type of change you are committing style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
? What is the scope of this change? (class or file name): (press [enter] to skip)
 
? Write a short and imperative summary of the code changes: (lower case and no period)
 move codespell configuration to pyproject.toml
? Provide additional contextual information about the code changes: (press [enter] to skip)
 So people could just run "codespell" without pre-commit and have centralized configuration for tools (the others are already in pyproject.toml)
? Is this a BREAKING CHANGE? Correlates with MAJOR in SemVer No
? Footer. Information about Breaking Changes and reference issues that this commit closes: (press [enter] to skip)
 

style: move codespell configuration to pyproject.toml

So people could just run "codespell" without pre-commit and have centralized configuration for tools (the others are already in pyproject.toml)

signoff mechanic is deprecated, please use `cz commit -- -s` instead.
fatal: /home/yoh/.tmp/tmpsqo29rpl: '/home/yoh/.tmp/tmpsqo29rpl' is outside repository at '/home/yoh/proj/misc/commitizen'

Desired behavior

❯ cz commit -s -a
signoff mechanic is deprecated, please use `cz commit -- -s` instead.

Also --help should mention -- -- not there at all

❯ cz commit --help
usage: cz commit [-h] [--retry] [--no-retry] [--dry-run] [--write-message-to-file FILE_PATH] [-s] [-a] [-l MESSAGE_LENGTH_LIMIT]

options:
  -h, --help            show this help message and exit
  --retry               retry last commit
  --no-retry            skip retry if retry_after_failure is set to true
  --dry-run             show output to stdout, no commit, no modified files
  --write-message-to-file FILE_PATH
                        write message to file before committing (can be combined with --dry-run)
  -s, --signoff         sign off the commit
  -a, --all             Tell the command to automatically stage files that have been modified and deleted, but new files you have not told Git about are not affected.
  -l MESSAGE_LENGTH_LIMIT, --message-length-limit MESSAGE_LENGTH_LIMIT
                        length limit of the commit message; 0 for no limit

Screenshots

No response

Environment

❯ cz version
3.26.0
❯ python --version
Python 3.11.9

the rest is unrelated... and see

Activity

  1. Lee-W commented on May 22, 2024

    @Lee-W
    Member

    Hi @yarikoptic , thanks for reporting! This is indeed something missed.

  2. marcosdotme commented on May 23, 2024

    @marcosdotme
    Contributor

    @Lee-W Can I work on that?

  3. Lee-W commented on May 23, 2024

    @Lee-W
    Member

    More than welcome 🙂

  4. marcosdotme commented on May 24, 2024

    @marcosdotme
    Contributor

    @Lee-W @yarikoptic Guys, the behavior we expect is 1 or 2?

    Behavior 1 (prints the message and exit, forcing us to use cz commit -- -s)

    image

    Behavior 2 (prints the warning message and continue)

    image

    On the background, when we use the deprecated version cz commit -s, this is replaced with -- -s already:

    image

  5. Lee-W commented on May 27, 2024

    @Lee-W
    Member

    I would prefer 2 for now and maybe change it in v4 . We also need to add -- into the help text

  6. bearomorphism commented on Jun 1, 2025

    @bearomorphism
    Collaborator

    Not sure if this issue has been addressed. Need to test.

  7. bearomorphism commented on Jun 1, 2025

    @bearomorphism
    Collaborator

    Not yet on 4.8.2

    commitizen-py3.13➜  commitizen git:(master) cz c -s -- --allow-empty
    ? Select the type of change you are committing fix: A bug fix. Correlates with PATCH in SemVer
    ? What is the scope of this change? (class or file name): (press [enter] to skip)
     a
    ? Write a short and imperative summary of the code changes: (lower case and no period)
     a
    ? Provide additional contextual information about the code changes: (press [enter] to skip)
     a
    ? Is this a BREAKING CHANGE? Correlates with MAJOR in SemVer No
    ? Footer. Information about Breaking Changes and reference issues that this commit closes: (press [enter] to skip)
     
    
    fix(a): a
    
    a
    
    signoff mechanic is deprecated, please use `cz commit -- -s` instead.
    Check hooks apply to the repository.......................(no files to check)Skipped
    Check for useless excludes................................(no files to check)Skipped
    check vcs permalinks......................................(no files to check)Skipped
    fix end of files..........................................(no files to check)Skipped
    trim trailing whitespace..................................(no files to check)Skipped
    debug statements (python).................................(no files to check)Skipped
    don't commit to branch........................................................Failed
    - hook id: no-commit-to-branch
    - exit code: 1
    check for merge conflicts.................................(no files to check)Skipped
    check toml................................................(no files to check)Skipped
    check yaml................................................(no files to check)Skipped
    detect private key........................................(no files to check)Skipped
    blacken-docs..............................................(no files to check)Skipped
    Run codespell to check for common misspellings in files...(no files to check)Skipped
    Format....................................................(no files to check)Skipped
    Linters...................................................(no files to check)Skipped
    
  8. added 3 commits that reference this issue on Jun 1, 2025
    21bf61c
    de49304
    c31dfc2
  9. added a commit that references this issue on Jun 8, 2025
    9320f7e
  10. added a commit that references this issue on Jun 9, 2025
    a9c4e0a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions