Skip to content

Commit

Permalink
Merge pull request #594 from aireilly/fix-check-ssg-coverage-script
Browse files Browse the repository at this point in the history
fix coverage script
  • Loading branch information
aireilly authored Jul 28, 2023
2 parents 24ed372 + c43951f commit 663823d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions tools/ssg_utils/check_ssg_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ def main():
get_vale_rule_terms(temp_dir, rules_dir)

#get the current vale rules test fixture terms
get_vale_fixture_terms(temp_dir, fixtures_dir)
get_vale_fixture_terms(temp_dir, fixtures_dir)

#check for new SSG entries that are potentially not included in the vale rules
check_new_ssg_entries(temp_dir, rules_dir, git_root)

#remove the temp folder
#remove the temp folder
clean_up(temp_dir)

if __name__ == "__main__":
Expand Down
14 changes: 9 additions & 5 deletions tools/ssg_utils/missing_ssg_terms.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
[
"client: customer",
"collect: gather",
"guest: guest operating system",
"package: packet",
"product: Product"
"Ansible playbook: Ansible Playbook",
"code base: codebase",
"Elastic Load Balancer: Elastic Load Balancing",
"title bar: header bar",
"pSeries|System P|Power Systems: IBM Power\u00ae",
"IBM LinuxONE|LinuxONE|linuxone: IBM\u00ae LinuxONE",
"IBM zSystems|Z|S 390: IBM Z\u00ae",
"quickstart|Quickstart: quick start",
"SoftIRQ: softirq"
]
3 changes: 2 additions & 1 deletion tools/ssg_utils/ssg_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def get_ssg_terms(temp_dir):
with open(file, 'r+', encoding='utf-8') as w:
data = w.read()
#fix this! this regex is very brittle
data = re.findall(r'\[\[(.*)\]\]\n(====) (.*)\n\*Description\*: (.*)\n.*\n*.*\n*.*\n*\*Use it\*: yes\n\n\*Incorrect forms\*: (.*)', data)
data = re.findall(r'\[\[(.*)\]\]\n(====) (.*)\n\*Description\*:.*\n(.*\n){1,10}\*Use it\*: yes\n\n\*Incorrect forms\*: (.+)', data)
for word_usage in data:
#set up the term dict
ssg_term_dict = {}
Expand All @@ -96,6 +96,7 @@ def get_ssg_terms(temp_dir):
incorrect_forms = re.sub(r'image:images\/yes\.png\[yes\] ', '', incorrect_forms)
incorrect_forms = re.sub(r'image:images\/no\.png\[no\] ', '', incorrect_forms)
correct_form = re.sub(r'image:images\/yes\.png\[yes\] ', '', correct_form)
correct_form = re.sub(r'image:images\/caution\.png\[with caution\] ', '', correct_form)
correct_form = re.sub(r' \((noun|verb|adjective|adverb|preposition)\)', '', correct_form)
correct_form = re.sub(r'image:images\/no\.png\[no\] ', '', correct_form)
#clean out other items
Expand Down

0 comments on commit 663823d

Please sign in to comment.