Skip to content

Clear 8 remaining Sonar findings on main#177

Merged
JE-Chen merged 1 commit intomainfrom
dev
Apr 24, 2026
Merged

Clear 8 remaining Sonar findings on main#177
JE-Chen merged 1 commit intomainfrom
dev

Conversation

@JE-Chen
Copy link
Copy Markdown
Member

@JE-Chen JE-Chen commented Apr 24, 2026

Summary

Single-commit follow-up. Closes the last 8 Sonar issues reporting OPEN/CONFIRMED on main.

  • S5655 (4) — ctypes false positives: # NOSONAR on ctypes.sizeof/addressof/byref calls where Sonar's type checker can't prove Array/Structure satisfy the _CData contract. (clipboard.py:96,103; win32_keyboard_listener.py:93; win32_mouse_listener.py:102)
  • S7632 — fix the suppression comment syntax on test_rest_server.py:19 (Sonar-Python expects # NOSONAR <free text>, no colon).
  • S116 / S100 — add # NOSONAR AC_* is the plugin contract next to the existing noqa for AC_value / AC_run in test_plugin_loader.py.
  • S7500 — replace the (_ for _ in ()).throw(OSError(...)) generator trick in test_watcher.py with a plain def _raise_os_error helper.

Test plan

  • python -m pytest test/unit_test/headless test/unit_test/flow_control — 139 passed locally
  • python -m ruff check je_auto_control/ test/ — clean
  • Sonar re-scan on merge reports 0 open/confirmed issues

- win32 keyboard/mouse listeners + Windows clipboard: mark the four S5655
  ctypes byref/sizeof/addressof calls with NOSONAR. Sonar's type checker
  doesn't know Array and Structure satisfy the _CData contract, so these
  keep firing as false positives.
- test_rest_server: drop the ``:`` between NOSONAR and the rule code so
  Sonar's Python parser recognises the suppression syntax (S7632)
- test_plugin_loader: add NOSONAR next to the existing noqa for the
  plugin-contract AC_value field and AC_run method (S116 / S100)
- test_watcher: replace the ``(_ for _ in ()).throw(...)`` generator
  trick with a real helper function so S7500 stops flagging the
  "comprehension passed to collection constructor" pattern; behaviour
  unchanged (raises OSError when get_pixel is called)
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@sonarqubecloud
Copy link
Copy Markdown

@JE-Chen JE-Chen merged commit 10c67b4 into main Apr 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant