Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions blueman/gui/manager/ManagerDeviceList.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@

return True

def _on_event_clicked(self, _widget: Gtk.Widget, event: Gdk.Event) -> bool:

Check failure on line 221 in blueman/gui/manager/ManagerDeviceList.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=blueman-project_blueman&issues=AZ2LyV-K7NPnFptr6pMU&open=AZ2LyV-K7NPnFptr6pMU&pullRequest=3205
if event.type not in (Gdk.EventType._2BUTTON_PRESS, Gdk.EventType.BUTTON_PRESS):
return False

Expand All @@ -242,6 +242,8 @@

if event.type == Gdk.EventType._2BUTTON_PRESS and cast(Gdk.EventButton, event).button == 1:
if self.menu.show_generic_connect_calc(row["device"]['UUIDs']):
if self.menu.get_op(row["device"]):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can check this as soon as we have a valid row so please move this to earlier in the function. This will most likely also make SonarCloud happy.

return False
if row["connected"]:
self.menu.disconnect_service(row["device"])
elif Adapter(obj_path=row["device"]["Adapter"])["Powered"]:
Expand Down
Loading