Skip to content

Commit fd821ec

Browse files
committed
fixup! fixup! fixup! fixup! fixup! ci: make clang-format check mandatory in CI
1 parent 811bb06 commit fd821ec

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

SilKit/ci/check_formatting.py

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,33 @@ def get_pr_files(pr: str, repo: str):
4141

4242
log("Checking at {}".format(url))
4343

44-
r = requests.get(url, verify=False)
45-
44+
r = requests.get(url)
45+
46+
max_page = 1
47+
if 'link' in r.headers:
48+
last_page_link_header = r.headers["link"].split(',')[-1].split(';')[0]
49+
page_reg = re.compile('.+page=([0-9]+)>')
50+
page = re.match(page_reg, last_page_link_header).group(1)
51+
52+
if page.isnumeric():
53+
max_page = int(page)
54+
4655
files = []
4756
for fileObject in r.json():
48-
57+
4958
files.append(fileObject["filename"])
5059

60+
if max_page > 1:
61+
print(f"Need to check {max_page} pages")
62+
for page in range(2, max_page+1):
63+
page_url = url + f'?page={page}'
64+
r = requests.get(page_url)
65+
for fileObject in r.json():
66+
files.append(fileObject["filename"])
67+
68+
print(f"Found {len(files)} files")
69+
return files
70+
5171
def main():
5272
if which(CLANG_FORMAT) is None:
5373
warn("No {} found!", CLANG_FORMAT)
@@ -108,7 +128,6 @@ def main():
108128

109129
if any(p in file for p in dirs):
110130

111-
print(f"Checking file: {file}")
112131
totalFiles = totalFiles + 1
113132
formatResult = subprocess.run([CLANG_FORMAT, '--Werror', dryrun, '-i', '--style=file', file], capture_output=True, encoding='utf-8')
114133
if formatResult.returncode != 0:

0 commit comments

Comments
 (0)