Skip to content

Add --composite-rules flag to annotate multi license rules with required phrases#5118

Open
Kaushik-Kumar-CEG wants to merge 2 commits into
aboutcode-org:developfrom
Kaushik-Kumar-CEG:gsoc/annotate-composite-rules
Open

Add --composite-rules flag to annotate multi license rules with required phrases#5118
Kaushik-Kumar-CEG wants to merge 2 commits into
aboutcode-org:developfrom
Kaushik-Kumar-CEG:gsoc/annotate-composite-rules

Conversation

@Kaushik-Kumar-CEG

@Kaushik-Kumar-CEG Kaushik-Kumar-CEG commented Jun 5, 2026

Copy link
Copy Markdown

references #5077

Adds --composite-rules (-c) flag to the add-required-phrases CLI command.

For composite (AND/OR) rules, parses the expression into individual license keys, builds a per-key mapping of candidate phrases from license attributes (name, short_name, spdx_license_key) and is_required_phrase rules, then marks the rule only if ALL keys have at least one matching phrase in the text.

Uses existing infrastructure: find_phrase_spans_in_text for token-based matching, add_required_phrase_to_rule for safe injection with overlap/ignorable checks, get_updatable_rules_by_expression for rule filtering.

Usage:

add-required-phrases --composite-rules --dry-run --verbose

Results: 1071 composite rules annotated in dry-run.

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled and links the original issue above
  • Tests pass
  • Commits are in uniquely-named feature branch and has no merge conflicts

@Kaushik-Kumar-CEG

Copy link
Copy Markdown
Author

@AyanSinhaMahapatra ready for review when you have a moment

@Kaushik-Kumar-CEG Kaushik-Kumar-CEG force-pushed the gsoc/annotate-composite-rules branch from baa56a6 to 59026a3 Compare June 20, 2026 20:52
@Kaushik-Kumar-CEG Kaushik-Kumar-CEG changed the title Add script to annotate composite license rules with required phrases Add --composite-rules flag to annotate multi license rules with required phrases Jun 20, 2026
@Kaushik-Kumar-CEG

Copy link
Copy Markdown
Author

@AyanSinhaMahapatra please review when you have a moment :)

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.

1 participant