Skip to content

ci: fix shellcheck warnings #575

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 12, 2025
Merged

ci: fix shellcheck warnings #575

merged 2 commits into from
Aug 12, 2025

Conversation

evansims
Copy link
Member

@evansims evansims commented Aug 5, 2025

Description

Fixed errors in scripts/setup_new_sdk.sh that were causing the shellcheck CI pipeline to fail. Removed incorrect command substitution syntax $() from git and file operation commands, and removed unnecessary shellcheck disable comments that were masking the syntax issues.

The script was incorrectly using command substitution $(command) for commands whose output was being redirected to /dev/null. This triggered warnings SC2327 and SC2328 because:

  1. The command substitution captures output, but the output was redirected away
  2. This results in an empty substitution, making the $() wrapper pointless

The fix simply executes the commands directly without the substitution wrapper, maintaining the same functionality while passing shellcheck validation.

References

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

Summary by CodeRabbit

  • Chores
    • Improved reliability and clarity of the setup script for initializing new SDKs. No changes to user-facing features.

Copy link
Contributor

coderabbitai bot commented Aug 5, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The script scripts/setup_new_sdk.sh was updated to remove unnecessary command substitutions. Commands previously executed within $() are now run directly, and their exit statuses are checked explicitly. Related shellcheck disable comments were also removed, streamlining the script's execution and logic.

Changes

Cohort / File(s) Change Summary
Shell Script Command Execution Cleanup
scripts/setup_new_sdk.sh
Removed unnecessary command substitutions, replaced with direct command execution and exit status checks; eliminated related shellcheck disable comments.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci/fix-shellcheck

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@evansims evansims marked this pull request as ready for review August 5, 2025 05:54
@evansims evansims requested a review from a team as a code owner August 5, 2025 05:54
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
scripts/setup_new_sdk.sh (1)

1-2: Harden the script with set -euo pipefail

Consider adding strict-mode flags right after the she-bang to surface errors early and avoid silent mis-behaviour:

#!/usr/bin/env bash
set -euo pipefail

This will automatically halt the script on the first non-zero exit code, making the manual && chains largely unnecessary.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 69978f0 and 08dbcaa.

📒 Files selected for processing (1)
  • scripts/setup_new_sdk.sh (2 hunks)

Siddhant-K-code
Siddhant-K-code previously approved these changes Aug 6, 2025
Copy link
Member

@Siddhant-K-code Siddhant-K-code left a comment

Choose a reason for hiding this comment

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

Looks better!

@rhamzeh
Copy link
Member

rhamzeh commented Aug 11, 2025

@evansims can you take a look at the suggestions identified by coderabbit? They seem sensible

@Siddhant-K-code
Copy link
Member

Siddhant-K-code commented Aug 11, 2025

We might need to fix it fast as the failing tests (Spellchecks) are blocking the merge queue

@evansims
Copy link
Member Author

I let Coderabbit and Claude take the wheel with a few iteration passes; it looked like they came up with solid improvements. I tested it here locally, and everything works well.

@rhamzeh rhamzeh added this pull request to the merge queue Aug 12, 2025
Merged via the queue into main with commit fadd174 Aug 12, 2025
19 checks passed
@rhamzeh rhamzeh deleted the ci/fix-shellcheck branch August 12, 2025 05:11
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.

3 participants