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

[MINOR] Add PR description validation on documentation updates #10799

Merged
merged 3 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ _If medium or high, explain what verification was done to mitigate the risks._

### Documentation Update

_Describe any necessary documentation update if there is any new feature, config, or user-facing change_
_Describe any necessary documentation update if there is any new feature, config, or user-facing change. If not, put "none"._

- _The config description must be updated if new configs are added or the default value of the configs are changed_
- _Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
Expand Down
38 changes: 29 additions & 9 deletions scripts/pr_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,21 +389,29 @@ def validate(self):
#Generate the validator for the current template.
#needs to be manually updated
def make_default_validator(body, debug=False):
changelogs = ParseSectionData("CHANGELOGS",
changelogs = ParseSectionData("CHANGE_LOGS",
"### Change Logs",
{"_Describe context and summary for this change. Highlight if any code was copied._"})
impact = ParseSectionData("IMPACT",
"### Impact",
{"_Describe any public API or user-facing feature change or any performance impact._"})
risklevel = RiskLevelData("RISKLEVEL",
risklevel = RiskLevelData("RISK_LEVEL",
"### Risk level",
{"_If medium or high, explain what verification was done to mitigate the risks._"})
docsUpdate = ParseSectionData("DOCUMENTATION_UPDATE",
"### Documentation Update",
{"_Describe any necessary documentation update if there is any new feature, config, or user-facing change_",
"",
"- _The config description must be updated if new configs are added or the default value of the configs are changed. If not, put \"none\"._",
"- _Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the",
" ticket number here and follow the [instruction](https://hudi.apache.org/contribute/developer-setup#website) to make",
" changes to the website._"})
checklist = ParseSectionData("CHECKLIST",
"### Contributor's checklist",
{})
parseSections = ParseSections([changelogs, impact, risklevel, checklist])
parseSections = ParseSections([changelogs, impact, risklevel, docsUpdate, checklist])

return ValidateBody(body, "CHANGELOGS", parseSections, debug)
return ValidateBody(body, "CHANGE_LOGS", parseSections, debug)


#takes a list of strings and returns a string of those lines separated by \n
Expand Down Expand Up @@ -466,6 +474,21 @@ def test_body():
good_risklevel = template_risklevel.copy()
good_risklevel[1] = "none"

template_docs_update = [
"### Documentation Update",
"",
"_Describe any necessary documentation update if there is any new feature, config, or user-facing change_",
"",
"- _The config description must be updated if new configs are added or the default value of the configs are changed. If not, put \"none\"._",
"- _Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the",
" ticket number here and follow the [instruction](https://hudi.apache.org/contribute/developer-setup#website) to make",
" changes to the website._",
""
]

good_docs_update = template_docs_update.copy()
good_docs_update[1] = "update docs"

template_checklist = [
"### Contributor's checklist",
"",
Expand All @@ -476,10 +499,10 @@ def test_body():
]

#list of sections that when combined form a valid body
good_sections = [good_changelogs, good_impact, good_risklevel, template_checklist]
good_sections = [good_changelogs, good_impact, good_risklevel, good_docs_update, template_checklist]

#list of sections that when combined form the template
template_sections = [template_changelogs, template_impact, template_risklevel, template_checklist]
template_sections = [template_changelogs, template_impact, template_risklevel, template_docs_update, template_checklist]

tests_passed = True
#Test section not filled out
Expand Down Expand Up @@ -532,9 +555,6 @@ def test_body():
return tests_passed





if __name__ == '__main__':
if len(sys.argv) > 1:
title_tests = test_title()
Expand Down
Loading