Skip to content

Fix SonarCloud and Codacy static analysis issues#25

Merged
JE-Chen merged 4 commits intomainfrom
dev
Apr 25, 2026
Merged

Fix SonarCloud and Codacy static analysis issues#25
JE-Chen merged 4 commits intomainfrom
dev

Conversation

@JE-Chen
Copy link
Copy Markdown
Member

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

Summary

  • Resolve all 14 open SonarCloud issues and 8 security hotspots: type fixes for step_log_check, cognitive-complexity refactors of parallel_run / execute_yaml / select_with_runner, pinned Dockerfile base image with merged RUN layers and non-root user.
  • Tidy Codacy noise: remove unused imports, swap test placeholder URLs to https, replace hardcoded test password with secrets.token_hex, and route temp paths through tempfile.gettempdir().
  • No behavior changes; full test suite still green (109 passed).

Test plan

  • pytest test/ — 109 passed, 1 pre-existing collection warning.
  • Re-run SonarCloud + Codacy analysis against the merged commit and confirm the issue counts drop to zero (or only known-noise Bandit B101/B404/B603 in tests).

- Type Optional params in step_log_check (S5655)
- Refactor parallel_run, execute_yaml, select_with_runner to reduce
  cognitive complexity below 15 (S3776)
- Replace list() copy with rebuild in ProcessManager.cleanup_finished
  and reuse it from parallel_run (S7504)
- Pin Ubuntu base image to 24.04 and merge consecutive RUN layers in
  Dockerfile_GUI and Dockerfile_NonGUI (S6596, S7031); drop privileges
  to a non-root pioneer user
- Replace hardcoded test password with secrets.token_hex and switch
  /tmp paths to tempfile.gettempdir (S2068, B106, B108)
- Switch test placeholder URLs from http to https (S5332)
- Drop unused imports in test_project, test_file_processing,
  test_pioneer_executor, and docker_non_gui_test/test
- Suppress redefined-builtin warning for Sphinx-required copyright var
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 25, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 7 complexity · 0 duplication

Metric Results
Complexity 7
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 added 3 commits April 25, 2026 17:23
- Fix Sonar S5607 in test_logging by reading maxBytes via getattr and
  type-checking explicitly; bypasses an incorrect str/int inference on
  RotatingFileHandler.maxBytes
- Merge the trailing pip install + useradd RUN instructions in both
  Dockerfile_GUI and Dockerfile_NonGUI to satisfy S7031
Combines the two asserts introduced in 5e0485c into one expression so
the new-code Bandit B101 (assert in test) count matches the prior
version. Pytest still treats the assertion as a single failure point.
Add an inline `# nosec B101` to the lone surviving Bandit warning the
PR introduces. The check is intentional pytest-style assertion in test
code and not security-sensitive.
@sonarqubecloud
Copy link
Copy Markdown

@JE-Chen JE-Chen merged commit 83fad52 into main Apr 25, 2026
14 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