Skip to content

Commit

Permalink
[MINOR] Add PR description validation on documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
yihua committed Mar 3, 2024
1 parent eeccdf9 commit 1982318
Showing 1 changed file with 29 additions and 9 deletions.
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_",
"- _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_",
"- _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

0 comments on commit 1982318

Please sign in to comment.