Lists the rules and recommendation files for one part of the standard.
(content_subdir:str)
| 927 | _cert_tree = None |
| 928 | |
| 929 | def listCertFiles(content_subdir:str): |
| 930 | """Lists the rules and recommendation files for one part of the standard.""" |
| 931 | global _cert_tree |
| 932 | if _cert_tree is None: |
| 933 | url = 'https://api.github.com/repos/%s/git/trees/%s?recursive=1' % (CERT_REPO, CERT_BRANCH) |
| 934 | _cert_tree = requests.get(url, timeout=50).json()['tree'] |
| 935 | prefix = 'content/' + content_subdir |
| 936 | files = [] |
| 937 | for entry in _cert_tree: |
| 938 | path = entry['path'] |
| 939 | if entry['type'] != 'blob' or not path.startswith(prefix) or not path.endswith('.md'): |
| 940 | continue |
| 941 | if 'index' in path.rsplit('/', 1)[-1].lower(): |
| 942 | continue |
| 943 | files.append(path) |
| 944 | return sorted(files) |
| 945 | |
| 946 | def printCertCInfo(content_subdir:str): |
| 947 | """Fetches CERT C rules information.""" |