Skip to content

Address several SonarQube issues reported on the main branch. - #2419

Merged
GernotMaier merged 4 commits into
mainfrom
sonarque-issues
Aug 7, 2026
Merged

Address several SonarQube issues reported on the main branch.#2419
GernotMaier merged 4 commits into
mainfrom
sonarque-issues

Conversation

@GernotMaier

Copy link
Copy Markdown
Contributor

Not entirely sure where these issues come from - maybe from a SonarQube update? I haven't seen them before - anyway, this branch fixes them.

@GernotMaier GernotMaier self-assigned this Aug 7, 2026
@GernotMaier GernotMaier added the Copilot review AI-supported Copilot review label Aug 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses SonarQube findings on the main branch by applying small, targeted refactors and shell/Docker/YAML hygiene fixes across tests, Python code, Dockerfiles, scripts, and GitHub workflows.

Changes:

  • Simplifies/refactors a few Python constructs to satisfy static analysis (safe handler iteration, reduced redundant list conversions, clearer intermediate variables, improved typing).
  • Hardens shell/Docker usage with safer quoting and stderr for error paths.
  • Scopes GitHub Actions permissions at the job level and adds a maintenance changelog fragment.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit_tests/application/test_control.py Iterates over a stable copy of logger handlers when cleaning up, avoiding mutation-during-iteration warnings.
src/simtools/simtel/simtel_config_reader.py Refactors list extension logic to compute repetition count once (SonarQube-style readability).
src/simtools/simtel/nsb_trigger_calculator.py Removes an unreachable/irrelevant triggers is None check since triggers is always set to an int.
src/simtools/db/mongo_db.py Makes db_client explicitly nullable via a union type annotation.
src/simtools/configuration/configurator.py Removes an unnecessary list() wrapping while building argparse token lists.
docs/changes/2419.maintenance.md Adds a maintenance changelog fragment for this SonarQube cleanup.
docker/Dockerfile-simtools-dev Consolidates RUN steps to reduce layers and keep git safe.directory setup in the same RUN chain.
docker/Dockerfile-corsika7 Improves quoting for variable expansions and refactors long shell/awk lines for safer parsing.
database_scripts/setup_local_db.sh Sends error messages to stderr and uses [[ ... ]] tests under bash.
database_scripts/purge_local_db.sh Sends error messages to stderr, uses [[ ... ]], and makes helper functions explicitly return success.
.github/workflows/CI-unittests.yml Moves permissions: contents: read from workflow-level to per-job permissions.
.github/workflows/CI-docs.yml Moves permissions: contents: read from workflow-level to the docs job.
.github/workflows/build-sim_telarray.yml Moves permissions: contents: read from workflow-level to the dependency-config job.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ctao-sonarqube

ctao-sonarqube Bot commented Aug 7, 2026

Copy link
Copy Markdown

@GernotMaier
GernotMaier marked this pull request as ready for review August 7, 2026 09:07
@GernotMaier
GernotMaier merged commit 52c160e into main Aug 7, 2026
37 checks passed
@GernotMaier
GernotMaier deleted the sonarque-issues branch August 7, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Copilot review AI-supported Copilot review

Development

Successfully merging this pull request may close these issues.

2 participants