Skip to content

Commit 1b07707

Browse files
committed
Formatting
1 parent 8f0ebaf commit 1b07707

File tree

12 files changed

+58
-46
lines changed

12 files changed

+58
-46
lines changed

cli/findings_export.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@ def needs_hotspot_search(params: types.ApiParams) -> bool:
269269
)
270270

271271

272-
def get_component_findings(component: Union[Project, Application, Portfolio], search_findings: bool, params: ConfigSettings) -> dict[str, findings.Finding]:
272+
def get_component_findings(
273+
component: Union[Project, Application, Portfolio], search_findings: bool, params: ConfigSettings
274+
) -> dict[str, findings.Finding]:
273275
"""Gets the findings of a component and puts them in a writing queue"""
274276
try:
275277
_ = next(v for k, v in params.items() if k in _SEARCH_CRITERIA and v is not None)

cli/measures_export.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
if TYPE_CHECKING:
4545
from sonar.components import Component
4646

47+
4748
def __get_measures_history(obj: Component, wanted_metrics: types.KeyList, convert_options: dict[str, str]) -> dict[str, str]:
4849
"""Returns the measure history of an object (project, branch, application, portfolio)"""
4950
try:

sonar/app_branches.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,25 @@ class ApplicationBranch(Component):
4848
Abstraction of the SonarQube "application branch" concept
4949
"""
5050

51-
CACHE = cache.Cache() # :type: cache.Cache
52-
API = { # :type: dict[str, str]
53-
c.CREATE: "applications/create_branch", # :type: str
54-
c.GET: "applications/show", # :type: str
55-
c.UPDATE: "applications/update_branch", # :type: str
56-
c.DELETE: "applications/delete_branch", # :type: str
51+
CACHE = cache.Cache() # :type: cache.Cache
52+
API = { # :type: dict[str, str]
53+
c.CREATE: "applications/create_branch", # :type: str
54+
c.GET: "applications/show", # :type: str
55+
c.UPDATE: "applications/update_branch", # :type: str
56+
c.DELETE: "applications/delete_branch", # :type: str
5757
}
5858

5959
def __init__(
6060
self, app: Application, name: str, project_branches: list[Branch], is_main: bool = False, branch_data: Optional[types.ApiPayload] = None
6161
) -> None:
6262
"""Don't use this directly, go through the class methods to create Objects"""
6363
super().__init__(endpoint=app.endpoint, key=f"{app.key} BRANCH {name}")
64-
self.concerned_object = app # :type: Application
65-
self.name = name # :type: str
66-
self.sq_json = branch_data # :type: types.ApiPayload
67-
self._is_main = is_main # :type: bool
68-
self._project_branches = project_branches # :type: list[Branch]
69-
self._last_analysis = None # :type: Optional[datetime]
64+
self.concerned_object = app # :type: Application
65+
self.name = name # :type: str
66+
self.sq_json = branch_data # :type: types.ApiPayload
67+
self._is_main = is_main # :type: bool
68+
self._project_branches = project_branches # :type: list[Branch]
69+
self._last_analysis = None # :type: Optional[datetime]
7070
log.debug("Created %s with uuid %d id %x", str(self), hash(self), id(self))
7171
ApplicationBranch.CACHE.put(self)
7272

sonar/applications.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ class Application(aggr.Aggregation):
7474
def __init__(self, endpoint: Platform, key: str, name: str) -> None:
7575
"""Don't use this directly, go through the class methods to create Objects"""
7676
super().__init__(endpoint=endpoint, key=key)
77-
self._branches = None # :type: Optional[dict[str, ApplicationBranch]]
78-
self._projects = None # :type: Optional[dict[str, str]]
79-
self._description = None # :type: Optional[str]
80-
self.name = name # :type: str
77+
self._branches = None # :type: Optional[dict[str, ApplicationBranch]]
78+
self._projects = None # :type: Optional[dict[str, str]]
79+
self._description = None # :type: Optional[str]
80+
self.name = name # :type: str
8181
log.debug("Created %s with uuid %d id %x", str(self), hash(self), id(self))
8282
Application.CACHE.put(self)
8383

sonar/changelog.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
if TYPE_CHECKING:
3030
from sonar.findings import Finding
3131

32+
3233
class Changelog(object):
3334
"""Abstraction of SonarQube finding (issue or hotspot) changelog"""
3435

sonar/components.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ class Component(sq.SqObject):
5656
def __init__(self, endpoint: Platform, key: str, data: types.ApiPayload = None) -> None:
5757
"""Constructor"""
5858
super().__init__(endpoint=endpoint, key=key)
59-
self.name = None # :type: Optional[str]
60-
self.nbr_issues = None # :type: Optional[int]
61-
self.ncloc = None # :type: Optional[int]
62-
self._description = None # :type: Optional[str]
63-
self._last_analysis = None # :type: Optional[datetime]
64-
self._visibility = None # :type: Optional[str]
59+
self.name = None # :type: Optional[str]
60+
self.nbr_issues = None # :type: Optional[int]
61+
self.ncloc = None # :type: Optional[int]
62+
self._description = None # :type: Optional[str]
63+
self._last_analysis = None # :type: Optional[datetime]
64+
self._visibility = None # :type: Optional[str]
6565
self.reload(data or {})
6666

