-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add license check rule / Add PR tasks depending on a Jira issue type #297
Conversation
There was a problem hiding this 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: .+(---.+---).++ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pullRequestTemplatePattern: .+(---.+---).++ | |
pullRequestTemplatePattern: .+(---.+---).+ |
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
genericTasks: | ||
- task1 | ||
- task2 |
There was a problem hiding this comment.
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 ); |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
to let the test pass without replying on .env file containing these properties
4eb260f
to
159531e
Compare
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.