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

Add license check rule / Add PR tasks depending on a Jira issue type #297

Merged
merged 5 commits into from
Jan 9, 2025

Conversation

marko-bekhta
Copy link
Member

Here's another one 😃

It should address the license check #256
and also adds a simple check for PR tasks (depending on the Jira issue type), for that it reads the issue type for all Jira keys it finds in the commits, and if there are commits without Jira keys, it will generate a list of "generic" tasks.

Copy link
Member

@yrodiere yrodiere left a comment

Choose a reason for hiding this comment

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

Looking great, thanks :)
A few minor comments below.

README.md Outdated
enabled: true
# Optionally provide the pattern to use for extracting the license text from the `PULL_REQUEST_TEMPLATE.md`
# Keep in mind that the bot expects that the license text to check is matched by the 1st group:
pullRequestTemplatePattern: .+(---.+---).++
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
pullRequestTemplatePattern: .+(---.+---).++
pullRequestTemplatePattern: .+(---.+---).+

?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it probably doesn't make much sense in this example 😄
It was while I was looking into some Sonar reports I learned that adding that extra + after ?/*/+ makes them possessive, so that they "eat" the characters without giving them back 😃, which could help optimize some expressions.

Copy link
Member

Choose a reason for hiding this comment

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

You mean it prevents backtracking? Okay, I didn't know about that. Seems odd, but then... regexps :)

README.md Outdated
Comment on lines 63 to 65
genericTasks:
- task1
- task2
Copy link
Member

Choose a reason for hiding this comment

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

can this move under tasks.default?

checks.add( new LicenseCheck( matcher.group( 1 ).trim() ) );
}
else {
LOG.warn( "Misconfigured license agreement check. Pattern should contain exactly 1 match group. Fetched Pull Request template: " + pullRequestTemplate );
Copy link
Member

Choose a reason for hiding this comment

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

We won't notice warnings in OpenShift logs.
I'd fail completely, e.g. throw an exception, which I think is caught by calling code and reported in the GitHub check.

README.md Outdated
### License agreement check

The bot can be configured to check that the pull request body includes the license agreement text from the template.
To enable the check, add the following to the repository configuration:
Copy link
Member

Choose a reason for hiding this comment

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

Maybe configuration needs to move to... the "Configuration" section? at least that's what we did for other categories.

Alternatively, I don't mind keeping your new format, but we should probably adapt pre-existing documentation to be consistent.

@marko-bekhta marko-bekhta force-pushed the add-license-check-rule branch from 4eb260f to 159531e Compare January 3, 2025 14:18
@marko-bekhta marko-bekhta merged commit aba04af into hibernate:main Jan 9, 2025
2 checks passed
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