mirror of
https://github.com/Xeeynamo/sotn-decomp.git
synced 2024-11-23 04:59:41 +00:00
Add duplicate match info to function report (#1690)
This can be merged after #1689 which fixes some things with the CI workflows
This commit is contained in:
parent
f86e111fc5
commit
efcf8d4d20
11
.github/workflows/validate-and-report.yml
vendored
11
.github/workflows/validate-and-report.yml
vendored
@ -191,6 +191,11 @@ jobs:
|
||||
make force_extract
|
||||
.venv/bin/python3 tools/analyze_calls.py
|
||||
git clean -fdx asm/
|
||||
- name: Generate duplicates report
|
||||
run: |
|
||||
make force_symbols
|
||||
cd tools/dups
|
||||
cargo run --release -- --threshold .90 --output-file ../../gh-duplicates/duplicates.txt
|
||||
- name: Generate function report
|
||||
run: |
|
||||
git checkout config/
|
||||
@ -201,12 +206,6 @@ jobs:
|
||||
rm -rf gh-duplicates/function_calls/ || true
|
||||
mv function_calls gh-duplicates/
|
||||
mv function_graphs.md gh-duplicates
|
||||
- name: Generate duplicates report
|
||||
run: |
|
||||
make force_symbols
|
||||
make force_extract
|
||||
cd tools/dups
|
||||
cargo run --release -- --threshold .90 --output-file ../../gh-duplicates/duplicates.txt
|
||||
- name: Commit all reports
|
||||
run: |
|
||||
git config --global user.name 'GitHub Action'
|
||||
|
@ -90,7 +90,7 @@ def get_asm_files(asm_path):
|
||||
return files
|
||||
|
||||
def find_wip(o):
|
||||
result = find_scratches(o[1], "ps1", o[7], True)
|
||||
result = find_scratches(o[1], "ps1", o[8], True)
|
||||
|
||||
if result:
|
||||
return {"link": result[0], "percent": result[1]}
|
||||
@ -141,6 +141,7 @@ if __name__ == "__main__":
|
||||
|
||||
wip = ""
|
||||
wip_percentage = ""
|
||||
dup = ""
|
||||
output.append(
|
||||
[
|
||||
ovl_name,
|
||||
@ -148,6 +149,7 @@ if __name__ == "__main__":
|
||||
length,
|
||||
branches,
|
||||
jump_table,
|
||||
dup,
|
||||
wip,
|
||||
wip_percentage,
|
||||
f["text"] # local asm
|
||||
@ -164,13 +166,31 @@ if __name__ == "__main__":
|
||||
for i, o in enumerate(output):
|
||||
# keep the in-source results as definitive
|
||||
if results[i] != None:
|
||||
o[5] = results[i]["link"]
|
||||
o[6] = results[i]["percent"]
|
||||
o[6] = results[i]["link"]
|
||||
o[7] = results[i]["percent"]
|
||||
|
||||
if args.use_call_trees:
|
||||
base_url = (
|
||||
base_url = (
|
||||
"https://raw.githubusercontent.com/Xeeynamo/sotn-decomp/gh-duplicates"
|
||||
)
|
||||
|
||||
if os.path.isfile("gh-duplicates/duplicates.txt"):
|
||||
with open("gh-duplicates/duplicates.txt", "r") as f:
|
||||
dups_text = f.read()
|
||||
else:
|
||||
print("'warning: gh-duplicates/duplicates.txt' file not found, skipping duplicate check", file=sys.stderr)
|
||||
dups_text = None
|
||||
|
||||
if dups_text is not None:
|
||||
for i, o in enumerate(output):
|
||||
full_match = rf'1.00.+\s{o[1]}\s.+{o[0]}';
|
||||
partial_match = rf'0.\d\d.+\s{o[1]}\s.+{o[0]}';
|
||||
|
||||
if re.search(full_match, dups_text) is not None:
|
||||
o[5] = f"[Full]({base_url}/duplicates.txt#:~:text={o[1]})"
|
||||
elif re.search(partial_match, dups_text) is not None:
|
||||
o[5] = f"[Part]({base_url}/duplicates.txt#:~:text={o[1]})"
|
||||
|
||||
if args.use_call_trees:
|
||||
for i, o in enumerate(output):
|
||||
unique_name = ".".join([o[0], o[1]])
|
||||
|
||||
@ -180,8 +200,8 @@ if __name__ == "__main__":
|
||||
|
||||
# delete asm text
|
||||
for o in output:
|
||||
del o[7:]
|
||||
del o[8:]
|
||||
|
||||
headers = ["Ovl", "Function", "Length", "Branches", "Jtbl", "WIP", "%"]
|
||||
headers = ["Ovl", "Function", "Length", "Branches", "Jtbl", f"[Duplicate]({base_url}/duplicates.txt)", "WIP", "%"]
|
||||
print(tabulate(output, headers=headers, tablefmt="github"))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user