diff --git a/sonar/hotspots.py b/sonar/hotspots.py index 00707efec..70c66ab8e 100644 --- a/sonar/hotspots.py +++ b/sonar/hotspots.py @@ -391,7 +391,7 @@ def search(endpoint: pf.Platform, filters: types.ApiParams = None) -> dict[str, for inline_filters in filters_iterations: p = 1 inline_filters["ps"] = ps - log.info("Searching hotspots with sanitized filters %s", str(inline_filters)) + log.debug("Searching hotspots with sanitized filters %s", str(inline_filters)) while True: inline_filters["p"] = p try: diff --git a/sonar/issues.py b/sonar/issues.py index e8410681e..a208cd233 100644 --- a/sonar/issues.py +++ b/sonar/issues.py @@ -823,11 +823,9 @@ def get_newest_issue(endpoint: pf.Platform, params: ApiParams = None) -> Union[d def count(endpoint: pf.Platform, **kwargs) -> int: """Returns number of issues of a search""" params = {} if not kwargs else kwargs.copy() - params["ps"] = 1 - try: - nbr_issues = len(search(endpoint=endpoint, params=params)) - except TooManyIssuesError as e: - nbr_issues = e.nbr_issues + filters = pre_search_filters(endpoint=endpoint, params=params) + filters["ps"] = 1 + nbr_issues = json.loads(endpoint.get(Issue.SEARCH_API, params=filters).text)["paging"]["total"] log.debug("Count issues with filters %s returned %d issues", str(kwargs), nbr_issues) return nbr_issues diff --git a/sonar/projects.py b/sonar/projects.py index b537eaa62..1b77310ec 100644 --- a/sonar/projects.py +++ b/sonar/projects.py @@ -1024,6 +1024,7 @@ def export(self, export_settings: types.ConfigSettings, settings_list: dict[str, else: log.critical("HTTP error %s while exporting %s, export of this project skipped", str(e), str(self)) json_data = {} + log.info("Exporting %s done", str(self)) return util.remove_nones(json_data) def new_code(self) -> str: diff --git a/test/test_migration.py b/test/test_migration.py index b988eebe9..fe8c10853 100644 --- a/test/test_migration.py +++ b/test/test_migration.py @@ -94,7 +94,7 @@ def test_migration() -> None: assert p["branches"]["master"]["hotspots"]["acknowledged"] == 0 p = json_config["projects"]["checkstyle-issues"] - assert len(p["branches"]["issues"]["thirdParty"]) > 0 + assert len(p["branches"]["main"]["issues"]["thirdParty"]) > 0 assert json_config["projects"]["demo:gitlab-ci-maven"]["detectedCi"] == "GitLab CI" assert json_config["projects"]["demo:gitlab-actions-cli"]["detectedCi"] == "Github Actions"