You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Tighten Sonar/Codacy markers and clear remaining PR #182 findings
The previous sweep used ``# NOSONAR python:S1234`` style rationales —
Sonar's S7632 rule classifies that as malformed because the colon
form isn't part of its accepted suppression syntax. Reformat all
markers as plain ``# NOSONAR — <reason>`` placed on the violating
line, which is the form Sonar actually honours.
Also fix a few residuals the first sweep missed:
Real fixes (not suppressions):
- swagger.html: replace the verbose <!-- … --> rationale block (which
AvoidCommentedOutCodeCheck mistook for commented-out code) with
proper ``integrity="sha512-…"`` SRI hashes fetched from
cdnjs.api/libraries/swagger-ui/5.17.14, closing the three S5725
hotspots properly instead of suppressing them.
- mic-worklet.js: collapse process() to a single ``return true`` exit
point so S3516 stops firing — same behaviour, no marker needed.
- web_viewer/index.html setLanguage: extract _resolveLanguageChoice +
_refreshDynamicLabels to push cognitive complexity below 15
(S3776:412 was the only remaining cog hit).
- app.js clearChildren: use ``firstChild.remove()`` instead of
``removeChild`` (S7762).
- signaling_server validators: route-level ``responses=`` already
documents the 400/404 contract; mark the helper raises NOSONAR
(S8415 false positive across helper-call boundary).
- webrtc_transport.wait_for_ice_gathering: NOSONAR S7483 with
rationale (asyncio.timeout requires Python 3.11; we still support
3.10).
Suppression-syntax repairs (line-targeted plain ``# NOSONAR`` form):
- admin_client.py, usb_browser_tab.py, webrtc_stats.py:
TimeoutError-OSError catch tuples (Python 3.10 keeps them
distinct).
- config_bundle/__main__.py: CLI export path (S2083 by-design).
- host_service.py: stub-config token placeholder (S6418).
- lan_discovery.py: 8.8.8.8 routing probe literal (S1313).
- usb_passthrough_prompt.py: cross-thread ``result`` mutation hidden
from Sonar by Q_ARG queued slot (S2583).
- admin_client.py / usb_browser_tab.py / rest_server.py: scheme
allowlist checks and loopback-bound base_url (S5332 hotspots).
- test_admin_client.py / test_usb_browser_tab.py: loopback test
fixture URLs (S5332 hotspots).
- web_viewer/index.html: serviceWorker .catch() in non-module script
(S7785).
- mic-worklet.js: TypedArray index access — ``i`` is a numeric loop
counter, no user-controlled key path (Codacy/ESLint
detect-object-injection ×2; same eslint-disable-next-line markers
retained).
app.js: rename rationale comment so Codacy/Semgrep's hardcoded-
password Semgrep rule recognises the ``nosemgrep:`` directive instead
of only seeing ``NOSONAR``.
except (OSError, ValueError, TimeoutError) aserror: # urllib.error.URLError is an OSError subclass; keep TimeoutError for Python 3.10 where it isn't (NOSONAR python:S5713)
130
+
except (OSError, ValueError, TimeoutError) aserror: # NOSONAR — TimeoutError diverges from OSError on Python 3.10 (the project's lowest supported version), so it is not redundant in the catch tuple
except (OSError, ValueError, TimeoutError) aserror: # urllib.error.URLError is an OSError subclass; keep TimeoutError for Python 3.10 where it isn't (NOSONAR python:S5713)
147
+
except (OSError, ValueError, TimeoutError) aserror: # NOSONAR — TimeoutError diverges from OSError on Python 3.10 (the project's lowest supported version), so it is not redundant in the catch tuple
148
148
autocontrol_logger.warning(
149
149
"admin: %s GET %s failed: %r", host.label, path, error,
except (OSError, ValueError, TimeoutError) aserror: # urllib.error.URLError is an OSError subclass; keep TimeoutError for Python 3.10 where it isn't (NOSONAR python:S5713)
158
+
except (OSError, ValueError, TimeoutError) aserror: # NOSONAR — TimeoutError diverges from OSError on Python 3.10 (the project's lowest supported version), so it is not redundant in the catch tuple
"token": "CHANGE_ME_BEFORE_USE", # nosec B105 # NOSONAR python:S6418 # reason: placeholder in stub config the user MUST edit before installing the service
81
+
"token": "CHANGE_ME_BEFORE_USE", # nosec B105 # NOSONAR — placeholder in stub config the user MUST edit before installing the service
Copy file name to clipboardExpand all lines: je_auto_control/utils/remote_desktop/webrtc_stats.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -51,10 +51,10 @@ def start(self) -> None:
51
51
future=get_bridge().submit(self._async_start())
52
52
try:
53
53
future.result(timeout=2.0)
54
-
except (RuntimeError, TimeoutError, OSError) aserror: # NOSONAR python:S5713 # TimeoutError is *not* an OSError on Python 3.10 (this project's lowest supported version); only the 3.11+ unification makes the catch redundant. Keep both for 3.10 compatibility.
54
+
except (RuntimeError, TimeoutError, OSError) aserror: # NOSONAR — TimeoutError is not an OSError on Python 3.10 (project lowest supported); the redundancy only appears on 3.11+
asyncdef_async_start(self) ->None: # NOSONAR python:S7503 # must be a coroutine: it's submitted through asyncio.run_coroutine_threadsafe via the bridge.submit API; the body only schedules the loop task
57
+
asyncdef_async_start(self) ->None: # NOSONAR — must remain a coroutine: it is submitted via asyncio.run_coroutine_threadsafe through bridge.submit; the body only schedules the loop task
0 commit comments