@@ -953,9 +953,6 @@ def export(self, export_settings: types.ConfigSettings, settings_list: dict[str,
953953 :return: All project configuration settings
954954 :rtype: dict
955955 """
956- from sonar .issues import count as issue_count
957- from sonar .hotspots import count as hotspot_count
958-
959956 log .info ("Exporting %s" , str (self ))
960957 try :
961958 json_data = self ._json .copy ()
@@ -980,15 +977,9 @@ def export(self, export_settings: types.ConfigSettings, settings_list: dict[str,
980977 json_data = util .filter_export (json_data , _IMPORTABLE_PROPERTIES , export_settings .get ("FULL_EXPORT" , False ))
981978
982979 if export_settings .get ("MODE" , "" ) == "MIGRATION" :
983- json_data [ "lastAnalysis" ] = util . date_to_string (self .last_analysis ())
980+ json_data . update (self .migration_export ())
984981 json_data ["detectedCi" ] = self .ci ()
985982 json_data ["revision" ] = self .revision ()
986- lang_distrib = self .get_measure ("ncloc_language_distribution" )
987- loc_distrib = {}
988- if lang_distrib :
989- loc_distrib = {m .split ("=" )[0 ]: int (m .split ("=" )[1 ]) for m in lang_distrib .split (";" )}
990- loc_distrib ["total" ] = self .loc ()
991- json_data ["ncloc" ] = loc_distrib
992983 last_task = self .last_task ()
993984 json_data ["backgroundTasks" ] = {}
994985 if last_task :
@@ -997,22 +988,6 @@ def export(self, export_settings: types.ConfigSettings, settings_list: dict[str,
997988 "lastTaskWarnings" : last_task .warnings (),
998989 "taskHistory" : [t ._json for t in self .task_history ()],
999990 }
1000- tpissues = self .count_third_party_issues ()
1001- inst_issues = self .count_instantiated_rules_issues ()
1002- params = self .search_params ()
1003- json_data ["issues" ] = {
1004- "thirdParty" : tpissues if len (tpissues ) > 0 else 0 ,
1005- "instantiatedRules" : inst_issues if len (inst_issues ) > 0 else 0 ,
1006- "falsePositives" : issue_count (self .endpoint , issueStatuses = ["FALSE_POSITIVE" ], ** params ),
1007- }
1008- status = "accepted" if self .endpoint .version () >= (10 , 2 , 0 ) else "wontFix"
1009- json_data ["issues" ][status ] = issue_count (self .endpoint , issueStatuses = [status .upper ()], ** params )
1010- json_data ["hotspots" ] = {
1011- "acknowledged" : hotspot_count (self .endpoint , resolution = ["ACKNOWLEDGED" ], ** params ),
1012- "safe" : hotspot_count (self .endpoint , resolution = ["SAFE" ], ** params ),
1013- "fixed" : hotspot_count (self .endpoint , resolution = ["FIXED" ], ** params ),
1014- }
1015- log .debug ("%s has these notable issues %s" , str (self ), str (json_data ["issues" ]))
1016991
1017992 settings_dict = settings .get_bulk (endpoint = self .endpoint , component = self , settings_list = settings_list , include_not_set = False )
1018993 # json_data.update({s.to_json() for s in settings_dict.values() if include_inherited or not s.inherited})
0 commit comments