Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: filter footers #569

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jan-ferdinand
Copy link

Description

Enable footer-based commit parsing. The idea is to add functionality like

commit_parsers = [
  { footer = "Hello: world", skip = true },
]

I would appreciate some guidance – is this useful, desired, worth it, …?

Motivation and Context

In order to keep my changelogs concise, I would like to ignore certain commits. I would like to specify whether a commit should be ignored in the commit message. A somewhat elegant way to achieve this (I think) would be to include a footer like changelog: ignore.
(If you have a better way to approach this, I'm happy to learn of it.)

How Has This Been Tested?

Append existing tests that create sample changelogs.

The test changelog_generator_split_commits is failing. It appears that a footer's value (but not the key) makes its way into the changelog. This might be because the footer's key is interpreted as a conventional commit type. I would appreciate some guidance here.

Possible Limitations

The conventional commits' specification and the reference implementation of its parser are currently out of sync. This might mean that the commit parser {footer = "Hello: world"} does not work (even though it should), whereas the commit parser {footer = "Hello:world"} does work (even though omitting the space goes against the specification).

Some relevant issues concerning footer parsing are:

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (no code change)
  • Refactor (refactoring production code)
  • Other

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have formatted the code with rustfmt.
  • I checked the lints with clippy.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link

welcome bot commented Mar 22, 2024

Thanks for opening this pull request! Please check out our contributing guidelines! ⛰️

@orhun
Copy link
Owner

orhun commented Mar 23, 2024

Thanks for the PR!

I would appreciate some guidance – is this useful, desired, worth it, …?
A somewhat elegant way to achieve this (I think) would be to include a footer like changelog: ignore.

I'm wondering if the same can be achieved with body which git-cliff already supports filtering.

I'm also wondering if this is useful for #382. But I'm guessing "This commit reverts" is not a part of the footer.

The test changelog_generator_split_commits is failing. It appears that a footer's value (but not the key) makes its way into the changelog. This might be because the footer's key is interpreted as a conventional commit type. I would appreciate some guidance here.

That is the expected behavior so I recommend you to either add a new CommitParser to changelog_generator_split_commits to skip that commit or update the expected result accordingly to include that commit in the changelog.

Overall, I think this might be useful. Can you update the documentation about the existence of footer filter and also add a test fixture to verify it's behavior?

@orhun
Copy link
Owner

orhun commented Apr 10, 2024

ping @jan-ferdinand 🙂

@jan-ferdinand
Copy link
Author

Other things have come up and are more pressing right now; I'll come back to this. Apologies if that creates inconveniencies.

@orhun
Copy link
Owner

orhun commented Apr 16, 2024

No worries!

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

Successfully merging this pull request may close these issues.

None yet

2 participants