From f5cc52846bd9cddcff1110f76eba9441ec8c627b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 May 2024 01:23:34 +0000 Subject: [PATCH 01/13] build(deps-dev): bump pytest from 8.2.0 to 8.2.1 Bumps [pytest](https://github.com/pytest-dev/pytest) from 8.2.0 to 8.2.1. - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/8.2.0...8.2.1) --- updated-dependencies: - dependency-name: pytest dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index b6313ee09e..2e16545b02 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1100,13 +1100,13 @@ extra = ["pygments (>=2.12)"] [[package]] name = "pytest" -version = "8.2.0" +version = "8.2.1" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-8.2.0-py3-none-any.whl", hash = "sha256:1733f0620f6cda4095bbf0d9ff8022486e91892245bb9e7d5542c018f612f233"}, - {file = "pytest-8.2.0.tar.gz", hash = "sha256:d507d4482197eac0ba2bae2e9babf0672eb333017bcedaa5fb1a3d42c1174b3f"}, + {file = "pytest-8.2.1-py3-none-any.whl", hash = "sha256:faccc5d332b8c3719f40283d0d44aa5cf101cec36f88cde9ed8f2bc0538612b1"}, + {file = "pytest-8.2.1.tar.gz", hash = "sha256:5046e5b46d8e4cac199c373041f26be56fdb81eb4e67dc11d4e10811fc3408fd"}, ] [package.dependencies] From 37522866e4788deb12b2ef1c426662400b0ebac8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 20 May 2024 13:58:43 +0000 Subject: [PATCH 02/13] docs(cli/screenshots) update CLI screenshots --- docs/images/cli_help/cz___help.svg | 172 +++++----- docs/images/cli_help/cz_bump___help.svg | 336 +++++++++---------- docs/images/cli_help/cz_changelog___help.svg | 180 +++++----- docs/images/cli_help/cz_check___help.svg | 4 +- docs/images/cli_help/cz_commit___help.svg | 103 +++--- docs/images/cli_help/cz_example___help.svg | 4 +- docs/images/cli_help/cz_info___help.svg | 4 +- docs/images/cli_help/cz_init___help.svg | 4 +- docs/images/cli_help/cz_ls___help.svg | 4 +- docs/images/cli_help/cz_schema___help.svg | 4 +- docs/images/cli_help/cz_version___help.svg | 4 +- 11 files changed, 418 insertions(+), 401 deletions(-) diff --git a/docs/images/cli_help/cz___help.svg b/docs/images/cli_help/cz___help.svg index 07b23d558f..22a9e4d0e7 100644 --- a/docs/images/cli_help/cz___help.svg +++ b/docs/images/cli_help/cz___help.svg @@ -1,4 +1,4 @@ - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + - + - - - - - $ cz --help -usage: cz [-h][--debug][-n NAME][-nr NO_RAISE] -{init,commit,c,ls,example,info,schema,bump,changelog,ch,check,version} -... - -Commitizen is a cli tool to generate conventional commits. -For more information about the topic go to https://conventionalcommits.org/ - -options: -  -h, --help            show this help message and exit -  --debug               use debug mode -  -n NAME, --name NAME  use the given commitizen (default: -                        cz_conventional_commits) -  -nr NO_RAISE, --no-raise NO_RAISE -                        comma separated error codes that won't rise error, -                        e.g: cz -nr 1,2,3 bump. See codes at -https://commitizen- -                        tools.github.io/commitizen/exit_codes/ - -commands: -{init,commit,c,ls,example,info,schema,bump,changelog,ch,check,version} -    init                init commitizen configuration -    commit (c)          create new commit -    ls                  show available commitizens -    example             show commit example -    info                show information about the cz -    schema              show commit schema -    bump                bump semantic version based on the git log -    changelog (ch)      generate changelog (note that it will overwrite -                        existing file) -    check               validates that a commit message matches the commitizen -                        schema -    version             get the version of the installed commitizen or the -                        current project (default: installed commitizen) - + + + + + $ cz --help +usage: cz [-h][--config CONFIG][--debug][-n NAME][-nr NO_RAISE] +{init,commit,c,ls,example,info,schema,bump,changelog,ch,check,version} +... + +Commitizen is a cli tool to generate conventional commits. +For more information about the topic go to https://conventionalcommits.org/ + +options: +  -h, --help            show this help message and exit +  --config CONFIG       the path of configuration file +  --debug               use debug mode +  -n NAME, --name NAME  use the given commitizen (default: +                        cz_conventional_commits) +  -nr NO_RAISE, --no-raise NO_RAISE +                        comma separated error codes that won't rise error, +                        e.g: cz -nr 1,2,3 bump. See codes at +https://commitizen- +                        tools.github.io/commitizen/exit_codes/ + +commands: +{init,commit,c,ls,example,info,schema,bump,changelog,ch,check,version} +    init                init commitizen configuration +    commit (c)          create new commit +    ls                  show available commitizens +    example             show commit example +    info                show information about the cz +    schema              show commit schema +    bump                bump semantic version based on the git log +    changelog (ch)      generate changelog (note that it will overwrite +                        existing file) +    check               validates that a commit message matches the commitizen +                        schema +    version             get the version of the installed commitizen or the +                        current project (default: installed commitizen) + diff --git a/docs/images/cli_help/cz_bump___help.svg b/docs/images/cli_help/cz_bump___help.svg index 18d402f16e..5b71728ccf 100644 --- a/docs/images/cli_help/cz_bump___help.svg +++ b/docs/images/cli_help/cz_bump___help.svg @@ -19,261 +19,261 @@ font-weight: 700; } - .terminal-2106414123-matrix { + .terminal-908877803-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-2106414123-title { + .terminal-908877803-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-2106414123-r1 { fill: #c5c8c6 } -.terminal-2106414123-r2 { fill: #c5c8c6;font-weight: bold } -.terminal-2106414123-r3 { fill: #68a0b3;font-weight: bold } -.terminal-2106414123-r4 { fill: #98a84b } + .terminal-908877803-r1 { fill: #c5c8c6 } +.terminal-908877803-r2 { fill: #c5c8c6;font-weight: bold } +.terminal-908877803-r3 { fill: #68a0b3;font-weight: bold } +.terminal-908877803-r4 { fill: #98a84b } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -284,89 +284,89 @@ - - - - - $ cz bump --help -usage: cz bump [-h][--dry-run][--files-only][--local-version][--changelog] -[--no-verify][--yes][--tag-format TAG_FORMAT] -[--bump-message BUMP_MESSAGE][--prerelease {alpha,beta,rc}] -[--devrelease DEVRELEASE][--increment {MAJOR,MINOR,PATCH}] -[--increment-mode {linear,exact}][--check-consistency] -[--annotated-tag] -[--annotated-tag-message ANNOTATED_TAG_MESSAGE][--gpg-sign] -[--changelog-to-stdout][--git-output-to-stderr][--retry] -[--major-version-zero][--template TEMPLATE][--extra EXTRA] -[--file-name FILE_NAME][--prerelease-offset PRERELEASE_OFFSET] -[--version-scheme {semver,pep440}] -[--version-type {semver,pep440}] -[--build-metadata BUILD_METADATA] -[MANUAL_VERSION] - -positional arguments: -  MANUAL_VERSION        bump to the given version (e.g: 1.5.3) - -options: -  -h, --help            show this help message and exit -  --dry-run             show output to stdout, no commit, no modified files -  --files-only          bump version in the files from the config -  --local-version       bump only the local version portion -  --changelog, -ch      generate the changelog for the newest version -  --no-verify           this option bypasses the pre-commit and commit-msg -                        hooks -  --yes                 accept automatically questions done -  --tag-format TAG_FORMAT -                        the format used to tag the commit and read it, use it -                        in existing projects, wrap around simple quotes -  --bump-message BUMP_MESSAGE -                        template used to create the release commit, useful -                        when working with CI -  --prerelease {alpha,beta,rc}, -pr {alpha,beta,rc} -                        choose type of prerelease -  --devrelease DEVRELEASE, -d DEVRELEASE -                        specify non-negative integer for dev. release -  --increment {MAJOR,MINOR,PATCH} -                        manually specify the desired increment -  --increment-mode {linear,exact} -                        set the method by which the new version is chosen. -'linear'(default) guesses the next version based on -                        typical linear version progression, such that bumping -                        of a pre-release with lower precedence than the -                        current pre-release phase maintains the current phase -                        of higher precedence. 'exact' applies the changes that -                        have been specified (or determined from the commit -                        log) without interpretation, such that the increment -                        and pre-release are always honored -  --check-consistency, -cc -                        check consistency among versions defined in commitizen -                        configuration and version_files -  --annotated-tag, -at  create annotated tag instead of lightweight one -  --annotated-tag-message ANNOTATED_TAG_MESSAGE, -atm ANNOTATED_TAG_MESSAGE -                        create annotated tag message -  --gpg-sign, -s        sign tag instead of lightweight one -  --changelog-to-stdout -                        Output changelog to the stdout -  --git-output-to-stderr -                        Redirect git output to stderr -  --retry               retry commit if it fails the 1st time -  --major-version-zero  keep major version at zero, even for breaking changes -  --template TEMPLATE, -t TEMPLATE -                        changelog template file name (relative to the current -                        working directory) -  --extra EXTRA, -e EXTRA -                        a changelog extra variable (in the form 'key=value') -  --file-name FILE_NAME -                        file name of changelog (default: 'CHANGELOG.md') -  --prerelease-offset PRERELEASE_OFFSET -                        start pre-releases with this offset -  --version-scheme {semver,pep440} -                        choose version scheme -  --version-type {semver,pep440} -                        Deprecated, use --version-scheme -  --build-metadata BUILD_METADATA -                        Add additional build-metadata to the version-number - + + + + + $ cz bump --help +usage: cz bump [-h][--dry-run][--files-only][--local-version][--changelog] +[--no-verify][--yes][--tag-format TAG_FORMAT] +[--bump-message BUMP_MESSAGE][--prerelease {alpha,beta,rc}] +[--devrelease DEVRELEASE][--increment {MAJOR,MINOR,PATCH}] +[--increment-mode {linear,exact}][--check-consistency] +[--annotated-tag] +[--annotated-tag-message ANNOTATED_TAG_MESSAGE][--gpg-sign] +[--changelog-to-stdout][--git-output-to-stderr][--retry] +[--major-version-zero][--template TEMPLATE][--extra EXTRA] +[--file-name FILE_NAME][--prerelease-offset PRERELEASE_OFFSET] +[--version-scheme {pep440,semver,semver2}] +[--version-type {pep440,semver,semver2}] +[--build-metadata BUILD_METADATA] +[MANUAL_VERSION] + +positional arguments: +  MANUAL_VERSION        bump to the given version (e.g: 1.5.3) + +options: +  -h, --help            show this help message and exit +  --dry-run             show output to stdout, no commit, no modified files +  --files-only          bump version in the files from the config +  --local-version       bump only the local version portion +  --changelog, -ch      generate the changelog for the newest version +  --no-verify           this option bypasses the pre-commit and commit-msg +                        hooks +  --yes                 accept automatically questions done +  --tag-format TAG_FORMAT +                        the format used to tag the commit and read it, use it +                        in existing projects, wrap around simple quotes +  --bump-message BUMP_MESSAGE +                        template used to create the release commit, useful +                        when working with CI +  --prerelease {alpha,beta,rc}, -pr {alpha,beta,rc} +                        choose type of prerelease +  --devrelease DEVRELEASE, -d DEVRELEASE +                        specify non-negative integer for dev. release +  --increment {MAJOR,MINOR,PATCH} +                        manually specify the desired increment +  --increment-mode {linear,exact} +                        set the method by which the new version is chosen. +'linear'(default) guesses the next version based on +                        typical linear version progression, such that bumping +                        of a pre-release with lower precedence than the +                        current pre-release phase maintains the current phase +                        of higher precedence. 'exact' applies the changes that +                        have been specified (or determined from the commit +                        log) without interpretation, such that the increment +                        and pre-release are always honored +  --check-consistency, -cc +                        check consistency among versions defined in commitizen +                        configuration and version_files +  --annotated-tag, -at  create annotated tag instead of lightweight one +  --annotated-tag-message ANNOTATED_TAG_MESSAGE, -atm ANNOTATED_TAG_MESSAGE +                        create annotated tag message +  --gpg-sign, -s        sign tag instead of lightweight one +  --changelog-to-stdout +                        Output changelog to the stdout +  --git-output-to-stderr +                        Redirect git output to stderr +  --retry               retry commit if it fails the 1st time +  --major-version-zero  keep major version at zero, even for breaking changes +  --template TEMPLATE, -t TEMPLATE +                        changelog template file name (relative to the current +                        working directory) +  --extra EXTRA, -e EXTRA +                        a changelog extra variable (in the form 'key=value') +  --file-name FILE_NAME +                        file name of changelog (default: 'CHANGELOG.md') +  --prerelease-offset PRERELEASE_OFFSET +                        start pre-releases with this offset +  --version-scheme {pep440,semver,semver2} +                        choose version scheme +  --version-type {pep440,semver,semver2} +                        Deprecated, use --version-scheme +  --build-metadata BUILD_METADATA +                        Add additional build-metadata to the version-number + diff --git a/docs/images/cli_help/cz_changelog___help.svg b/docs/images/cli_help/cz_changelog___help.svg index 4f236ea467..a7d277df44 100644 --- a/docs/images/cli_help/cz_changelog___help.svg +++ b/docs/images/cli_help/cz_changelog___help.svg @@ -19,144 +19,144 @@ font-weight: 700; } - .terminal-3815852825-matrix { + .terminal-37245177-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-3815852825-title { + .terminal-37245177-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-3815852825-r1 { fill: #c5c8c6 } -.terminal-3815852825-r2 { fill: #c5c8c6;font-weight: bold } -.terminal-3815852825-r3 { fill: #68a0b3;font-weight: bold } -.terminal-3815852825-r4 { fill: #98a84b } + .terminal-37245177-r1 { fill: #c5c8c6 } +.terminal-37245177-r2 { fill: #c5c8c6;font-weight: bold } +.terminal-37245177-r3 { fill: #68a0b3;font-weight: bold } +.terminal-37245177-r4 { fill: #98a84b } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -167,50 +167,50 @@ - - - - - $ cz changelog --help -usage: cz changelog [-h][--dry-run][--file-name FILE_NAME] -[--unreleased-version UNRELEASED_VERSION][--incremental] -[--start-rev START_REV][--merge-prerelease] -[--version-scheme {pep440,semver}] -[--export-template EXPORT_TEMPLATE][--template TEMPLATE] -[--extra EXTRA] - - -positional arguments: -  rev_range             generates changelog for the given version (e.g: 1.5.3) -                        or version range (e.g: 1.5.3..1.7.9) - -options: -  -h, --help            show this help message and exit -  --dry-run             show changelog to stdout -  --file-name FILE_NAME -                        file name of changelog (default: 'CHANGELOG.md') -  --unreleased-version UNRELEASED_VERSION -                        set the value for the new version (use the tag value), -                        instead of using unreleased -  --incremental         generates changelog from last created version, useful -                        if the changelog has been manually modified -  --start-rev START_REV -                        start rev of the changelog. If not set, it will -                        generate changelog from the start -  --merge-prerelease    collect all changes from prereleases into next non- -                        prerelease. If not set, it will include prereleases in -                        the changelog -  --version-scheme {pep440,semver} -                        choose version scheme -  --export-template EXPORT_TEMPLATE -                        Export the changelog template into this file instead -                        of rendering it -  --template TEMPLATE, -t TEMPLATE -                        changelog template file name (relative to the current -                        working directory) -  --extra EXTRA, -e EXTRA -                        a changelog extra variable (in the form 'key=value') - + + + + + $ cz changelog --help +usage: cz changelog [-h][--dry-run][--file-name FILE_NAME] +[--unreleased-version UNRELEASED_VERSION][--incremental] +[--start-rev START_REV][--merge-prerelease] +[--version-scheme {semver,semver2,pep440}] +[--export-template EXPORT_TEMPLATE][--template TEMPLATE] +[--extra EXTRA] + + +positional arguments: +  rev_range             generates changelog for the given version (e.g: 1.5.3) +                        or version range (e.g: 1.5.3..1.7.9) + +options: +  -h, --help            show this help message and exit +  --dry-run             show changelog to stdout +  --file-name FILE_NAME +                        file name of changelog (default: 'CHANGELOG.md') +  --unreleased-version UNRELEASED_VERSION +                        set the value for the new version (use the tag value), +                        instead of using unreleased +  --incremental         generates changelog from last created version, useful +                        if the changelog has been manually modified +  --start-rev START_REV +                        start rev of the changelog. If not set, it will +                        generate changelog from the start +  --merge-prerelease    collect all changes from prereleases into next non- +                        prerelease. If not set, it will include prereleases in +                        the changelog +  --version-scheme {semver,semver2,pep440} +                        choose version scheme +  --export-template EXPORT_TEMPLATE +                        Export the changelog template into this file instead +                        of rendering it +  --template TEMPLATE, -t TEMPLATE +                        changelog template file name (relative to the current +                        working directory) +  --extra EXTRA, -e EXTRA +                        a changelog extra variable (in the form 'key=value') + diff --git a/docs/images/cli_help/cz_check___help.svg b/docs/images/cli_help/cz_check___help.svg index 82dab7282e..427d91e414 100644 --- a/docs/images/cli_help/cz_check___help.svg +++ b/docs/images/cli_help/cz_check___help.svg @@ -116,9 +116,9 @@ - + - + $ cz check --help usage: cz check [-h] diff --git a/docs/images/cli_help/cz_commit___help.svg b/docs/images/cli_help/cz_commit___help.svg index e29f55607d..deb871fce9 100644 --- a/docs/images/cli_help/cz_commit___help.svg +++ b/docs/images/cli_help/cz_commit___help.svg @@ -1,4 +1,4 @@ - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + - + - - - - - $ cz commit --help -usage: cz commit [-h][--retry][--no-retry][--dry-run] -[--write-message-to-file FILE_PATH][-s][-a] - -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. - + + + + + $ 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 + diff --git a/docs/images/cli_help/cz_example___help.svg b/docs/images/cli_help/cz_example___help.svg index a3fee0064a..e142dd4f9b 100644 --- a/docs/images/cli_help/cz_example___help.svg +++ b/docs/images/cli_help/cz_example___help.svg @@ -63,9 +63,9 @@ - + - + $ cz example --help usage: cz example [-h] diff --git a/docs/images/cli_help/cz_info___help.svg b/docs/images/cli_help/cz_info___help.svg index 02c2f313df..8059ec466c 100644 --- a/docs/images/cli_help/cz_info___help.svg +++ b/docs/images/cli_help/cz_info___help.svg @@ -63,9 +63,9 @@ - + - + $ cz info --help usage: cz info [-h] diff --git a/docs/images/cli_help/cz_init___help.svg b/docs/images/cli_help/cz_init___help.svg index b296b79d76..6bcd577160 100644 --- a/docs/images/cli_help/cz_init___help.svg +++ b/docs/images/cli_help/cz_init___help.svg @@ -63,9 +63,9 @@ - + - + $ cz init --help usage: cz init [-h] diff --git a/docs/images/cli_help/cz_ls___help.svg b/docs/images/cli_help/cz_ls___help.svg index 7e95d4c8dc..390f5bbb42 100644 --- a/docs/images/cli_help/cz_ls___help.svg +++ b/docs/images/cli_help/cz_ls___help.svg @@ -63,9 +63,9 @@ - + - + $ cz ls --help usage: cz ls [-h] diff --git a/docs/images/cli_help/cz_schema___help.svg b/docs/images/cli_help/cz_schema___help.svg index 201778bdfd..443634428d 100644 --- a/docs/images/cli_help/cz_schema___help.svg +++ b/docs/images/cli_help/cz_schema___help.svg @@ -63,9 +63,9 @@ - + - + $ cz schema --help usage: cz schema [-h] diff --git a/docs/images/cli_help/cz_version___help.svg b/docs/images/cli_help/cz_version___help.svg index 0a7dc85397..0d14aaffa1 100644 --- a/docs/images/cli_help/cz_version___help.svg +++ b/docs/images/cli_help/cz_version___help.svg @@ -78,9 +78,9 @@ - + - + $ cz version --help usage: cz version [-h][-r | -p | -c | -v] From b62456a61a95351c285a8ca340670e65f96fbda9 Mon Sep 17 00:00:00 2001 From: Marcos Martins Date: Mon, 20 May 2024 09:53:26 -0300 Subject: [PATCH 03/13] ci(workflow): move 'generate_cli_screenshots' steps to 'docspublish' Since the purpose is to updated the CLI screenshots on Github Pages, combining this two workflows makes sense. --- .github/workflows/docspublish.yml | 31 +++++++++++++++ .../workflows/generate_cli_screenshots.yml | 39 ------------------- 2 files changed, 31 insertions(+), 39 deletions(-) delete mode 100644 .github/workflows/generate_cli_screenshots.yml diff --git a/.github/workflows/docspublish.yml b/.github/workflows/docspublish.yml index d95b464b40..1ac8e7f5e3 100644 --- a/.github/workflows/docspublish.yml +++ b/.github/workflows/docspublish.yml @@ -6,13 +6,44 @@ on: - master jobs: + update-cli-screenshots: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install dependencies + run: | + python -m pip install -U pip poetry + poetry --version + poetry install + - name: Update CLI screenshots + run: | + poetry run python scripts/gen_cli_help_screenshots.py + - name: Commit and push updated CLI screenshots + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add docs/images/cli_help + git commit -m "docs(cli/screenshots) update CLI screenshots" -m "[skip ci]" + git push + publish-documentation: runs-on: ubuntu-latest + needs: update-cli-screenshots steps: - uses: actions/checkout@v4 with: token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" fetch-depth: 0 + - name: Pull latest changes + run: | + git pull origin master - name: Set up Python uses: actions/setup-python@v5 with: diff --git a/.github/workflows/generate_cli_screenshots.yml b/.github/workflows/generate_cli_screenshots.yml deleted file mode 100644 index 7bbc8b16d9..0000000000 --- a/.github/workflows/generate_cli_screenshots.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Generate CLI screenshots - -on: - pull_request: - types: - - closed - -jobs: - generate_cli_screenshots: - if: github.event.pull_request.merged == true - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - token: "${{ secrets.PERSONAL_ACCESS_TOKEN }}" - fetch-depth: 0 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.x" - - - name: Install dependencies - run: | - python -m pip install -U pip poetry - poetry --version - poetry install - - - name: Generate CLI screenshots - run: | - poetry run python scripts/gen_cli_help_screenshots.py - - - name: Commit and push CLI screenshots - run: | - git config --global user.name "github-actions[bot]" - git config --global user.email "github-actions[bot]@users.noreply.github.com" - git add docs/images/cli_help - git commit -m "docs(cli/screenshots) update CLI screenshots" - git push From e6e97dcdbeb993d7e10b9fdfd55525a00ade22e2 Mon Sep 17 00:00:00 2001 From: Marcos Martins Date: Mon, 20 May 2024 11:38:18 -0300 Subject: [PATCH 04/13] ci: exclude *.svg files from trailing whitespace hook --- .pre-commit-config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d3c9a02544..163e7a0ab3 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,6 +21,7 @@ repos: exclude: "tests/((commands|data)/|test_).+" - id: trailing-whitespace args: [ --markdown-linebreak-ext=md ] + exclude: '\.svg$' - id: debug-statements - id: no-commit-to-branch - id: check-merge-conflict From 59270b96e6b7e2f8121ea6d6025634ecfa64ae18 Mon Sep 17 00:00:00 2001 From: Wei Lee Date: Tue, 21 May 2024 00:04:23 +0800 Subject: [PATCH 05/13] ci(docpublish): reword cli screenshot generation commit message --- .github/workflows/docspublish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docspublish.yml b/.github/workflows/docspublish.yml index 1ac8e7f5e3..4ac9a3a4a4 100644 --- a/.github/workflows/docspublish.yml +++ b/.github/workflows/docspublish.yml @@ -30,7 +30,7 @@ jobs: git config --global user.name "github-actions[bot]" git config --global user.email "github-actions[bot]@users.noreply.github.com" git add docs/images/cli_help - git commit -m "docs(cli/screenshots) update CLI screenshots" -m "[skip ci]" + git commit -m "docs(cli/screenshots): update CLI screenshots" -m "[skip ci]" git push publish-documentation: From 7eafdfa3f53709fba80a21663c7788062e5457dd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 20 May 2024 16:16:25 +0000 Subject: [PATCH 06/13] docs(cli/screenshots): update CLI screenshots [skip ci] --- docs/images/cli_help/cz_bump___help.svg | 332 +++++++++---------- docs/images/cli_help/cz_changelog___help.svg | 176 +++++----- 2 files changed, 254 insertions(+), 254 deletions(-) diff --git a/docs/images/cli_help/cz_bump___help.svg b/docs/images/cli_help/cz_bump___help.svg index 5b71728ccf..6d217d3958 100644 --- a/docs/images/cli_help/cz_bump___help.svg +++ b/docs/images/cli_help/cz_bump___help.svg @@ -19,261 +19,261 @@ font-weight: 700; } - .terminal-908877803-matrix { + .terminal-1103912939-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-908877803-title { + .terminal-1103912939-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-908877803-r1 { fill: #c5c8c6 } -.terminal-908877803-r2 { fill: #c5c8c6;font-weight: bold } -.terminal-908877803-r3 { fill: #68a0b3;font-weight: bold } -.terminal-908877803-r4 { fill: #98a84b } + .terminal-1103912939-r1 { fill: #c5c8c6 } +.terminal-1103912939-r2 { fill: #c5c8c6;font-weight: bold } +.terminal-1103912939-r3 { fill: #68a0b3;font-weight: bold } +.terminal-1103912939-r4 { fill: #98a84b } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -285,88 +285,88 @@ - + - - $ cz bump --help -usage: cz bump [-h][--dry-run][--files-only][--local-version][--changelog] -[--no-verify][--yes][--tag-format TAG_FORMAT] -[--bump-message BUMP_MESSAGE][--prerelease {alpha,beta,rc}] -[--devrelease DEVRELEASE][--increment {MAJOR,MINOR,PATCH}] -[--increment-mode {linear,exact}][--check-consistency] -[--annotated-tag] -[--annotated-tag-message ANNOTATED_TAG_MESSAGE][--gpg-sign] -[--changelog-to-stdout][--git-output-to-stderr][--retry] -[--major-version-zero][--template TEMPLATE][--extra EXTRA] -[--file-name FILE_NAME][--prerelease-offset PRERELEASE_OFFSET] -[--version-scheme {pep440,semver,semver2}] -[--version-type {pep440,semver,semver2}] -[--build-metadata BUILD_METADATA] -[MANUAL_VERSION] - -positional arguments: -  MANUAL_VERSION        bump to the given version (e.g: 1.5.3) - -options: -  -h, --help            show this help message and exit -  --dry-run             show output to stdout, no commit, no modified files -  --files-only          bump version in the files from the config -  --local-version       bump only the local version portion -  --changelog, -ch      generate the changelog for the newest version -  --no-verify           this option bypasses the pre-commit and commit-msg -                        hooks -  --yes                 accept automatically questions done -  --tag-format TAG_FORMAT -                        the format used to tag the commit and read it, use it -                        in existing projects, wrap around simple quotes -  --bump-message BUMP_MESSAGE -                        template used to create the release commit, useful -                        when working with CI -  --prerelease {alpha,beta,rc}, -pr {alpha,beta,rc} -                        choose type of prerelease -  --devrelease DEVRELEASE, -d DEVRELEASE -                        specify non-negative integer for dev. release -  --increment {MAJOR,MINOR,PATCH} -                        manually specify the desired increment -  --increment-mode {linear,exact} -                        set the method by which the new version is chosen. -'linear'(default) guesses the next version based on -                        typical linear version progression, such that bumping -                        of a pre-release with lower precedence than the -                        current pre-release phase maintains the current phase -                        of higher precedence. 'exact' applies the changes that -                        have been specified (or determined from the commit -                        log) without interpretation, such that the increment -                        and pre-release are always honored -  --check-consistency, -cc -                        check consistency among versions defined in commitizen -                        configuration and version_files -  --annotated-tag, -at  create annotated tag instead of lightweight one -  --annotated-tag-message ANNOTATED_TAG_MESSAGE, -atm ANNOTATED_TAG_MESSAGE -                        create annotated tag message -  --gpg-sign, -s        sign tag instead of lightweight one -  --changelog-to-stdout -                        Output changelog to the stdout -  --git-output-to-stderr -                        Redirect git output to stderr -  --retry               retry commit if it fails the 1st time -  --major-version-zero  keep major version at zero, even for breaking changes -  --template TEMPLATE, -t TEMPLATE -                        changelog template file name (relative to the current -                        working directory) -  --extra EXTRA, -e EXTRA -                        a changelog extra variable (in the form 'key=value') -  --file-name FILE_NAME -                        file name of changelog (default: 'CHANGELOG.md') -  --prerelease-offset PRERELEASE_OFFSET -                        start pre-releases with this offset -  --version-scheme {pep440,semver,semver2} -                        choose version scheme -  --version-type {pep440,semver,semver2} -                        Deprecated, use --version-scheme -  --build-metadata BUILD_METADATA -                        Add additional build-metadata to the version-number - + + $ cz bump --help +usage: cz bump [-h][--dry-run][--files-only][--local-version][--changelog] +[--no-verify][--yes][--tag-format TAG_FORMAT] +[--bump-message BUMP_MESSAGE][--prerelease {alpha,beta,rc}] +[--devrelease DEVRELEASE][--increment {MAJOR,MINOR,PATCH}] +[--increment-mode {linear,exact}][--check-consistency] +[--annotated-tag] +[--annotated-tag-message ANNOTATED_TAG_MESSAGE][--gpg-sign] +[--changelog-to-stdout][--git-output-to-stderr][--retry] +[--major-version-zero][--template TEMPLATE][--extra EXTRA] +[--file-name FILE_NAME][--prerelease-offset PRERELEASE_OFFSET] +[--version-scheme {semver2,pep440,semver}] +[--version-type {semver2,pep440,semver}] +[--build-metadata BUILD_METADATA] +[MANUAL_VERSION] + +positional arguments: +  MANUAL_VERSION        bump to the given version (e.g: 1.5.3) + +options: +  -h, --help            show this help message and exit +  --dry-run             show output to stdout, no commit, no modified files +  --files-only          bump version in the files from the config +  --local-version       bump only the local version portion +  --changelog, -ch      generate the changelog for the newest version +  --no-verify           this option bypasses the pre-commit and commit-msg +                        hooks +  --yes                 accept automatically questions done +  --tag-format TAG_FORMAT +                        the format used to tag the commit and read it, use it +                        in existing projects, wrap around simple quotes +  --bump-message BUMP_MESSAGE +                        template used to create the release commit, useful +                        when working with CI +  --prerelease {alpha,beta,rc}, -pr {alpha,beta,rc} +                        choose type of prerelease +  --devrelease DEVRELEASE, -d DEVRELEASE +                        specify non-negative integer for dev. release +  --increment {MAJOR,MINOR,PATCH} +                        manually specify the desired increment +  --increment-mode {linear,exact} +                        set the method by which the new version is chosen. +'linear'(default) guesses the next version based on +                        typical linear version progression, such that bumping +                        of a pre-release with lower precedence than the +                        current pre-release phase maintains the current phase +                        of higher precedence. 'exact' applies the changes that +                        have been specified (or determined from the commit +                        log) without interpretation, such that the increment +                        and pre-release are always honored +  --check-consistency, -cc +                        check consistency among versions defined in commitizen +                        configuration and version_files +  --annotated-tag, -at  create annotated tag instead of lightweight one +  --annotated-tag-message ANNOTATED_TAG_MESSAGE, -atm ANNOTATED_TAG_MESSAGE +                        create annotated tag message +  --gpg-sign, -s        sign tag instead of lightweight one +  --changelog-to-stdout +                        Output changelog to the stdout +  --git-output-to-stderr +                        Redirect git output to stderr +  --retry               retry commit if it fails the 1st time +  --major-version-zero  keep major version at zero, even for breaking changes +  --template TEMPLATE, -t TEMPLATE +                        changelog template file name (relative to the current +                        working directory) +  --extra EXTRA, -e EXTRA +                        a changelog extra variable (in the form 'key=value') +  --file-name FILE_NAME +                        file name of changelog (default: 'CHANGELOG.md') +  --prerelease-offset PRERELEASE_OFFSET +                        start pre-releases with this offset +  --version-scheme {semver2,pep440,semver} +                        choose version scheme +  --version-type {semver2,pep440,semver} +                        Deprecated, use --version-scheme +  --build-metadata BUILD_METADATA +                        Add additional build-metadata to the version-number + diff --git a/docs/images/cli_help/cz_changelog___help.svg b/docs/images/cli_help/cz_changelog___help.svg index a7d277df44..88f12bdbfa 100644 --- a/docs/images/cli_help/cz_changelog___help.svg +++ b/docs/images/cli_help/cz_changelog___help.svg @@ -19,144 +19,144 @@ font-weight: 700; } - .terminal-37245177-matrix { + .terminal-4187574521-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-37245177-title { + .terminal-4187574521-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-37245177-r1 { fill: #c5c8c6 } -.terminal-37245177-r2 { fill: #c5c8c6;font-weight: bold } -.terminal-37245177-r3 { fill: #68a0b3;font-weight: bold } -.terminal-37245177-r4 { fill: #98a84b } + .terminal-4187574521-r1 { fill: #c5c8c6 } +.terminal-4187574521-r2 { fill: #c5c8c6;font-weight: bold } +.terminal-4187574521-r3 { fill: #68a0b3;font-weight: bold } +.terminal-4187574521-r4 { fill: #98a84b } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -168,49 +168,49 @@ - + - - $ cz changelog --help -usage: cz changelog [-h][--dry-run][--file-name FILE_NAME] -[--unreleased-version UNRELEASED_VERSION][--incremental] -[--start-rev START_REV][--merge-prerelease] -[--version-scheme {semver,semver2,pep440}] -[--export-template EXPORT_TEMPLATE][--template TEMPLATE] -[--extra EXTRA] - - -positional arguments: -  rev_range             generates changelog for the given version (e.g: 1.5.3) -                        or version range (e.g: 1.5.3..1.7.9) - -options: -  -h, --help            show this help message and exit -  --dry-run             show changelog to stdout -  --file-name FILE_NAME -                        file name of changelog (default: 'CHANGELOG.md') -  --unreleased-version UNRELEASED_VERSION -                        set the value for the new version (use the tag value), -                        instead of using unreleased -  --incremental         generates changelog from last created version, useful -                        if the changelog has been manually modified -  --start-rev START_REV -                        start rev of the changelog. If not set, it will -                        generate changelog from the start -  --merge-prerelease    collect all changes from prereleases into next non- -                        prerelease. If not set, it will include prereleases in -                        the changelog -  --version-scheme {semver,semver2,pep440} -                        choose version scheme -  --export-template EXPORT_TEMPLATE -                        Export the changelog template into this file instead -                        of rendering it -  --template TEMPLATE, -t TEMPLATE -                        changelog template file name (relative to the current -                        working directory) -  --extra EXTRA, -e EXTRA -                        a changelog extra variable (in the form 'key=value') - + + $ cz changelog --help +usage: cz changelog [-h][--dry-run][--file-name FILE_NAME] +[--unreleased-version UNRELEASED_VERSION][--incremental] +[--start-rev START_REV][--merge-prerelease] +[--version-scheme {semver,pep440,semver2}] +[--export-template EXPORT_TEMPLATE][--template TEMPLATE] +[--extra EXTRA] + + +positional arguments: +  rev_range             generates changelog for the given version (e.g: 1.5.3) +                        or version range (e.g: 1.5.3..1.7.9) + +options: +  -h, --help            show this help message and exit +  --dry-run             show changelog to stdout +  --file-name FILE_NAME +                        file name of changelog (default: 'CHANGELOG.md') +  --unreleased-version UNRELEASED_VERSION +                        set the value for the new version (use the tag value), +                        instead of using unreleased +  --incremental         generates changelog from last created version, useful +                        if the changelog has been manually modified +  --start-rev START_REV +                        start rev of the changelog. If not set, it will +                        generate changelog from the start +  --merge-prerelease    collect all changes from prereleases into next non- +                        prerelease. If not set, it will include prereleases in +                        the changelog +  --version-scheme {semver,pep440,semver2} +                        choose version scheme +  --export-template EXPORT_TEMPLATE +                        Export the changelog template into this file instead +                        of rendering it +  --template TEMPLATE, -t TEMPLATE +                        changelog template file name (relative to the current +                        working directory) +  --extra EXTRA, -e EXTRA +                        a changelog extra variable (in the form 'key=value') + From a9f86bedec00d068481896584ee3d4d90ec92f9b Mon Sep 17 00:00:00 2001 From: Stefanie Molin <24376333+stefmolin@users.noreply.github.com> Date: Mon, 20 May 2024 11:06:30 -0400 Subject: [PATCH 07/13] style: add py.typed file --- commitizen/py.typed | 0 pyproject.toml | 4 ++++ 2 files changed, 4 insertions(+) create mode 100644 commitizen/py.typed diff --git a/commitizen/py.typed b/commitizen/py.typed new file mode 100644 index 0000000000..e69de29bb2 diff --git a/pyproject.toml b/pyproject.toml index beb7b87308..82d8fb197b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,10 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: Implementation :: CPython", ] +packages = [ + {include = "commitizen"}, + {include = "commitizen/py.typed"}, +] [tool.poetry.dependencies] python = ">=3.8" From 796a160bc4b0d07dfd26a1d200930ba93584e74c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 20 May 2024 18:27:27 +0000 Subject: [PATCH 08/13] docs(cli/screenshots): update CLI screenshots [skip ci] --- docs/images/cli_help/cz_changelog___help.svg | 176 +++++++++---------- 1 file changed, 88 insertions(+), 88 deletions(-) diff --git a/docs/images/cli_help/cz_changelog___help.svg b/docs/images/cli_help/cz_changelog___help.svg index 88f12bdbfa..32d9037665 100644 --- a/docs/images/cli_help/cz_changelog___help.svg +++ b/docs/images/cli_help/cz_changelog___help.svg @@ -19,144 +19,144 @@ font-weight: 700; } - .terminal-4187574521-matrix { + .terminal-4119023865-matrix { font-family: Fira Code, monospace; font-size: 20px; line-height: 24.4px; font-variant-east-asian: full-width; } - .terminal-4187574521-title { + .terminal-4119023865-title { font-size: 18px; font-weight: bold; font-family: arial; } - .terminal-4187574521-r1 { fill: #c5c8c6 } -.terminal-4187574521-r2 { fill: #c5c8c6;font-weight: bold } -.terminal-4187574521-r3 { fill: #68a0b3;font-weight: bold } -.terminal-4187574521-r4 { fill: #98a84b } + .terminal-4119023865-r1 { fill: #c5c8c6 } +.terminal-4119023865-r2 { fill: #c5c8c6;font-weight: bold } +.terminal-4119023865-r3 { fill: #68a0b3;font-weight: bold } +.terminal-4119023865-r4 { fill: #98a84b } - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -168,49 +168,49 @@ - + - - $ cz changelog --help -usage: cz changelog [-h][--dry-run][--file-name FILE_NAME] -[--unreleased-version UNRELEASED_VERSION][--incremental] -[--start-rev START_REV][--merge-prerelease] -[--version-scheme {semver,pep440,semver2}] -[--export-template EXPORT_TEMPLATE][--template TEMPLATE] -[--extra EXTRA] - - -positional arguments: -  rev_range             generates changelog for the given version (e.g: 1.5.3) -                        or version range (e.g: 1.5.3..1.7.9) - -options: -  -h, --help            show this help message and exit -  --dry-run             show changelog to stdout -  --file-name FILE_NAME -                        file name of changelog (default: 'CHANGELOG.md') -  --unreleased-version UNRELEASED_VERSION -                        set the value for the new version (use the tag value), -                        instead of using unreleased -  --incremental         generates changelog from last created version, useful -                        if the changelog has been manually modified -  --start-rev START_REV -                        start rev of the changelog. If not set, it will -                        generate changelog from the start -  --merge-prerelease    collect all changes from prereleases into next non- -                        prerelease. If not set, it will include prereleases in -                        the changelog -  --version-scheme {semver,pep440,semver2} -                        choose version scheme -  --export-template EXPORT_TEMPLATE -                        Export the changelog template into this file instead -                        of rendering it -  --template TEMPLATE, -t TEMPLATE -                        changelog template file name (relative to the current -                        working directory) -  --extra EXTRA, -e EXTRA -                        a changelog extra variable (in the form 'key=value') - + + $ cz changelog --help +usage: cz changelog [-h][--dry-run][--file-name FILE_NAME] +[--unreleased-version UNRELEASED_VERSION][--incremental] +[--start-rev START_REV][--merge-prerelease] +[--version-scheme {semver2,pep440,semver}] +[--export-template EXPORT_TEMPLATE][--template TEMPLATE] +[--extra EXTRA] + + +positional arguments: +  rev_range             generates changelog for the given version (e.g: 1.5.3) +                        or version range (e.g: 1.5.3..1.7.9) + +options: +  -h, --help            show this help message and exit +  --dry-run             show changelog to stdout +  --file-name FILE_NAME +                        file name of changelog (default: 'CHANGELOG.md') +  --unreleased-version UNRELEASED_VERSION +                        set the value for the new version (use the tag value), +                        instead of using unreleased +  --incremental         generates changelog from last created version, useful +                        if the changelog has been manually modified +  --start-rev START_REV +                        start rev of the changelog. If not set, it will +                        generate changelog from the start +  --merge-prerelease    collect all changes from prereleases into next non- +                        prerelease. If not set, it will include prereleases in +                        the changelog +  --version-scheme {semver2,pep440,semver} +                        choose version scheme +  --export-template EXPORT_TEMPLATE +                        Export the changelog template into this file instead +                        of rendering it +  --template TEMPLATE, -t TEMPLATE +                        changelog template file name (relative to the current +                        working directory) +  --extra EXTRA, -e EXTRA +                        a changelog extra variable (in the form 'key=value') + From bd4755fe39ee98b8c0b4e54683451ec22db05c46 Mon Sep 17 00:00:00 2001 From: Marcos Martins Date: Thu, 16 May 2024 15:37:33 -0300 Subject: [PATCH 09/13] fix(cli/commands): add description for subcommands --- commitizen/cli.py | 21 ++++- tests/commands/test_bump_command.py | 12 +++ ...shows_description_when_use_help_option.txt | 79 +++++++++++++++++++ tests/commands/test_changelog_command.py | 12 +++ ...shows_description_when_use_help_option.txt | 40 ++++++++++ tests/commands/test_check_command.py | 12 +++ ...shows_description_when_use_help_option.txt | 22 ++++++ tests/commands/test_commit_command.py | 15 +++- ...shows_description_when_use_help_option.txt | 20 +++++ tests/commands/test_example_command.py | 17 ++++ ...shows_description_when_use_help_option.txt | 6 ++ tests/commands/test_info_command.py | 17 ++++ ...shows_description_when_use_help_option.txt | 6 ++ tests/commands/test_init_command.py | 15 +++- ...shows_description_when_use_help_option.txt | 6 ++ tests/commands/test_ls_command.py | 17 ++++ ...shows_description_when_use_help_option.txt | 6 ++ tests/commands/test_schema_command.py | 17 ++++ ...shows_description_when_use_help_option.txt | 6 ++ tests/commands/test_version_command.py | 14 +++- ...shows_description_when_use_help_option.txt | 12 +++ 21 files changed, 368 insertions(+), 4 deletions(-) create mode 100644 tests/commands/test_bump_command/test_bump_command_shows_description_when_use_help_option.txt create mode 100644 tests/commands/test_changelog_command/test_changelog_command_shows_description_when_use_help_option.txt create mode 100644 tests/commands/test_check_command/test_check_command_shows_description_when_use_help_option.txt create mode 100644 tests/commands/test_commit_command/test_commit_command_shows_description_when_use_help_option.txt create mode 100644 tests/commands/test_example_command.py create mode 100644 tests/commands/test_example_command/test_example_command_shows_description_when_use_help_option.txt create mode 100644 tests/commands/test_info_command.py create mode 100644 tests/commands/test_info_command/test_info_command_shows_description_when_use_help_option.txt create mode 100644 tests/commands/test_init_command/test_init_command_shows_description_when_use_help_option.txt create mode 100644 tests/commands/test_ls_command.py create mode 100644 tests/commands/test_ls_command/test_ls_command_shows_description_when_use_help_option.txt create mode 100644 tests/commands/test_schema_command.py create mode 100644 tests/commands/test_schema_command/test_schema_command_shows_description_when_use_help_option.txt create mode 100644 tests/commands/test_version_command/test_version_command_shows_description_when_use_help_option.txt diff --git a/commitizen/cli.py b/commitizen/cli.py index 8b2d008e0e..1d1ebe1f68 100644 --- a/commitizen/cli.py +++ b/commitizen/cli.py @@ -114,11 +114,13 @@ def __call__( "commands": [ { "name": ["init"], + "description": "init commitizen configuration", "help": "init commitizen configuration", "func": commands.Init, }, { "name": ["commit", "c"], + "description": "create new commit", "help": "create new commit", "func": commands.Commit, "arguments": [ @@ -164,22 +166,31 @@ def __call__( }, { "name": "ls", + "description": "show available commitizens", "help": "show available commitizens", "func": commands.ListCz, }, { "name": "example", + "description": "show commit example", "help": "show commit example", "func": commands.Example, }, { "name": "info", + "description": "show information about the cz", "help": "show information about the cz", "func": commands.Info, }, - {"name": "schema", "help": "show commit schema", "func": commands.Schema}, + { + "name": "schema", + "description": "show commit schema", + "help": "show commit schema", + "func": commands.Schema, + }, { "name": "bump", + "description": "bump semantic version based on the git log", "help": "bump semantic version based on the git log", "func": commands.Bump, "arguments": [ @@ -346,6 +357,9 @@ def __call__( }, { "name": ["changelog", "ch"], + "description": ( + "generate changelog (note that it will overwrite existing file)" + ), "help": ( "generate changelog (note that it will overwrite existing file)" ), @@ -416,6 +430,7 @@ def __call__( }, { "name": ["check"], + "description": "validates that a commit message matches the commitizen schema", "help": "validates that a commit message matches the commitizen schema", "func": commands.Check, "arguments": [ @@ -455,6 +470,10 @@ def __call__( }, { "name": ["version"], + "description": ( + "get the version of the installed commitizen or the current project" + " (default: installed commitizen)" + ), "help": ( "get the version of the installed commitizen or the current project" " (default: installed commitizen)" diff --git a/tests/commands/test_bump_command.py b/tests/commands/test_bump_command.py index 84faf9ee82..ad7f4db64e 100644 --- a/tests/commands/test_bump_command.py +++ b/tests/commands/test_bump_command.py @@ -1449,3 +1449,15 @@ def test_bump_changelog_contains_increment_only(mocker, tmp_commitizen_project, assert "3.0.0" in out assert "2.0.0" not in out + + +def test_bump_command_shows_description_when_use_help_option( + mocker: MockFixture, capsys, file_regression +): + testargs = ["cz", "bump", "--help"] + mocker.patch.object(sys, "argv", testargs) + with pytest.raises(SystemExit): + cli.main() + + out, _ = capsys.readouterr() + file_regression.check(out, extension=".txt") diff --git a/tests/commands/test_bump_command/test_bump_command_shows_description_when_use_help_option.txt b/tests/commands/test_bump_command/test_bump_command_shows_description_when_use_help_option.txt new file mode 100644 index 0000000000..de76f2efcf --- /dev/null +++ b/tests/commands/test_bump_command/test_bump_command_shows_description_when_use_help_option.txt @@ -0,0 +1,79 @@ +usage: cz bump [-h] [--dry-run] [--files-only] [--local-version] [--changelog] + [--no-verify] [--yes] [--tag-format TAG_FORMAT] + [--bump-message BUMP_MESSAGE] [--prerelease {alpha,beta,rc}] + [--devrelease DEVRELEASE] [--increment {MAJOR,MINOR,PATCH}] + [--increment-mode {linear,exact}] [--check-consistency] + [--annotated-tag] + [--annotated-tag-message ANNOTATED_TAG_MESSAGE] [--gpg-sign] + [--changelog-to-stdout] [--git-output-to-stderr] [--retry] + [--major-version-zero] [--template TEMPLATE] [--extra EXTRA] + [--file-name FILE_NAME] [--prerelease-offset PRERELEASE_OFFSET] + [--version-scheme {pep440,semver,semver2}] + [--version-type {pep440,semver,semver2}] + [--build-metadata BUILD_METADATA] + [MANUAL_VERSION] + +bump semantic version based on the git log + +positional arguments: + MANUAL_VERSION bump to the given version (e.g: 1.5.3) + +options: + -h, --help show this help message and exit + --dry-run show output to stdout, no commit, no modified files + --files-only bump version in the files from the config + --local-version bump only the local version portion + --changelog, -ch generate the changelog for the newest version + --no-verify this option bypasses the pre-commit and commit-msg + hooks + --yes accept automatically questions done + --tag-format TAG_FORMAT + the format used to tag the commit and read it, use it + in existing projects, wrap around simple quotes + --bump-message BUMP_MESSAGE + template used to create the release commit, useful + when working with CI + --prerelease {alpha,beta,rc}, -pr {alpha,beta,rc} + choose type of prerelease + --devrelease DEVRELEASE, -d DEVRELEASE + specify non-negative integer for dev. release + --increment {MAJOR,MINOR,PATCH} + manually specify the desired increment + --increment-mode {linear,exact} + set the method by which the new version is chosen. + 'linear' (default) guesses the next version based on + typical linear version progression, such that bumping + of a pre-release with lower precedence than the + current pre-release phase maintains the current phase + of higher precedence. 'exact' applies the changes that + have been specified (or determined from the commit + log) without interpretation, such that the increment + and pre-release are always honored + --check-consistency, -cc + check consistency among versions defined in commitizen + configuration and version_files + --annotated-tag, -at create annotated tag instead of lightweight one + --annotated-tag-message ANNOTATED_TAG_MESSAGE, -atm ANNOTATED_TAG_MESSAGE + create annotated tag message + --gpg-sign, -s sign tag instead of lightweight one + --changelog-to-stdout + Output changelog to the stdout + --git-output-to-stderr + Redirect git output to stderr + --retry retry commit if it fails the 1st time + --major-version-zero keep major version at zero, even for breaking changes + --template TEMPLATE, -t TEMPLATE + changelog template file name (relative to the current + working directory) + --extra EXTRA, -e EXTRA + a changelog extra variable (in the form 'key=value') + --file-name FILE_NAME + file name of changelog (default: 'CHANGELOG.md') + --prerelease-offset PRERELEASE_OFFSET + start pre-releases with this offset + --version-scheme {pep440,semver,semver2} + choose version scheme + --version-type {pep440,semver,semver2} + Deprecated, use --version-scheme + --build-metadata BUILD_METADATA + Add additional build-metadata to the version-number diff --git a/tests/commands/test_changelog_command.py b/tests/commands/test_changelog_command.py index 4596724158..6f8919d71f 100644 --- a/tests/commands/test_changelog_command.py +++ b/tests/commands/test_changelog_command.py @@ -1637,3 +1637,15 @@ def test_export_changelog_template_from_plugin( assert target.exists() assert target.read_text() == tpl + + +def test_changelog_command_shows_description_when_use_help_option( + mocker: MockFixture, capsys, file_regression +): + testargs = ["cz", "changelog", "--help"] + mocker.patch.object(sys, "argv", testargs) + with pytest.raises(SystemExit): + cli.main() + + out, _ = capsys.readouterr() + file_regression.check(out, extension=".txt") diff --git a/tests/commands/test_changelog_command/test_changelog_command_shows_description_when_use_help_option.txt b/tests/commands/test_changelog_command/test_changelog_command_shows_description_when_use_help_option.txt new file mode 100644 index 0000000000..dae438ca24 --- /dev/null +++ b/tests/commands/test_changelog_command/test_changelog_command_shows_description_when_use_help_option.txt @@ -0,0 +1,40 @@ +usage: cz changelog [-h] [--dry-run] [--file-name FILE_NAME] + [--unreleased-version UNRELEASED_VERSION] [--incremental] + [--start-rev START_REV] [--merge-prerelease] + [--version-scheme {pep440,semver,semver2}] + [--export-template EXPORT_TEMPLATE] [--template TEMPLATE] + [--extra EXTRA] + [rev_range] + +generate changelog (note that it will overwrite existing file) + +positional arguments: + rev_range generates changelog for the given version (e.g: 1.5.3) + or version range (e.g: 1.5.3..1.7.9) + +options: + -h, --help show this help message and exit + --dry-run show changelog to stdout + --file-name FILE_NAME + file name of changelog (default: 'CHANGELOG.md') + --unreleased-version UNRELEASED_VERSION + set the value for the new version (use the tag value), + instead of using unreleased + --incremental generates changelog from last created version, useful + if the changelog has been manually modified + --start-rev START_REV + start rev of the changelog. If not set, it will + generate changelog from the start + --merge-prerelease collect all changes from prereleases into next non- + prerelease. If not set, it will include prereleases in + the changelog + --version-scheme {pep440,semver,semver2} + choose version scheme + --export-template EXPORT_TEMPLATE + Export the changelog template into this file instead + of rendering it + --template TEMPLATE, -t TEMPLATE + changelog template file name (relative to the current + working directory) + --extra EXTRA, -e EXTRA + a changelog extra variable (in the form 'key=value') diff --git a/tests/commands/test_check_command.py b/tests/commands/test_check_command.py index e328f8d346..bd65e75b7c 100644 --- a/tests/commands/test_check_command.py +++ b/tests/commands/test_check_command.py @@ -414,3 +414,15 @@ def test_check_conventional_commit_succeed_with_git_diff(mocker, capsys): cli.main() out, _ = capsys.readouterr() assert "Commit validation: successful!" in out + + +def test_check_command_shows_description_when_use_help_option( + mocker: MockFixture, capsys, file_regression +): + testargs = ["cz", "check", "--help"] + mocker.patch.object(sys, "argv", testargs) + with pytest.raises(SystemExit): + cli.main() + + out, _ = capsys.readouterr() + file_regression.check(out, extension=".txt") diff --git a/tests/commands/test_check_command/test_check_command_shows_description_when_use_help_option.txt b/tests/commands/test_check_command/test_check_command_shows_description_when_use_help_option.txt new file mode 100644 index 0000000000..56e42388dc --- /dev/null +++ b/tests/commands/test_check_command/test_check_command_shows_description_when_use_help_option.txt @@ -0,0 +1,22 @@ +usage: cz check [-h] + [--commit-msg-file COMMIT_MSG_FILE | --rev-range REV_RANGE | -m MESSAGE] + [--allow-abort] [--allowed-prefixes [ALLOWED_PREFIXES ...]] + +validates that a commit message matches the commitizen schema + +options: + -h, --help show this help message and exit + --commit-msg-file COMMIT_MSG_FILE + ask for the name of the temporal file that contains + the commit message. Using it in a git hook script: + MSG_FILE=$1 + --rev-range REV_RANGE + a range of git rev to check. e.g, master..HEAD + -m MESSAGE, --message MESSAGE + commit message that needs to be checked + --allow-abort allow empty commit messages, which typically abort a + commit + --allowed-prefixes [ALLOWED_PREFIXES ...] + allowed commit message prefixes. If the message starts + by one of these prefixes, the message won't be checked + against the regex diff --git a/tests/commands/test_commit_command.py b/tests/commands/test_commit_command.py index 0e0a12751a..da54e7b6eb 100644 --- a/tests/commands/test_commit_command.py +++ b/tests/commands/test_commit_command.py @@ -1,10 +1,11 @@ import os +import sys import pytest from pytest_mock import MockFixture from unittest.mock import ANY -from commitizen import cmd, commands +from commitizen import cli, cmd, commands from commitizen.cz.exceptions import CzException from commitizen.cz.utils import get_backup_file_path from commitizen.exceptions import ( @@ -406,3 +407,15 @@ def test_commit_command_with_message_length_limit(config, mocker: MockFixture): with pytest.raises(CommitMessageLengthExceededError): commands.Commit(config, {"message_length_limit": message_length - 1})() + + +def test_commit_command_shows_description_when_use_help_option( + mocker: MockFixture, capsys, file_regression +): + testargs = ["cz", "commit", "--help"] + mocker.patch.object(sys, "argv", testargs) + with pytest.raises(SystemExit): + cli.main() + + out, _ = capsys.readouterr() + file_regression.check(out, extension=".txt") diff --git a/tests/commands/test_commit_command/test_commit_command_shows_description_when_use_help_option.txt b/tests/commands/test_commit_command/test_commit_command_shows_description_when_use_help_option.txt new file mode 100644 index 0000000000..ebdb68446e --- /dev/null +++ b/tests/commands/test_commit_command/test_commit_command_shows_description_when_use_help_option.txt @@ -0,0 +1,20 @@ +usage: cz commit [-h] [--retry] [--no-retry] [--dry-run] + [--write-message-to-file FILE_PATH] [-s] [-a] + [-l MESSAGE_LENGTH_LIMIT] + +create new commit + +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 diff --git a/tests/commands/test_example_command.py b/tests/commands/test_example_command.py new file mode 100644 index 0000000000..43fdd96f5a --- /dev/null +++ b/tests/commands/test_example_command.py @@ -0,0 +1,17 @@ +import pytest +import sys +from commitizen import cli + +from pytest_mock import MockerFixture + + +def test_example_command_shows_description_when_use_help_option( + mocker: MockerFixture, capsys, file_regression +): + testargs = ["cz", "example", "--help"] + mocker.patch.object(sys, "argv", testargs) + with pytest.raises(SystemExit): + cli.main() + + out, _ = capsys.readouterr() + file_regression.check(out, extension=".txt") diff --git a/tests/commands/test_example_command/test_example_command_shows_description_when_use_help_option.txt b/tests/commands/test_example_command/test_example_command_shows_description_when_use_help_option.txt new file mode 100644 index 0000000000..b9bf7f84fc --- /dev/null +++ b/tests/commands/test_example_command/test_example_command_shows_description_when_use_help_option.txt @@ -0,0 +1,6 @@ +usage: cz example [-h] + +show commit example + +options: + -h, --help show this help message and exit diff --git a/tests/commands/test_info_command.py b/tests/commands/test_info_command.py new file mode 100644 index 0000000000..4a5f0d4f73 --- /dev/null +++ b/tests/commands/test_info_command.py @@ -0,0 +1,17 @@ +import pytest +import sys +from commitizen import cli + +from pytest_mock import MockerFixture + + +def test_info_command_shows_description_when_use_help_option( + mocker: MockerFixture, capsys, file_regression +): + testargs = ["cz", "info", "--help"] + mocker.patch.object(sys, "argv", testargs) + with pytest.raises(SystemExit): + cli.main() + + out, _ = capsys.readouterr() + file_regression.check(out, extension=".txt") diff --git a/tests/commands/test_info_command/test_info_command_shows_description_when_use_help_option.txt b/tests/commands/test_info_command/test_info_command_shows_description_when_use_help_option.txt new file mode 100644 index 0000000000..99b1ba8a4a --- /dev/null +++ b/tests/commands/test_info_command/test_info_command_shows_description_when_use_help_option.txt @@ -0,0 +1,6 @@ +usage: cz info [-h] + +show information about the cz + +options: + -h, --help show this help message and exit diff --git a/tests/commands/test_init_command.py b/tests/commands/test_init_command.py index 1814acb135..a3f8a8d739 100644 --- a/tests/commands/test_init_command.py +++ b/tests/commands/test_init_command.py @@ -2,13 +2,14 @@ import json import os +import sys from typing import Any import pytest import yaml from pytest_mock import MockFixture -from commitizen import commands +from commitizen import cli, commands from commitizen.__version__ import __version__ from commitizen.exceptions import InitFailedError, NoAnswersError @@ -251,3 +252,15 @@ def test_pre_commit_exec_failed( with tmpdir.as_cwd(): with pytest.raises(InitFailedError): commands.Init(config)() + + +def test_init_command_shows_description_when_use_help_option( + mocker: MockFixture, capsys, file_regression +): + testargs = ["cz", "init", "--help"] + mocker.patch.object(sys, "argv", testargs) + with pytest.raises(SystemExit): + cli.main() + + out, _ = capsys.readouterr() + file_regression.check(out, extension=".txt") diff --git a/tests/commands/test_init_command/test_init_command_shows_description_when_use_help_option.txt b/tests/commands/test_init_command/test_init_command_shows_description_when_use_help_option.txt new file mode 100644 index 0000000000..0f72042f88 --- /dev/null +++ b/tests/commands/test_init_command/test_init_command_shows_description_when_use_help_option.txt @@ -0,0 +1,6 @@ +usage: cz init [-h] + +init commitizen configuration + +options: + -h, --help show this help message and exit diff --git a/tests/commands/test_ls_command.py b/tests/commands/test_ls_command.py new file mode 100644 index 0000000000..7fc4620e22 --- /dev/null +++ b/tests/commands/test_ls_command.py @@ -0,0 +1,17 @@ +import pytest +import sys +from commitizen import cli + +from pytest_mock import MockerFixture + + +def test_ls_command_shows_description_when_use_help_option( + mocker: MockerFixture, capsys, file_regression +): + testargs = ["cz", "ls", "--help"] + mocker.patch.object(sys, "argv", testargs) + with pytest.raises(SystemExit): + cli.main() + + out, _ = capsys.readouterr() + file_regression.check(out, extension=".txt") diff --git a/tests/commands/test_ls_command/test_ls_command_shows_description_when_use_help_option.txt b/tests/commands/test_ls_command/test_ls_command_shows_description_when_use_help_option.txt new file mode 100644 index 0000000000..5fa8fe1f79 --- /dev/null +++ b/tests/commands/test_ls_command/test_ls_command_shows_description_when_use_help_option.txt @@ -0,0 +1,6 @@ +usage: cz ls [-h] + +show available commitizens + +options: + -h, --help show this help message and exit diff --git a/tests/commands/test_schema_command.py b/tests/commands/test_schema_command.py new file mode 100644 index 0000000000..13e6c319bb --- /dev/null +++ b/tests/commands/test_schema_command.py @@ -0,0 +1,17 @@ +import pytest +import sys +from commitizen import cli + +from pytest_mock import MockerFixture + + +def test_schema_command_shows_description_when_use_help_option( + mocker: MockerFixture, capsys, file_regression +): + testargs = ["cz", "schema", "--help"] + mocker.patch.object(sys, "argv", testargs) + with pytest.raises(SystemExit): + cli.main() + + out, _ = capsys.readouterr() + file_regression.check(out, extension=".txt") diff --git a/tests/commands/test_schema_command/test_schema_command_shows_description_when_use_help_option.txt b/tests/commands/test_schema_command/test_schema_command_shows_description_when_use_help_option.txt new file mode 100644 index 0000000000..6666db4d41 --- /dev/null +++ b/tests/commands/test_schema_command/test_schema_command_shows_description_when_use_help_option.txt @@ -0,0 +1,6 @@ +usage: cz schema [-h] + +show commit schema + +options: + -h, --help show this help message and exit diff --git a/tests/commands/test_version_command.py b/tests/commands/test_version_command.py index 3f9de50d00..0a6109311c 100644 --- a/tests/commands/test_version_command.py +++ b/tests/commands/test_version_command.py @@ -4,7 +4,7 @@ import pytest from pytest_mock import MockerFixture -from commitizen import commands +from commitizen import cli, commands from commitizen.__version__ import __version__ from commitizen.config.base_config import BaseConfig @@ -106,3 +106,15 @@ def test_version_use_version_provider( get_provider.assert_called_once() mock.get_version.assert_called_once() mock.set_version.assert_not_called() + + +def test_version_command_shows_description_when_use_help_option( + mocker: MockerFixture, capsys, file_regression +): + testargs = ["cz", "version", "--help"] + mocker.patch.object(sys, "argv", testargs) + with pytest.raises(SystemExit): + cli.main() + + out, _ = capsys.readouterr() + file_regression.check(out, extension=".txt") diff --git a/tests/commands/test_version_command/test_version_command_shows_description_when_use_help_option.txt b/tests/commands/test_version_command/test_version_command_shows_description_when_use_help_option.txt new file mode 100644 index 0000000000..c461b10bcd --- /dev/null +++ b/tests/commands/test_version_command/test_version_command_shows_description_when_use_help_option.txt @@ -0,0 +1,12 @@ +usage: cz version [-h] [-r | -p | -c | -v] + +get the version of the installed commitizen or the current project (default: +installed commitizen) + +options: + -h, --help show this help message and exit + -r, --report get system information for reporting bugs + -p, --project get the version of the current project + -c, --commitizen get the version of the installed commitizen + -v, --verbose get the version of both the installed commitizen and the + current project From 4a9f971c3d1f8cf5cc8dac7db1228c1b8d30d3d3 Mon Sep 17 00:00:00 2001 From: Marcos Martins Date: Thu, 16 May 2024 15:57:09 -0300 Subject: [PATCH 10/13] refactor(tests/commands): move "other" tests for the correspondent file --- tests/commands/test_example_command.py | 8 +++++++- tests/commands/test_info_command.py | 8 +++++++- tests/commands/test_ls_command.py | 8 +++++++- tests/commands/test_other_commands.py | 27 -------------------------- tests/commands/test_schema_command.py | 8 +++++++- 5 files changed, 28 insertions(+), 31 deletions(-) delete mode 100644 tests/commands/test_other_commands.py diff --git a/tests/commands/test_example_command.py b/tests/commands/test_example_command.py index 43fdd96f5a..93d9368f58 100644 --- a/tests/commands/test_example_command.py +++ b/tests/commands/test_example_command.py @@ -1,10 +1,16 @@ import pytest import sys -from commitizen import cli +from commitizen import cli, commands from pytest_mock import MockerFixture +def test_example(config, mocker: MockerFixture): + write_mock = mocker.patch("commitizen.out.write") + commands.Example(config)() + write_mock.assert_called_once() + + def test_example_command_shows_description_when_use_help_option( mocker: MockerFixture, capsys, file_regression ): diff --git a/tests/commands/test_info_command.py b/tests/commands/test_info_command.py index 4a5f0d4f73..b9c8e10d3b 100644 --- a/tests/commands/test_info_command.py +++ b/tests/commands/test_info_command.py @@ -1,10 +1,16 @@ import pytest import sys -from commitizen import cli +from commitizen import cli, commands from pytest_mock import MockerFixture +def test_info(config, mocker: MockerFixture): + write_mock = mocker.patch("commitizen.out.write") + commands.Info(config)() + write_mock.assert_called_once() + + def test_info_command_shows_description_when_use_help_option( mocker: MockerFixture, capsys, file_regression ): diff --git a/tests/commands/test_ls_command.py b/tests/commands/test_ls_command.py index 7fc4620e22..e2a311fc76 100644 --- a/tests/commands/test_ls_command.py +++ b/tests/commands/test_ls_command.py @@ -1,10 +1,16 @@ import pytest import sys -from commitizen import cli +from commitizen import cli, commands from pytest_mock import MockerFixture +def test_list_cz(config, mocker: MockerFixture): + write_mock = mocker.patch("commitizen.out.write") + commands.ListCz(config)() + write_mock.assert_called_once() + + def test_ls_command_shows_description_when_use_help_option( mocker: MockerFixture, capsys, file_regression ): diff --git a/tests/commands/test_other_commands.py b/tests/commands/test_other_commands.py deleted file mode 100644 index 3f7f855d54..0000000000 --- a/tests/commands/test_other_commands.py +++ /dev/null @@ -1,27 +0,0 @@ -from pytest_mock import MockFixture - -from commitizen import commands - - -def test_example(config, mocker: MockFixture): - write_mock = mocker.patch("commitizen.out.write") - commands.Example(config)() - write_mock.assert_called_once() - - -def test_info(config, mocker: MockFixture): - write_mock = mocker.patch("commitizen.out.write") - commands.Info(config)() - write_mock.assert_called_once() - - -def test_schema(config, mocker: MockFixture): - write_mock = mocker.patch("commitizen.out.write") - commands.Schema(config)() - write_mock.assert_called_once() - - -def test_list_cz(config, mocker: MockFixture): - write_mock = mocker.patch("commitizen.out.write") - commands.ListCz(config)() - write_mock.assert_called_once() diff --git a/tests/commands/test_schema_command.py b/tests/commands/test_schema_command.py index 13e6c319bb..fd0693dcfe 100644 --- a/tests/commands/test_schema_command.py +++ b/tests/commands/test_schema_command.py @@ -1,10 +1,16 @@ import pytest import sys -from commitizen import cli +from commitizen import cli, commands from pytest_mock import MockerFixture +def test_schema(config, mocker: MockerFixture): + write_mock = mocker.patch("commitizen.out.write") + commands.Schema(config)() + write_mock.assert_called_once() + + def test_schema_command_shows_description_when_use_help_option( mocker: MockerFixture, capsys, file_regression ): From 4636e50978d849e2fc971de536ba25f40de7267f Mon Sep 17 00:00:00 2001 From: Marcos Martins Date: Mon, 20 May 2024 15:09:18 -0300 Subject: [PATCH 11/13] refactor(KNOWN_SCHEMES): replace set comprehension for list comprehension Set is an unordered structure, so every call the order changes. Because the unordered behavior we can't use `file_regression` to test the command output. --- commitizen/version_schemes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commitizen/version_schemes.py b/commitizen/version_schemes.py index 596aa94b2e..26a19ec1b1 100644 --- a/commitizen/version_schemes.py +++ b/commitizen/version_schemes.py @@ -401,7 +401,7 @@ def __str__(self) -> str: SCHEMES_ENTRYPOINT = "commitizen.scheme" """Schemes entrypoints group""" -KNOWN_SCHEMES = {ep.name for ep in metadata.entry_points(group=SCHEMES_ENTRYPOINT)} +KNOWN_SCHEMES = [ep.name for ep in metadata.entry_points(group=SCHEMES_ENTRYPOINT)] """All known registered version schemes""" From 8f4dbe949af10798fbfd8ba42b4f8c6ae8ce99f0 Mon Sep 17 00:00:00 2001 From: Wei Lee Date: Mon, 20 May 2024 15:42:50 -0400 Subject: [PATCH 12/13] test(commands): add skip_if_below_py_3_10 as the message of argument changes in python 3.10 Optional arguments -> options --- tests/commands/test_bump_command.py | 3 ++- tests/commands/test_changelog_command.py | 2 ++ tests/commands/test_check_command.py | 3 ++- tests/commands/test_commit_command.py | 3 +++ tests/commands/test_example_command.py | 3 +++ tests/commands/test_info_command.py | 2 ++ tests/commands/test_init_command.py | 3 +++ tests/commands/test_ls_command.py | 3 +++ tests/commands/test_schema_command.py | 3 +++ tests/commands/test_version_command.py | 2 ++ tests/utils.py | 9 +++++++++ 11 files changed, 34 insertions(+), 2 deletions(-) diff --git a/tests/commands/test_bump_command.py b/tests/commands/test_bump_command.py index ad7f4db64e..b20f75169a 100644 --- a/tests/commands/test_bump_command.py +++ b/tests/commands/test_bump_command.py @@ -29,7 +29,7 @@ NoVersionSpecifiedError, ) from commitizen.changelog_formats import ChangelogFormat -from tests.utils import create_file_and_commit, create_tag +from tests.utils import create_file_and_commit, create_tag, skip_below_py_3_10 @pytest.mark.parametrize( @@ -1451,6 +1451,7 @@ def test_bump_changelog_contains_increment_only(mocker, tmp_commitizen_project, assert "2.0.0" not in out +@skip_below_py_3_10 def test_bump_command_shows_description_when_use_help_option( mocker: MockFixture, capsys, file_regression ): diff --git a/tests/commands/test_changelog_command.py b/tests/commands/test_changelog_command.py index 6f8919d71f..67f10a8ac0 100644 --- a/tests/commands/test_changelog_command.py +++ b/tests/commands/test_changelog_command.py @@ -31,6 +31,7 @@ merge_branch, switch_branch, wait_for_tag, + skip_below_py_3_10, ) @@ -1639,6 +1640,7 @@ def test_export_changelog_template_from_plugin( assert target.read_text() == tpl +@skip_below_py_3_10 def test_changelog_command_shows_description_when_use_help_option( mocker: MockFixture, capsys, file_regression ): diff --git a/tests/commands/test_check_command.py b/tests/commands/test_check_command.py index bd65e75b7c..47bdafd651 100644 --- a/tests/commands/test_check_command.py +++ b/tests/commands/test_check_command.py @@ -12,7 +12,7 @@ InvalidCommitMessageError, NoCommitsFoundError, ) -from tests.utils import create_file_and_commit +from tests.utils import create_file_and_commit, skip_below_py_3_10 COMMIT_LOG = [ "refactor: A code change that neither fixes a bug nor adds a feature", @@ -416,6 +416,7 @@ def test_check_conventional_commit_succeed_with_git_diff(mocker, capsys): assert "Commit validation: successful!" in out +@skip_below_py_3_10 def test_check_command_shows_description_when_use_help_option( mocker: MockFixture, capsys, file_regression ): diff --git a/tests/commands/test_commit_command.py b/tests/commands/test_commit_command.py index da54e7b6eb..2085278757 100644 --- a/tests/commands/test_commit_command.py +++ b/tests/commands/test_commit_command.py @@ -20,6 +20,8 @@ NothingToCommitError, ) +from tests.utils import skip_below_py_3_10 + @pytest.fixture def staging_is_clean(mocker: MockFixture, tmp_git_project): @@ -409,6 +411,7 @@ def test_commit_command_with_message_length_limit(config, mocker: MockFixture): commands.Commit(config, {"message_length_limit": message_length - 1})() +@skip_below_py_3_10 def test_commit_command_shows_description_when_use_help_option( mocker: MockFixture, capsys, file_regression ): diff --git a/tests/commands/test_example_command.py b/tests/commands/test_example_command.py index 93d9368f58..e0c2141453 100644 --- a/tests/commands/test_example_command.py +++ b/tests/commands/test_example_command.py @@ -4,6 +4,8 @@ from pytest_mock import MockerFixture +from tests.utils import skip_below_py_3_10 + def test_example(config, mocker: MockerFixture): write_mock = mocker.patch("commitizen.out.write") @@ -11,6 +13,7 @@ def test_example(config, mocker: MockerFixture): write_mock.assert_called_once() +@skip_below_py_3_10 def test_example_command_shows_description_when_use_help_option( mocker: MockerFixture, capsys, file_regression ): diff --git a/tests/commands/test_info_command.py b/tests/commands/test_info_command.py index b9c8e10d3b..6221630acc 100644 --- a/tests/commands/test_info_command.py +++ b/tests/commands/test_info_command.py @@ -3,6 +3,7 @@ from commitizen import cli, commands from pytest_mock import MockerFixture +from tests.utils import skip_below_py_3_10 def test_info(config, mocker: MockerFixture): @@ -11,6 +12,7 @@ def test_info(config, mocker: MockerFixture): write_mock.assert_called_once() +@skip_below_py_3_10 def test_info_command_shows_description_when_use_help_option( mocker: MockerFixture, capsys, file_regression ): diff --git a/tests/commands/test_init_command.py b/tests/commands/test_init_command.py index a3f8a8d739..a263e73a8e 100644 --- a/tests/commands/test_init_command.py +++ b/tests/commands/test_init_command.py @@ -13,6 +13,8 @@ from commitizen.__version__ import __version__ from commitizen.exceptions import InitFailedError, NoAnswersError +from tests.utils import skip_below_py_3_10 + class FakeQuestion: def __init__(self, expected_return): @@ -254,6 +256,7 @@ def test_pre_commit_exec_failed( commands.Init(config)() +@skip_below_py_3_10 def test_init_command_shows_description_when_use_help_option( mocker: MockFixture, capsys, file_regression ): diff --git a/tests/commands/test_ls_command.py b/tests/commands/test_ls_command.py index e2a311fc76..d783305fc0 100644 --- a/tests/commands/test_ls_command.py +++ b/tests/commands/test_ls_command.py @@ -4,6 +4,8 @@ from pytest_mock import MockerFixture +from tests.utils import skip_below_py_3_10 + def test_list_cz(config, mocker: MockerFixture): write_mock = mocker.patch("commitizen.out.write") @@ -11,6 +13,7 @@ def test_list_cz(config, mocker: MockerFixture): write_mock.assert_called_once() +@skip_below_py_3_10 def test_ls_command_shows_description_when_use_help_option( mocker: MockerFixture, capsys, file_regression ): diff --git a/tests/commands/test_schema_command.py b/tests/commands/test_schema_command.py index fd0693dcfe..f69638dba3 100644 --- a/tests/commands/test_schema_command.py +++ b/tests/commands/test_schema_command.py @@ -4,6 +4,8 @@ from pytest_mock import MockerFixture +from tests.utils import skip_below_py_3_10 + def test_schema(config, mocker: MockerFixture): write_mock = mocker.patch("commitizen.out.write") @@ -11,6 +13,7 @@ def test_schema(config, mocker: MockerFixture): write_mock.assert_called_once() +@skip_below_py_3_10 def test_schema_command_shows_description_when_use_help_option( mocker: MockerFixture, capsys, file_regression ): diff --git a/tests/commands/test_version_command.py b/tests/commands/test_version_command.py index 0a6109311c..f7d38c202d 100644 --- a/tests/commands/test_version_command.py +++ b/tests/commands/test_version_command.py @@ -7,6 +7,7 @@ from commitizen import cli, commands from commitizen.__version__ import __version__ from commitizen.config.base_config import BaseConfig +from tests.utils import skip_below_py_3_10 def test_version_for_showing_project_version(config, capsys): @@ -108,6 +109,7 @@ def test_version_use_version_provider( mock.set_version.assert_not_called() +@skip_below_py_3_10 def test_version_command_shows_description_when_use_help_option( mocker: MockerFixture, capsys, file_regression ): diff --git a/tests/utils.py b/tests/utils.py index 08d4414ba3..39fb0a17fa 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -2,12 +2,21 @@ import time import uuid +import sys from pathlib import Path + +import pytest from deprecated import deprecated from commitizen import cmd, exceptions, git +skip_below_py_3_10 = pytest.mark.skipif( + sys.version_info < (3, 10), + reason="The output meesage of argparse is different between Python 3.10 and lower than Python 3.10", +) + + class FakeCommand: def __init__(self, out=None, err=None, return_code=0): self.out = out From ae73429f38be340652319a0130f8b1d6aac29d4c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 22 May 2024 02:58:25 +0000 Subject: [PATCH 13/13] =?UTF-8?q?bump:=20version=203.26.0=20=E2=86=92=203.?= =?UTF-8?q?26.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .pre-commit-config.yaml | 2 +- CHANGELOG.md | 11 +++++++++++ commitizen/__version__.py | 2 +- pyproject.toml | 4 ++-- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 163e7a0ab3..f80bf93bb9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -47,7 +47,7 @@ repos: exclude: "poetry.lock" - repo: https://github.com/commitizen-tools/commitizen - rev: v3.26.0 # automatically updated by Commitizen + rev: v3.26.1 # automatically updated by Commitizen hooks: - id: commitizen - id: commitizen-branch diff --git a/CHANGELOG.md b/CHANGELOG.md index e99491f1cf..b851d3ab12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## v3.26.1 (2024-05-22) + +### Fix + +- **cli/commands**: add description for subcommands + +### Refactor + +- **KNOWN_SCHEMES**: replace set comprehension for list comprehension +- **tests/commands**: move "other" tests for the correspondent file + ## v3.26.0 (2024-05-18) ### Feat diff --git a/commitizen/__version__.py b/commitizen/__version__.py index 1e6bdc4260..2fb3eb449b 100644 --- a/commitizen/__version__.py +++ b/commitizen/__version__.py @@ -1 +1 @@ -__version__ = "3.26.0" +__version__ = "3.26.1" diff --git a/pyproject.toml b/pyproject.toml index 82d8fb197b..20d08b020f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.commitizen] -version = "3.26.0" +version = "3.26.1" tag_format = "v$version" version_files = [ "pyproject.toml:version", @@ -9,7 +9,7 @@ version_files = [ [tool.poetry] name = "commitizen" -version = "3.26.0" +version = "3.26.1" description = "Python commitizen client tool" authors = ["Santiago Fraire "] license = "MIT"