Skip to content

License test updates + exposing the matched position #1462

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

Merged
merged 11 commits into from
Aug 15, 2025

Conversation

isoos
Copy link
Collaborator

@isoos isoos commented Jul 22, 2025

This PR is a preparation to update/improve the license-detection, and to eventually expose the detected license parts on the UI.

Part of #1015 and dart-lang/pub-dev#5359

I am not sure yet if this positioning is enough for the UI, e.g. we could have multiple coverage segments that would show which words were matched in the license text, and which may have been added to it, let's discuss that later (added a warning note of the fields and the class being experimental).

///
/// WARNING: this class is experimental, do not rely on it.
@JsonSerializable()
class Position {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, but would it make sense to make the class represent a range instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would that require: startOffset, endOffset, startLine, endLine, startColumn, endColumn?
Maybe we could have a Range class with Position start and Position end, both required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the code with Range (with start and stop). PTAL.

Note: maybe this is an overkill here, but we could also emit a diff format: while marking the recognized range, we could highlight added words and also identify removed words too. Just in case the license was modified in a non-trivial way.

@isoos isoos merged commit 9c8841a into dart-lang:master Aug 15, 2025
4 of 5 checks passed
@isoos isoos deleted the license branch August 15, 2025 12:20
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.

2 participants