Skip to content

fix: clear the last 4 SonarCloud findings (setup.sh install flags, pytest.raises scope) - #158

Merged
Sagargupta16 merged 1 commit into
mainfrom
fix/remaining-sonarcloud-findings
Aug 10, 2026
Merged

Sagargupta16 merged 1 commit into
mainfrom
fix/remaining-sonarcloud-findings

Conversation

@Sagargupta16

Copy link
Copy Markdown
Owner

Description

Follow-up to #157. That PR took SonarCloud from 22 open issues to 4 and turned the quality gate green, but the fresh analysis of main surfaced a file that had never been scanned before (setup.sh) plus one incomplete fix. This clears the remaining 4.

Changes

setup.sh — newly scanned, so current rules fired on it for the first time:

  • shell:S8541 x2 (lines 25, 26) — pip install now passes --only-binary :all:, so pip cannot execute setup scripts from a source distribution.
  • shell:S6505 (line 32) — npm install now passes --ignore-scripts.

setup.bat — mirrors the same two flags. SonarCloud does not analyse .bat files, but the two setup scripts should not drift apart.

tests/test_predict.pypython:S5778 in test_make_prediction_scaler_error. #157 hoisted the numpy array out of the pytest.raises block, but that was not enough: the DummyModel() and BadScaler() constructor calls inside the block also count as potentially-throwing invocations. Both are now constructed beforehand, so make_prediction is the only call that can raise.

Testing

  • ruff check . — all checks passed
  • pytest -q34 passed
  • bash -n against the committed setup.sh — parses cleanly

Note: bash -n fails against the local working copy because the editor writes CRLF; .gitattributes sets * text=auto eol=lf, so the committed blob is LF and valid. Verified via git show HEAD:setup.sh.

The setup scripts themselves were not executed end to end, since doing so would recreate the local virtualenv and reinstall the client.

setup.sh had never been scanned before, so newer rules surfaced on it:

- pip installs use --only-binary :all: so no setup scripts run from source
  distributions (shell:S8541).
- npm install uses --ignore-scripts (shell:S6505).

Mirror the same flags in setup.bat for consistency; Sonar does not analyse
.bat files, but the two scripts should not drift.

Also finish python:S5778 in test_make_prediction_scaler_error: hoisting the
array was not enough because the DummyModel() and BadScaler() constructors
inside the pytest.raises block also count as throwing invocations. Both are
now built beforehand so only make_prediction can raise.
@sonarqubecloud

Copy link
Copy Markdown

@Sagargupta16
Sagargupta16 merged commit c06c78a into main Aug 10, 2026
5 checks passed
@Sagargupta16
Sagargupta16 deleted the fix/remaining-sonarcloud-findings branch August 10, 2026 02:30
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