Skip to content

Commit 3b30ae1

Browse files
committed
Fixes #1311
1 parent b906748 commit 3b30ae1

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

sonar/branches.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,13 @@ def export(self, export_settings: types.ConfigSettings) -> types.ObjectJsonRepr:
230230
data[settings.NEW_CODE_PERIOD] = self.new_code()
231231
if export_settings.get("FULL_EXPORT", True):
232232
data.update({"name": self.name, "project": self.concerned_object.key})
233+
if export_settings["MODE"] == "MIGRATION":
234+
lang_distrib = self.get_measure("ncloc_language_distribution")
235+
loc_distrib = {}
236+
if lang_distrib:
237+
loc_distrib = {m.split("=")[0]: int(m.split("=")[1]) for m in lang_distrib.split(";")}
238+
loc_distrib["total"] = self.loc()
239+
data["ncloc"] = loc_distrib
233240
data = util.remove_nones(data)
234241
return None if len(data) == 0 else data
235242

sonar/projects.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,13 @@ def export(self, export_settings: types.ConfigSettings, settings_list: dict[str,
950950
(json_data["qualityGate"], qg_is_default) = self.quality_gate()
951951
if qg_is_default:
952952
json_data.pop("qualityGate")
953+
if export_settings["MODE"] == "MIGRATION":
954+
lang_distrib = self.get_measure("ncloc_language_distribution")
955+
loc_distrib = {}
956+
if lang_distrib:
957+
loc_distrib = {m.split("=")[0]: int(m.split("=")[1]) for m in lang_distrib.split(";")}
958+
loc_distrib["total"] = self.loc()
959+
json_data["ncloc"] = loc_distrib
953960

954961
hooks = webhooks.export(self.endpoint, self.key)
955962
if hooks is not None:

0 commit comments

Comments
 (0)