Skip to content

Commit d3944de

Browse files
committed
Revert "Fix-2039 (#2044)"
This reverts commit 5068727.
1 parent ba21267 commit d3944de

File tree

9 files changed

+10
-97
lines changed

9 files changed

+10
-97
lines changed

conf/release.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ RUN pip install --upgrade pip \
3333
USER ${USERNAME}
3434
WORKDIR /home/${USERNAME}
3535

36-
HEALTHCHECK --interval=180s --timeout=5s CMD [ "sonar-tools" ]
36+
HEALTHCHECK --interval=180s --timeout=5s CMD [ "sonar-tools-help" ]
3737

38-
CMD [ "sonar-tools" ]
38+
CMD [ "sonar-tools-help" ]

doc/what-is-new.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# Next version
22

3-
# Version 3.16.1
4-
5-
- Patch for [Issue #2039](https://github.com/okorach/sonar-tools/issues/2039) that may affect merely all the Sonar Tools
6-
73
# Version 3.16
84

95
* `sonar-config`:

sonar/errcodes.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,3 @@
6969
OBJECT_NOT_FOUND = 16
7070

7171
SONAR_INTERNAL_ERROR = 17
72-
73-
74-
TOO_MANY_RESULTS = 18

sonar/exceptions.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,3 @@ class ConnectionError(SonarException):
7575

7676
def __init__(self, message: str) -> None:
7777
super().__init__(message, errcodes.CONNECTION_ERROR)
78-
79-
80-
class TooManyResults(SonarException):
81-
"""When a call to APIs returns too many results."""
82-
83-
def __init__(self, nbr_results: int, message: str) -> None:
84-
super().__init__(message, errcodes.TOO_MANY_RESULTS)
85-
self.nbr_results = nbr_results

sonar/projects.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
import sonar.platform as pf
4141

4242
from sonar.util import types, cache
43-
from sonar.util import project_utils as putils
44-
4543
from sonar import exceptions, errcodes
4644
from sonar import sqobject, components, qualitygates, qualityprofiles, tasks, settings, webhooks, devops
4745
import sonar.permissions.permissions as perms
@@ -1359,22 +1357,14 @@ def count(endpoint: pf.Platform, params: types.ApiParams = None) -> int:
13591357
def search(endpoint: pf.Platform, params: types.ApiParams = None, threads: int = 8) -> dict[str, Project]:
13601358
"""Searches projects in SonarQube
13611359
1362-
:param Platform endpoint: Reference to the SonarQube platform
1363-
:param ApiParams params: list of filter parameters to narrow down the search
1364-
:param int threads: Number of threads to use for the search
1360+
:param endpoint: Reference to the SonarQube platform
1361+
:param params: list of parameters to narrow down the search
1362+
:returns: list of projects
13651363
"""
13661364
new_params = {} if params is None else params.copy()
1367-
if not endpoint.is_sonarcloud() and not new_params.get("filter", None):
1365+
if not endpoint.is_sonarcloud():
13681366
new_params["filter"] = _PROJECT_QUALIFIER
1369-
try:
1370-
log.info("Searching projects with parameters: %s", str(new_params))
1371-
return sqobject.search_objects(endpoint=endpoint, object_class=Project, params=new_params, threads=threads)
1372-
except exceptions.TooManyResults as e:
1373-
log.warning(e.message)
1374-
filter_1, filter_2 = putils.split_loc_filter(new_params["filter"])
1375-
return search(endpoint, params={**new_params, "filter": filter_1}, threads=threads) | search(
1376-
endpoint, params={**new_params, "filter": filter_2}, threads=threads
1377-
)
1367+
return sqobject.search_objects(endpoint=endpoint, object_class=Project, params=new_params, threads=threads)
13781368

13791369

13801370
def get_list(endpoint: pf.Platform, key_list: types.KeyList = None, threads: int = 8, use_cache: bool = True) -> dict[str, Project]:
@@ -1385,8 +1375,8 @@ def get_list(endpoint: pf.Platform, key_list: types.KeyList = None, threads: int
13851375
:return: the list of all projects
13861376
:rtype: dict{key: Project}
13871377
"""
1388-
if key_list is None or len(key_list) == 0 or not use_cache:
1389-
with _CLASS_LOCK:
1378+
with _CLASS_LOCK:
1379+
if key_list is None or len(key_list) == 0 or not use_cache:
13901380
log.info("Listing projects")
13911381
p_list = dict(sorted(search(endpoint=endpoint, threads=threads).items()))
13921382
return p_list

sonar/sqobject.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,6 @@ def search_objects(endpoint: object, object_class: Any, params: types.ApiParams,
242242
data = __get(endpoint, api, {**new_params, p_field: 1})
243243
nb_pages = utilities.nbr_pages(data, api_version)
244244
nb_objects = max(len(data[returned_field]), utilities.nbr_total_elements(data, api_version))
245-
246-
if nb_objects > c.ELASTIC_MAX_RESULTS:
247-
raise exceptions.TooManyResults(nb_objects, f"Too many {cname}s ({nb_objects}) returned by search")
248-
249245
log.info(
250246
"Searching %d %ss, %d pages of %d elements, %d pages in parallel...",
251247
nb_objects,

sonar/util/constants.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,3 @@
7474

7575
SQS_USERS = "sonar-users" # SonarQube Server users default group name
7676
SQC_USERS = "Members" # SonarQube Cloud users default group name
77-
78-
ELASTIC_MAX_RESULTS = 10000 # ElasticSearch max results limit

sonar/util/project_utils.py

Lines changed: 0 additions & 56 deletions
This file was deleted.

sonar/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
"""
2626

2727
PACKAGE_VERSION = "3.17"
28-
MIGRATION_TOOL_VERSION = "0.6-snapshot"
28+
MIGRATION_TOOL_VERSION = "0.7"

0 commit comments

Comments
 (0)