6767
def reload(self, data: types.ApiPayload) -> Component:

sonar/findings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class Finding(sq.SqObject):
109109
def __init__(self, endpoint: Platform, key: str, data: types.ApiPayload = None, from_export: bool = False) -> None:
110110
"""Constructor"""
111111
super().__init__(endpoint=endpoint, key=key)
112-
self.severity = None #: Severity # :type: Optional[str]
112+
self.severity = None #: Severity # :type: Optional[str]
113113
self.type = None #: Type: VULNERABILITY, BUG, CODE_SMELL or SECURITY_HOTSPOT # :type: Optional[str]
114114
self.impacts = None #: 10.x MQR mode # :type: Optional[dict[str, str]]
115115
self.author = None #: Author # :type: Optional[str]
@@ -118,8 +118,8 @@ def __init__(self, endpoint: Platform, key: str, data: types.ApiPayload = None,
118118
self.resolution = None #: Resolution # :type: Optional[str]
119119
self.rule = None #: Rule Id # :type: Optional[str]
120120
self.projectKey = None #: Project key # :type: Optional[str]
121-
self._changelog = None # :type: Optional[dict[str, changelog.Changelog]]
122-
self._comments = None # :type: Optional[dict[str, str]]
121+
self._changelog = None # :type: Optional[dict[str, changelog.Changelog]]
122+
self._comments = None # :type: Optional[dict[str, str]]
123123
self.file = None #: File # :type: Optional[str]
124124
self.line = 0 #: Line # :type: Optional[int]
125125
self.component = None

sonar/issues.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class Issue(findings.Finding):
134134
def __init__(self, endpoint: Platform, key: str, data: ApiPayload = None, from_export: bool = False) -> None:
135135
"""Constructor"""
136136
super().__init__(endpoint=endpoint, key=key, data=data, from_export=from_export)
137-
self._debt = None # :type: Optional[int]
137+
self._debt = None # :type: Optional[int]
138138
Issue.CACHE.put(self)
139139

140140
def __str__(self) -> str:
@@ -175,14 +175,14 @@ def debt(self) -> int:
175175
if "debt" in self.sq_json:
176176
kdays, days, hours, minutes = 0, 0, 0, 0
177177
debt = self.sq_json["debt"]
178-
179-
if (m := re.search(r"(\d+)kd", debt)):
178+
179+
if m := re.search(r"(\d+)kd", debt):
180180
kdays = int(m.group(1))
181-
if (m := re.search(r"(\d+)d", debt)):
181+
if m := re.search(r"(\d+)d", debt):
182182
days = int(m.group(1))
183-
if (m := re.search(r"(\d+)h", debt)):
183+
if m := re.search(r"(\d+)h", debt):
184184
hours = int(m.group(1))
185-
if (m := re.search(r"(\d+)min", debt)):
185+
if m := re.search(r"(\d+)min", debt):
186186
minutes = int(m.group(1))
187187
self._debt = ((kdays * 1000 + days) * 24 + hours) * 60 + minutes
188188
elif "effort" in self.sq_json:

sonar/portfolio_reference.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
if TYPE_CHECKING:
4242
from sonar.portfolios import Portfolio
4343

44+
4445
class PortfolioReference(sq.SqObject):
4546
"""
4647
Abstraction of the Sonar portfolio reference concept

sonar/projects.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,16 @@ def __init__(self, endpoint: Platform, key: str) -> None:
161161
:param str key: The project key
162162
"""
163163
super().__init__(endpoint=endpoint, key=key)
164-
self._last_analysis = None # :type: Optional[datetime]
165-
self._branches_last_analysis = None # :type: Optional[datetime]
166-
self._permissions = None # :type: Optional[pperms.ProjectPermissions]
167-
self._branches = None # :type: Optional[dict[str, branches.Branch]]
168-
self._pull_requests = None # :type: Optional[dict[str, pull_requests.PullRequest]]
169-
self._ncloc_with_branches = None # :type: Optional[int]
170-
self._binding = None # :type: Optional[dict[str, str]]
171-
self._new_code = None # :type: Optional[str]
172-
self._ci = None # :type: Optional[str]
173-
self._revision = None # :type: Optional[str]
164+
self._last_analysis = None # :type: Optional[datetime]
165+
self._branches_last_analysis = None # :type: Optional[datetime]
166+
self._permissions = None # :type: Optional[pperms.ProjectPermissions]
167+
self._branches = None # :type: Optional[dict[str, branches.Branch]]
168+
self._pull_requests = None # :type: Optional[dict[str, pull_requests.PullRequest]]
169+
self._ncloc_with_branches = None # :type: Optional[int]
170+
self._binding = None # :type: Optional[dict[str, str]]
171+
self._new_code = None # :type: Optional[str]
172+
self._ci = None # :type: Optional[str]
173+
self._revision = None # :type: Optional[str]
174174
Project.CACHE.put(self)
175175
log.debug("Created object %s", str(self))
176176

0 commit comments

Comments
 (0)