Skip to content

chore: Checking ShellCheck errors and applying relevant fixes - #1305

Merged
openshift-merge-bot[bot] merged 13 commits into
redhat-developer:mainfrom
OpinionatedHeron:shellCheck
Jul 15, 2025
Merged

chore: Checking ShellCheck errors and applying relevant fixes#1305
openshift-merge-bot[bot] merged 13 commits into
redhat-developer:mainfrom
OpinionatedHeron:shellCheck

Conversation

@OpinionatedHeron

@OpinionatedHeron OpinionatedHeron commented Jun 25, 2025

Copy link
Copy Markdown
Member

Description

Reviewing ShellCheck errors that appear in Code Scanning. Searching and reviewing that error and making changes to the code, if relevant and necessary to do so. Testing the changes by re-running the shellcheck and ensuring that no other errors appear when checking.

Which issue(s) does this PR fix or relate to

PR acceptance criteria

  • Tests
  • Documentation

How to test changes / Special notes to the reviewer

Summary by Sourcery

Enhancements:

  • Quote the to_host variable assignment in db_copy.sh to address ShellCheck warnings and ensure proper string handling

Signed-off-by: Leanne Ahern <lahern@redhat.com>
@sourcery-ai

sourcery-ai Bot commented Jun 25, 2025

Copy link
Copy Markdown
Contributor

Reviewer's Guide

This PR addresses a ShellCheck warning by quoting the to_host variable value in the db_copy.sh script to ensure proper parsing and prevent word splitting.

File-Level Changes

Change Details Files
Quoted the to_host variable assignment to satisfy ShellCheck and avoid splitting
  • Wrapped the placeholder in double quotes for the to_host assignment
hack/db_copy.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@openshift-ci
openshift-ci Bot requested review from gazarenkov and zdrapela June 25, 2025 16:25

@sourcery-ai sourcery-ai Bot 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.

Hey @OpinionatedHeron - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `hack/db_copy.sh:3` </location>
<code_context>
 #!/bin/bash

-to_host=<db-service-host>
+to_host="<db-service-host>"
 to_port=5432
 to_user=postgres
</code_context>

<issue_to_address>
Quoting the variable assignment improves safety for special characters.

Quoting prevents issues with spaces or special characters in the value, which is recommended in shell scripts.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread hack/db_copy.sh
…C2068

Signed-off-by: Leanne Ahern <lahern@redhat.com>
@OpinionatedHeron OpinionatedHeron changed the title Checking shellCheck fix - for db_copyfile chore: Checking ShellCheck errors and applying relevant fixes Jun 25, 2025
Signed-off-by: Leanne Ahern <lahern@redhat.com>
…repare-restricted-environment script

Signed-off-by: Leanne Ahern <lahern@redhat.com>
…ning - SC2178 and SC2128.

Signed-off-by: Leanne Ahern <lahern@redhat.com>
Comment thread hack/db_copy.sh Outdated
Comment thread hack/db_copy.sh Outdated
Comment thread .rhdh/scripts/prepare-restricted-environment.sh Outdated
Comment thread .rhdh/scripts/prepare-restricted-environment.sh Outdated
Comment thread .rhdh/scripts/prepare-restricted-environment.sh Outdated
Comment thread .rhdh/scripts/prepare-restricted-environment.sh Outdated
Comment thread .rhdh/scripts/prepare-restricted-environment.sh Outdated
Comment thread .rhdh/scripts/prepare-restricted-environment.sh Outdated
Comment thread .rhdh/scripts/prepare-restricted-environment.sh Outdated
Comment thread .rhdh/scripts/prepare-restricted-environment.sh
Signed-off-by: Leanne Ahern <lahern@redhat.com>
Comment thread .rhdh/scripts/prepare-restricted-environment.sh Outdated
Comment thread .rhdh/scripts/prepare-restricted-environment.sh Outdated
Signed-off-by: Leanne Ahern <lahern@redhat.com>
Comment on lines 862 to 863
local dest_image
dest_image=$(replaceInternalRegIfNeeded "$1")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
local dest_image
dest_image=$(replaceInternalRegIfNeeded "$1")
src_image=$(replaceInternalRegIfNeeded "$1")

I meant not using dest_image at all, since it is not needed.

Comment thread .rhdh/scripts/prepare-restricted-environment.sh Outdated
Signed-off-by: Leanne Ahern <lahern@redhat.com>
Comment thread .rhdh/scripts/prepare-restricted-environment.sh Outdated

@rm3l rm3l left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @OpinionatedHeron !!

/lgtm

@openshift-ci

openshift-ci Bot commented Jul 15, 2025

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gazarenkov, rm3l

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot
openshift-merge-bot Bot merged commit 666d602 into redhat-developer:main Jul 15, 2025
9 checks passed
Fortune-Ndlovu pushed a commit to Fortune-Ndlovu/rhdh-operator that referenced this pull request Sep 6, 2025
…-developer#1305)

* Checking shellCheck fix - for db_copyfile

Signed-off-by: Leanne Ahern <lahern@redhat.com>

* Adding double quotes to all arrays in db_copy script. Reason: Error SC2068

Signed-off-by: Leanne Ahern <lahern@redhat.com>

* Fixing SC2145 errors in prepare-restricted-environment script

Signed-off-by: Leanne Ahern <lahern@redhat.com>

* Fixing SC2206 errors -Quote to prevent word splitting/globbing - in prepare-restricted-environment script

Signed-off-by: Leanne Ahern <lahern@redhat.com>

* Fixing comments to ignore certain warnings. Adjusting code to fix warning - SC2178 and SC2128.

Signed-off-by: Leanne Ahern <lahern@redhat.com>

* Updating db_copy.sh file with necessary changes. Quoting all variables.

Signed-off-by: Leanne Ahern <lahern@redhat.com>

* Running script and making changes to ensure it runs to completion

Signed-off-by: Leanne Ahern <lahern@redhat.com>

* Changing lines to ensure script runs correctly without errors

Signed-off-by: Leanne Ahern <lahern@redhat.com>

* Updating db_copy based on PR feedback

Signed-off-by: Leanne Ahern <lahern@redhat.com>

* Slight changes based on PR feedback

Signed-off-by: Leanne Ahern <lahern@redhat.com>

* Making changes based on suggestions

Signed-off-by: Leanne Ahern <lahern@redhat.com>

* Fixing missed errors and small mistake

Signed-off-by: Leanne Ahern <lahern@redhat.com>

* Update .rhdh/scripts/prepare-restricted-environment.sh

---------

Signed-off-by: Leanne Ahern <lahern@redhat.com>
Co-authored-by: Armel Soro <armel@rm3l.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants