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

Commit Message Parser #42

Merged
merged 3 commits into from
Sep 20, 2024
Merged

Commit Message Parser #42

merged 3 commits into from
Sep 20, 2024

Conversation

mariugul
Copy link
Owner

@mariugul mariugul commented Sep 20, 2024

Commit Message Parser

Overview

This PR implements a commit message parser that extracts the summary, body, and footer from messages adhering to common conventions. It handles various edge cases, including messages with random whitespace and multiple footers.

Key Features

Parser Functionality: The parse_commit_message function identifies:

Summary: First line of the message.
Body: Content following the summary.
Footer: Lines that match footer patterns (e.g., "BREAKING CHANGE").
Edge Case Handling: Gracefully manages empty messages, single-line messages, and body content containing footer-like text.

Regular Expressions: Uses regex to accurately identify footer lines.

Testing

Comprehensive unit tests cover a range of scenarios, ensuring reliable functionality across different commit message formats.

Conclusion

This parser improves commit message management, enforcing conventions and enhancing commit quality. Feedback and suggestions are welcome!

Commit message parsed into 3 parts,
summary line, body and footer.
Wrote exhaustive tests for commit parsing.
@mariugul mariugul self-assigned this Sep 20, 2024
@mariugul mariugul linked an issue Sep 20, 2024 that may be closed by this pull request
@mariugul mariugul merged commit 7db61cb into main Sep 20, 2024
3 checks passed
@mariugul mariugul deleted the feat/commit-msg-parser branch September 20, 2024 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Add Git Commit Message Parser
1 participant