Skip to content

Clear post-merge Sonar hotspot and Codacy findings#176

Merged
JE-Chen merged 2 commits intomainfrom
dev
Apr 24, 2026
Merged

Clear post-merge Sonar hotspot and Codacy findings#176
JE-Chen merged 2 commits intomainfrom
dev

Conversation

@JE-Chen
Copy link
Copy Markdown
Member

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

Summary

Two small analyzer follow-ups caught after PR #175 merged.

  • Sonar hotspot S5332test_rest_server.py:21: extract _TEST_SCHEME = "http" constant with a NOSONAR justification. The test hits an ephemeral localhost server on port 0; TLS is out of scope.
  • Codacy main-branch issues (5 total) — one-line suppressions or signature alignments for:
    • conf.py redefined-builtin on Sphinx's required copyright global (PyLint W0622)
    • _JSONHandler.log_message signature lined up with BaseHTTPRequestHandler.log_message (W0221)
    • nosemgrep on the three dynamic-argv subprocess calls in clipboard._linux_get/_linux_set and shell_exec.exec_shell — argv is allowlisted via shutil.which or validated by _normalize_command

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
  • python -m bandit -r je_auto_control/ -c pyproject.toml — 0 issues
  • Sonar + Codacy re-analysis on merge commit reports no new findings

JE-Chen added 2 commits April 25, 2026 01:44
Lift the ``http`` scheme into a named constant with a NOSONAR justification
so the static analyzer sees intent ("localhost-only ephemeral test server;
TLS is out of scope") rather than a bare ``http://`` URL literal. The test
still hits the same local server in the same way.
- rest_server: rename _JSONHandler.log_message parameter back to
  ``format`` so the signature matches BaseHTTPRequestHandler, silencing
  PyLint W0221 (arguments-renamed); add a pylint disable comment because
  the name deliberately shadows the builtin
- conf.py: add ``# pylint: disable=redefined-builtin`` next to the
  existing ruff noqa for Sphinx's required ``copyright`` global (W0622)
- clipboard._linux_get/_linux_set: annotate the two subprocess.run
  calls with nosemgrep for dangerous-subprocess-use-audit; the argv
  list is built from an allowlist (xclip/xsel) located via shutil.which
- shell_process.exec_shell: same nosemgrep annotation on the Popen
  call; argv is shlex-split then validated by ``_normalize_command``
@sonarqubecloud
Copy link
Copy Markdown

@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.

@JE-Chen JE-Chen merged commit 0ecbda2 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