33import sys
44import os
55import shutil
6+ import settings
67
78"""
89This script runs the CSV coverage report QL query, and transforms it to a more readable format.
@@ -135,13 +136,12 @@ def __init__(self, lang, capitalized_lang, ext, ql_path):
135136 ". Expected either 'dev' or 'ci'." , file = sys .stderr )
136137 exit (1 )
137138
139+ # The QL model holding the CSV info can come from directly a PR or the main branch, but optionally we can use an earlier
140+ # SHA too, therefore it's checked out seperately into a dedicated subfolder.
138141query_prefix = ""
139- data_prefix = ""
140142if len (sys .argv ) > 2 :
141143 query_prefix = sys .argv [2 ] + "/"
142144
143- if len (sys .argv ) > 3 :
144- data_prefix = sys .argv [3 ] + "/"
145145
146146# Languages for which we want to generate coverage reports.
147147configs = [
@@ -150,17 +150,16 @@ def __init__(self, lang, capitalized_lang, ext, ql_path):
150150]
151151
152152# The names of input and output files. The placeholder {language} is replaced with the language name.
153- documentation_folder = "{language}/documentation/library-coverage/"
154153output_ql_csv = "output-{language}.csv"
155- input_framework_csv = data_prefix + documentation_folder + "frameworks.csv"
156- input_cwe_sink_csv = data_prefix + documentation_folder + "cwe-sink.csv"
154+ input_framework_csv = settings . documentation_folder + "frameworks.csv"
155+ input_cwe_sink_csv = settings . documentation_folder + "cwe-sink.csv"
157156
158157if mode == "dev" :
159- output_rst = data_prefix + documentation_folder + "flow-model-coverage.rst"
160- output_csv = data_prefix + documentation_folder + "flow-model-coverage.csv"
158+ output_rst = settings . repo_output_rst
159+ output_csv = settings . repo_output_csv
161160else :
162- output_rst = "flow-model-coverage-{language}.rst"
163- output_csv = "flow-model-coverage-{language}.csv"
161+ output_rst = settings . generated_output_rst
162+ output_csv = settings . generated_output_csv
164163
165164for config in configs :
166165 lang = config .lang
0 commit comments