Skip to content

Conversation

@namwoam
Copy link

@namwoam namwoam commented Jan 31, 2026

Closes #1822

Description

This PR adds descriptions to the commit message rule selection step.

Checklist

Was generative AI tooling used to co-author this PR?

  • No

Code Changes

  • [] Add test cases to all the changes you introduce
  • [✅ ] Run uv run poe all locally to ensure this change passes linter check and tests
  • Manually test the changes:
    • [✅ ] Verify the feature/bug fix works as expected in real-world scenarios
    • [✅ ] Test edge cases and error conditions
    • Ensure backward compatibility is maintained
    • Document any manual testing steps performed
  • Update the documentation for the changes

Documentation Changes

  • Run uv run poe doc locally to ensure the documentation pages renders correctly
  • Check and fix any broken links (internal or external)

Expected Behavior

When selecting the commit rule at cz init, it should appear a description when selecting a commit rule.

Before:
Screenshot 2026-01-31 at 11 08 56 AM

After:
Screenshot 2026-01-31 at 12 50 58 PM

Additional Context

Issue: #1822

@codecov
Copy link

codecov bot commented Jan 31, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (next-release@0497ef2). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff               @@
##             next-release    #1825   +/-   ##
===============================================
  Coverage                ?   97.96%           
===============================================
  Files                   ?       60           
  Lines                   ?     2659           
  Branches                ?        0           
===============================================
  Hits                    ?     2605           
  Misses                  ?       54           
  Partials                ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@namwoam namwoam force-pushed the add-commit-rule-doc branch from 7b4c8d6 to aef0171 Compare January 31, 2026 05:01
return questionary.Choice(
title=cz_name, value=cz_name, description=f"{first_example}"
)
except Exception: # pylint: disable=broad-except
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick question: what are possible exceptions

the try: block should be as small as possible

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cz_obj = cz_class(self.config) could cause exception MissingCzCustomizeConfigError for cz_customize, fixed except statement

Copy link
Member

@Lee-W Lee-W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey, thanks for your contribution. This looks cool! would it be possible for us to add unit test here?

return Path(filename)

def _ask_name(self) -> str:
def construct_choice_with_description() -> list[questionary.Choice]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to make it a function inside _ask_name?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added unittest for construct_choice_with_description

@Lee-W Lee-W changed the base branch from master to next-release January 31, 2026 07:14
@Lee-W Lee-W merged commit bd02381 into commitizen-tools:next-release Jan 31, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add concise example when choosing a commit rule in cz init

3 participants