Skip to content

feat: filter search for commit change type #1381

New issue

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

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

Already on GitHub? Sign in to your account

Conversation

Yusin0903
Copy link
Contributor

@Yusin0903 Yusin0903 commented Apr 5, 2025

Description

Added search filter functionality to commit type selection in Conventional Commits. This allows users to quickly find commit types by typing part of the type name or description, enhancing user experience especially when working with many commit types.

Changes Made

  1. Added use_search_filter: True to enable search filtering in the commit type selection.
  2. Set use_jk_keys: False to prevent conflicts with search functionality (as j/k keys can be part of the search term).
  3. Because the interaction questionary can not test directly so I test to verify search filter functionality and parameter works correctly.
  4. Added newline at the end of file to comply with PEP 8 standards.

Checklist

  • Add test cases to all the changes you introduce
  • Run poetry all locally to ensure this change passes linter check and test
  • Test the changes on the local machine manually
  • Update the documentation for the changes

Expected behavior

When a user types characters during commit type selection, the list of options is filtered to show only those containing the typed characters. For example, typing "fix" will show the item that contains "fix" .

Steps to Test This Pull Request

  1. Run cz commit to start the commit process
  2. When the commit type selection appears, type what you want to search. eg: "fix"
  3. Verify that the list filters to show the all "fix" items
  4. Try other search terms to confirm filtering works as expected

Additional context

@Yusin0903 Yusin0903 changed the title Feat filter search for commit change type feat: filter search for commit change type Apr 5, 2025
@Lee-W Lee-W force-pushed the feat-filter-search-for-commit-change-type branch from 4dd1521 to 5c52c3d Compare April 6, 2025 04:07
Copy link

codecov bot commented Apr 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.55%. Comparing base (120d514) to head (a8d3bd6).
Report is 595 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1381      +/-   ##
==========================================
+ Coverage   97.33%   97.55%   +0.21%     
==========================================
  Files          42       57      +15     
  Lines        2104     2656     +552     
==========================================
+ Hits         2048     2591     +543     
- Misses         56       65       +9     
Flag Coverage Δ
unittests 97.55% <ø> (+0.21%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Yusin0903
Copy link
Contributor Author

Yusin0903 commented Apr 10, 2025

Hi @Lee-W,

I have tested the search filter functionality using the configuration approach:

[[tool.commitizen.customize.questions]]
type = "list"
name = "change_type"
message = "Select the type of change you are committing"
use_search_filter = true
use_jk_keys = false

It works as expected, so I've:

  • Removed the modifications to conventional_commits.py
  • Added documentation for the feature in customization.md
  • Added test cases to verify the functionality
    The search filter can now be enabled through configuration without modifying the core code.

@Lee-W
Copy link
Member

Lee-W commented Apr 13, 2025

Hey @Yusin0903 , just noticed the CI is failing. Could you please take a look? Thanks 🙂

@woile
Copy link
Member

woile commented Apr 14, 2025

We could also deprecate cz_customize, and just use [tool.commitizen.customize] to override the existining cz based on the name. Example: if you have set cz_conventional_commits, then anything in tool.commitizen.customize would override cz_conventional_commits

@Lee-W
Copy link
Member

Lee-W commented Apr 15, 2025

We could also deprecate cz_customize, and just use [tool.commitizen.customize] to override the existining cz based on the name. Example: if you have set cz_conventional_commits, then anything in tool.commitizen.customize would override cz_conventional_commits

Yep, this is a fantastic idea!

@Lee-W Lee-W mentioned this pull request Apr 15, 2025
@Yusin0903 Yusin0903 force-pushed the feat-filter-search-for-commit-change-type branch from 2489e23 to c0b1e05 Compare April 15, 2025 09:21
@Lee-W Lee-W force-pushed the feat-filter-search-for-commit-change-type branch from c0b1e05 to a4f8c20 Compare May 6, 2025 02:41
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.

I'm good with this change. We probably want to plan the cz_customize deprecation more thoroughly

@Lee-W Lee-W merged commit 5be2847 into commitizen-tools:master May 7, 2025
18 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.

3 participants