Skip to content

chore: apply shfmt formatting and fix pyright config#701

Open
cv wants to merge 2 commits intoNVIDIA:mainfrom
cv:chore/shfmt-formatting
Open

chore: apply shfmt formatting and fix pyright config#701
cv wants to merge 2 commits intoNVIDIA:mainfrom
cv:chore/shfmt-formatting

Conversation

@cv
Copy link
Contributor

@cv cv commented Mar 23, 2026

Summary

  • shfmt formatting — apply shfmt -i 2 -ci -bn to install.sh, scripts/backup-workspace.sh, and scripts/install-openshell.sh to match the project's pre-commit config
  • Fix SC2206 in version_gte() — use read -ra instead of unquoted word splitting
  • Fix pyright config — drop stray . arg from pyright invocations in Makefile and pre-commit hook (overrides pyproject.toml include/exclude, causing 17k+ errors from scanning .venv), and exclude test_*.py from strict type-checking

Test plan

  • Pre-commit hooks pass (shfmt, shellcheck, pyright)
  • Pre-push hooks pass

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Refactor

    • Standardized shell script formatting and syntax across installation and backup utilities.
    • Simplified type-checking tool invocations for improved consistency.
  • Configuration

    • Configured type checker to exclude test files from analysis.

cv and others added 2 commits March 22, 2026 22:42
Auto-formatted with `shfmt -i 2 -ci -bn` to match the project's
pre-commit configuration. Also fix SC2206 shellcheck warning in
version_gte() by using `read -ra` instead of unquoted word splitting.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Drop stray '.' arg from pyright in Makefile and pre-commit hook
  (overrides pyproject.toml include/exclude, causing it to scan .venv)
- Exclude test_*.py from pyright strict checking (pytest is a dev dep)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 23, 2026

📝 Walkthrough

Walkthrough

Updates to shell script formatting and configuration across multiple build and installation scripts. Changes include standardizing Bash syntax consistency in control-flow statements, removing trailing arguments from pyright invocations, and adding exclusion rules for test files in the pyright configuration.

Changes

Cohort / File(s) Summary
Pyright Configuration
.pre-commit-config.yaml, nemoclaw-blueprint/Makefile
Removed trailing . argument from pyright commands in pre-push hook and build target invocations.
Pyright Exclusion Rules
nemoclaw-blueprint/pyproject.toml
Added tool.pyright exclude entry to omit test files matching test_*.py pattern from type checking.
Shell Script Formatting
install.sh, scripts/backup-workspace.sh, scripts/install-openshell.sh
Standardized Bash syntax formatting, whitespace consistency in arithmetic/conditional statements, function brace placement, and shell redirection operators. Reformatted version_gte() helper and control-flow structures while preserving functional behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A hop through syntax, clean and neat,
Where whitespace dances to Bash's beat,
Pyright now sharpened, tests set free,
Scripts aligned in harmony! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.09% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: formatting scripts with shfmt and fixing pyright configuration as described in the objectives.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/backup-workspace.sh`:
- Around line 83-84: The current pipeline `ts="$(ls -1 "$BACKUP_BASE"
2>/dev/null | sort -r | head -n1)"` can cause the script to exit under set -euo
pipefail if $BACKUP_BASE doesn't exist, so first explicitly check that the
directory exists and is readable (test -d "$BACKUP_BASE") before running the ls
pipeline; if the test fails call the existing fail function with the message "No
backups found in ${BACKUP_BASE}/" or a clearer "Backup directory ${BACKUP_BASE}
does not exist" and only then run the ts assignment (or run a safe glob/read
with find) so that the explicit fail in the check always executes instead of
being short-circuited by errexit when computing ts.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5cc9acbe-7cc0-4b71-aac5-e3867649312d

📥 Commits

Reviewing files that changed from the base of the PR and between c55a309 and de7f5ef.

📒 Files selected for processing (6)
  • .pre-commit-config.yaml
  • install.sh
  • nemoclaw-blueprint/Makefile
  • nemoclaw-blueprint/pyproject.toml
  • scripts/backup-workspace.sh
  • scripts/install-openshell.sh

Comment on lines +83 to +84
ts="$(ls -1 "$BACKUP_BASE" 2>/dev/null | sort -r | head -n1)"
[ -n "$ts" ] || fail "No backups found in ${BACKUP_BASE}/"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Handle missing backup directory without errexit short-circuit

Line 83 can exit the script early under set -euo pipefail if ${BACKUP_BASE} does not exist, so Line 84’s explicit fail message may never run.

Suggested fix
-    ts="$(ls -1 "$BACKUP_BASE" 2>/dev/null | sort -r | head -n1)"
-    [ -n "$ts" ] || fail "No backups found in ${BACKUP_BASE}/"
+    ts="$(
+      find "$BACKUP_BASE" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' 2>/dev/null \
+        | sort -r \
+        | head -n1
+    )"
+    [ -n "$ts" ] || fail "No backups found in ${BACKUP_BASE}/"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/backup-workspace.sh` around lines 83 - 84, The current pipeline
`ts="$(ls -1 "$BACKUP_BASE" 2>/dev/null | sort -r | head -n1)"` can cause the
script to exit under set -euo pipefail if $BACKUP_BASE doesn't exist, so first
explicitly check that the directory exists and is readable (test -d
"$BACKUP_BASE") before running the ls pipeline; if the test fails call the
existing fail function with the message "No backups found in ${BACKUP_BASE}/" or
a clearer "Backup directory ${BACKUP_BASE} does not exist" and only then run the
ts assignment (or run a safe glob/read with find) so that the explicit fail in
the check always executes instead of being short-circuited by errexit when
computing ts.

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