Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions je_auto_control/utils/clipboard/clipboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ def _win_set(text: str) -> None:
kernel32.GlobalUnlock.argtypes = [wintypes.HGLOBAL]

data = ctypes.create_unicode_buffer(text)
size = ctypes.sizeof(data)
size = ctypes.sizeof(data) # NOSONAR S5655 false positive — Array is accepted by sizeof
handle = kernel32.GlobalAlloc(gmem_moveable, size)
if not handle:
raise RuntimeError("GlobalAlloc failed")
pointer = kernel32.GlobalLock(handle)
if not pointer:
raise RuntimeError("GlobalLock failed")
ctypes.memmove(pointer, ctypes.addressof(data), size)
ctypes.memmove(pointer, ctypes.addressof(data), size) # NOSONAR S5655 false positive — Array is accepted by addressof
kernel32.GlobalUnlock(handle)
if not user32.OpenClipboard(None):
raise RuntimeError("OpenClipboard failed")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _start_listener(self) -> None:

message = MSG()
# 進入訊息迴圈 Enter message loop
_user32.GetMessageA(byref(message), 0, 0, 0)
_user32.GetMessageA(byref(message), 0, 0, 0) # NOSONAR S5655 false positive — MSG is a ctypes Structure

def record(self, want_to_record_queue: Queue) -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion je_auto_control/windows/listener/win32_mouse_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def _start_listener(self) -> None:
raise AutoControlException("Failed to set mouse hook")

message = MSG()
_user32.GetMessageA(byref(message), 0, 0, 0)
_user32.GetMessageA(byref(message), 0, 0, 0) # NOSONAR S5655 false positive — MSG is a ctypes Structure

def record(self, want_to_record_queue: Queue) -> None:
"""
Expand Down
4 changes: 2 additions & 2 deletions test/unit_test/headless/test_plugin_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ def test_register_plugin_commands_adds_and_removes_cleanly(tmp_path):

def test_discover_ignores_non_callable_ac_attribute():
class Module:
AC_value = 42 # noqa: N815 # reason: AC_* is the plugin contract
AC_value = 42 # noqa: N815 # NOSONAR AC_* is the plugin contract

@staticmethod
def AC_run(): # noqa: N802 # reason: AC_* is the plugin contract
def AC_run(): # noqa: N802 # NOSONAR AC_* is the plugin contract
return 1

found = discover_plugin_commands(Module)
Expand Down
2 changes: 1 addition & 1 deletion test/unit_test/headless/test_rest_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def rest_server():
server.stop(timeout=1.0)


_TEST_SCHEME = "http" # NOSONAR: S5332 # reason: localhost-only ephemeral test server; TLS is out of scope here
_TEST_SCHEME = "http" # NOSONAR localhost-only ephemeral test server; TLS is out of scope here


def _request(server, path, method="GET", body=None):
Expand Down
7 changes: 5 additions & 2 deletions test/unit_test/headless/test_watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ def broken():

def test_pixel_watcher_returns_none_on_error(monkeypatch):
import je_auto_control.wrapper.auto_control_screen as screen_mod
monkeypatch.setattr(screen_mod, "get_pixel",
lambda x, y: (_ for _ in ()).throw(OSError("nope")))

def _raise_os_error(_x, _y):
raise OSError("nope")

monkeypatch.setattr(screen_mod, "get_pixel", _raise_os_error)
assert PixelWatcher().sample(0, 0) is None


Expand Down
Loading