forked from Soester10/atom-finder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquery_suite_run.py
More file actions
38 lines (26 loc) · 1.36 KB
/
query_suite_run.py
File metadata and controls
38 lines (26 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import os
import pandas as pd
def combine_csv(atom_name: str):
main_df = None
for file in os.listdir(f"CodeQL/classifiers/{atom_name}/cpp/queries"):
os.system(f"codeql database analyze CodeQL/db/postIncr-gitNotLatest-database --format=csv --output=CodeQL/out/{atom_name}_git_{file.split('.')[0]}.csv CodeQL/classifiers/{atom_name}/cpp/queries/{file} --rerun")
# if main_df.all() == None:
if type(main_df)() is None:
main_df = pd.read_csv(f"CodeQL/out/{atom_name}_git_{file.split('.')[0]}.csv", header=None)
os.remove(f"CodeQL/out/{atom_name}_git_{file.split('.')[0]}.csv")
continue
df = pd.read_csv(f"CodeQL/out/{atom_name}_git_{file.split('.')[0]}.csv", header=None)
main_df = pd.concat([main_df, df], ignore_index=True)
os.remove(f"CodeQL/out/{atom_name}_git_{file.split('.')[0]}.csv")
main_df.to_csv(f"CodeQL/out/{atom_name}_git.csv", header=None, index=False)
if __name__ == "__main__":
# combine_csv("assignmentAsValue")
# combine_csv("implicitPredicate")
# combine_csv("conditionalOperator")
# combine_csv("postIncr")
# combine_csv("preIncr")
# combine_csv("logicAsControlFlow")
# combine_csv("commaOperator")
# combine_csv("repurposedVariable")
# combine_csv("preprocessorInStatement")
combine_csv("repurposedVariable")