11import json
22import tempfile
33import os
4+ import shutil
45
56from resqui .plugins .base import IndicatorPlugin
67from resqui .executors import DockerExecutor
@@ -42,7 +43,7 @@ def execute(self, url, commit_hash):
4243
4344 tempdir = tempfile .mkdtemp ()
4445
45- url = url [: - 4 ] if url . endswith (".git" ) else url
46+ url = url . removesuffix (".git" )
4647
4748 run_args = [
4849 "--rm" ,
@@ -52,15 +53,18 @@ def execute(self, url, commit_hash):
5253
5354 _ = self .executor .run (["--repo" , url ], run_args = run_args )
5455
55- files = os .listdir (tempdir )
56- if len (files ) < 1 :
57- print ("Error: RSFC did not generate any output files" )
58- raise
56+ assessment_filename = "rsfc_assessment.json"
57+ assessment_fpath = os .path .join (tempdir , assessment_filename )
58+ if not os .path .isfile (os .path .join (tempdir , assessment_filename )):
59+ raise FileNotFoundError (
60+ f"Error: RSFC did not generate the expected assessment file named '{ assessment_filename } '"
61+ )
5962
60- report_path = os .path .join (tempdir , files [0 ])
61- with open (report_path ) as f :
63+ with open (assessment_fpath ) as f :
6264 report = json .load (f )
6365
66+ shutil .rmtree (tempdir )
67+
6468 self ._cache [cache_key ] = report
6569
6670 return report
@@ -163,7 +167,6 @@ def has_releases(self, url, branch_hash_or_tag):
163167
164168 def software_has_license (self , url , branch_hash_or_tag ):
165169 report = self .execute (url , branch_hash_or_tag )
166- print (report )
167170 checks = report ["checks" ]
168171 check_list = []
169172
0 commit comments