Skip to content

feat(parser-angular): add scope filtering option to Angular commit pa… #1216

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

Closed
wants to merge 1 commit into from

Conversation

asaf
Copy link

@asaf asaf commented Mar 14, 2025

Fix: Ensure Scope Filtering is Enforced Correctly

Resolves #1215


Purpose

This PR ensures that scope filtering logic is correctly applied when allowed_scopes is configured in ConventionalCommitParserOptions. Previously, commits without a scope were incorrectly bypassing the filtering, and commits with no allowed scopes defined were still being evaluated unnecessarily.


Rationale

  1. If allowed_scopes is not defined, the filtering logic should be skipped entirely to maintain the existing behavior.
  2. If allowed_scopes is defined, the commit must have a valid scope that is explicitly allowed.
  3. If a commit has no scope, it should not be allowed when allowed_scopes is configured.

This change ensures a strict enforcement of scope filtering while keeping backwards compatibility when allowed_scopes is not set.


How did you test?

  • Added unit tests to verify:

    • Commits with allowed scopes pass the filter.
    • Commits with disallowed scopes are correctly rejected.
    • Commits without a scope are rejected when allowed_scopes is enabled.
    • Commits without an allowed_scopes definition behave as they currently do.
  • Ran the test suite and verified that existing functionality remains unchanged for users who do not configure scope filtering.


How to Verify

  1. Run pytest to ensure all tests pass.
  2. Use the ConventionalCommitParser with different configurations:
    • No allowed_scopes: Behavior remains unchanged.
    • allowed_scopes defined: Only commits with matching scopes should be allowed.
    • Commit with no scope: Should be rejected when allowed_scopes is defined.

PR Completion Checklist

  • Reviewed & followed the Contributor Guidelines
  • Changes Implemented & Validation pipeline succeeds
  • Commits follow the Conventional Commits standard
    and are separated into the proper commit type and scope (recommended order: test, build, feat/fix, docs)
  • Appropriate Unit tests added/updated
  • Appropriate End-to-End tests added/updated
  • Appropriate Documentation added/updated and syntax validated for sphinx build (see Contributor Guidelines)

@codejedi365
Copy link
Contributor

codejedi365 commented Mar 14, 2025

This is already solved in #1143, but thank you for putting in the time to provide a solution.

@asaf
Copy link
Author

asaf commented Mar 15, 2025

Closing in favor of the monorepo parser introduced in #1143

@asaf asaf closed this Mar 15, 2025
@asaf asaf deleted the feat/issue1215 branch March 15, 2025 21:54
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.

Improve support for monorepo using Conventional Commits scope
2 participants