Skip to content

Commit b5d37fa

Browse files
committed
Use the project conversion function
1 parent 9c80c24 commit b5d37fa

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

sonar/projects.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -968,12 +968,12 @@ def export(self, export_settings: types.ConfigSettings, settings_list: Optional[
968968
nc = self.new_code()
969969
if nc != "":
970970
json_data[settings.NEW_CODE_PERIOD] = nc
971-
json_data["qualityProfiles"] = util.dict_to_list(self.__export_get_qp(), "language", "name")
971+
json_data["qualityProfiles"] = self.__export_get_qp()
972972
json_data["links"] = self.links()
973-
json_data["permissions"] = util.perms_to_list(self.permissions().to_json(csv=export_settings.get("INLINE_LISTS", True)))
973+
json_data["permissions"] = self.permissions().to_json(csv=export_settings.get("INLINE_LISTS", True))
974974
if self.endpoint.version() >= (10, 7, 0):
975975
json_data["aiCodeFix"] = self.ai_code_fix()
976-
json_data["branches"] = util.dict_to_list(self.__get_branch_export(export_settings), "name")
976+
json_data["branches"] = self.__get_branch_export(export_settings)
977977
json_data["tags"] = self.get_tags()
978978
json_data["visibility"] = self.visibility()
979979
(json_data["qualityGate"], qg_is_default) = self.quality_gate()
@@ -1002,7 +1002,8 @@ def export(self, export_settings: types.ConfigSettings, settings_list: Optional[
10021002
if contains_ai:
10031003
json_data[_CONTAINS_AI_CODE] = contains_ai
10041004
with_inherited = export_settings.get("INCLUDE_INHERITED", False)
1005-
json_data["settings"] = [s.to_json() for s in settings_dict.values() if with_inherited or not s.inherited and s.key != "visibility"]
1005+
json_data["settings"] = {k: s.to_json() for k, s in settings_dict.values() if with_inherited or not s.inherited and s.key != "visibility"}
1006+
return phelp.convert_projects_json(json_data)
10061007

10071008
except Exception as e:
10081009
traceback.print_exc()

sonar/util/project_helper.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ def old_to_new_json_one(old_json: dict[str, Any]) -> dict[str, Any]:
6969
new_json = old_json.copy()
7070
if "permissions" in old_json:
7171
new_json["permissions"] = util.perms_to_list(old_json["permissions"])
72+
if "qualityProfiles" in old_json:
73+
new_json["qualityProfiles"] = util.dict_to_list(old_json["qualityProfiles"], "language", "name")
7274
if "branches" in old_json:
7375
new_json["branches"] = util.dict_to_list(old_json["branches"], "name")
7476
if "settings" in old_json:

0 commit comments

Comments
 (0)