Skip to content

Commit ce7d3d5

Browse files
authored
Fix sonar.announcement.message (#2063)
* Fix sonar.announcement.message * Fix conversion of bool values from string to bool * Export project permissions as list
1 parent 48f7d59 commit ce7d3d5

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

sonar/projects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ def export(self, export_settings: types.ConfigSettings, settings_list: Optional[
10081008
json_data[settings.NEW_CODE_PERIOD] = nc
10091009
json_data["qualityProfiles"] = util.dict_to_list(self.__export_get_qp(), "language", "name")
10101010
json_data["links"] = self.links()
1011-
json_data["permissions"] = self.permissions().to_json(csv=export_settings.get("INLINE_LISTS", True))
1011+
json_data["permissions"] = util.perms_to_list(self.permissions().to_json(csv=export_settings.get("INLINE_LISTS", True)))
10121012
if self.endpoint.version() >= (10, 7, 0):
10131013
json_data["aiCodeFix"] = self.ai_code_fix()
10141014
json_data["branches"] = util.dict_to_list(self.__get_branch_export(export_settings), "name")

sonar/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def reload(self, data: types.ApiPayload) -> None:
206206
self.value = data.get("mode", "MQR") != "STANDARD_EXPERIENCE"
207207
elif self.key == COMPONENT_VISIBILITY:
208208
self.value = data.get("visibility", None)
209-
elif self.key == "sonar.login.message":
209+
elif self.key in ("sonar.login.message", "sonar.announcement.message"):
210210
self.value = None
211211
if "values" in data and isinstance(data["values"], list) and len(data["values"]) > 0:
212212
self.value = data["values"][0]

sonar/utilities.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,10 @@ def convert_to_type(value: str) -> Any:
172172
return float(value)
173173
except ValueError:
174174
pass
175-
try:
176-
return bool(value)
177-
except ValueError:
178-
pass
175+
if value.lower() == "true":
176+
return True
177+
if value.lower() == "false":
178+
return False
179179
return value
180180

181181

0 commit comments

Comments
 (0)