Skip to content

chore(scripts): remove useless cat in version detection#479

Open
Olexandr88 wants to merge 1 commit intoinitia-labs:mainfrom
Olexandr88:chore/remove-useless-cat-final
Open

chore(scripts): remove useless cat in version detection#479
Olexandr88 wants to merge 1 commit intoinitia-labs:mainfrom
Olexandr88:chore/remove-useless-cat-final

Conversation

@Olexandr88
Copy link

Replace unnecessary cat usage with direct grep when parsing versions from go.mod

@Olexandr88 Olexandr88 requested a review from a team as a code owner February 24, 2026 13:51
@coderabbitai
Copy link

coderabbitai bot commented Feb 24, 2026

Warning

Rate limit exceeded

@Olexandr88 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 39 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 31fee1f and d25198d.

📒 Files selected for processing (1)
  • scripts/protoc-swagger-gen.sh
📝 Walkthrough

Walkthrough

The script scripts/protoc-swagger-gen.sh updates how version strings are read from go.mod: it replaces cat | grep pipelines with direct grep calls for COSMOS_SDK_VERSION, IBC_VERSION, OPINIT_VERSION, and CONNECT_VERSION, and removes the IBC_RATE_LIMITING_VERSION extraction.

Changes

Cohort / File(s) Summary
Shell script version extraction
scripts/protoc-swagger-gen.sh
Replaced `cat go.mod

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 I hopped through lines of bash and code,
Swapped the cat for grep down the road,
Four versions found with a cleaner song,
One little var skipped along—
The burrow's tidy, the script hums on. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: removing unnecessary cat commands in version detection scripts.
Description check ✅ Passed The description is directly related to the changeset, explaining the optimization of replacing cat with direct grep for version parsing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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

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/protoc-swagger-gen.sh`:
- Around line 16-19: Reintroduce the missing IBC_RATE_LIMITING_VERSION variable
so the clone command that uses it (the clone on Line 25) has a valid ref; add a
line that mirrors the other version lookups, e.g. define
IBC_RATE_LIMITING_VERSION by grepping go.mod for the IBC rate-limiting module
and extracting the version (use the same sed pattern used by
COSMOS_SDK_VERSION/IBC_VERSION/OPINIT_VERSION/CONNECT_VERSION), matching the
module path used in the clone (refer to the IBC_RATE_LIMITING_URL and optional
IBC_RATE_LIMITING_V tokens) so the variable contains the branch/tag string the
clone expects.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between bbfab9e and 9df6690.

📒 Files selected for processing (1)
  • scripts/protoc-swagger-gen.sh

@Olexandr88 Olexandr88 force-pushed the chore/remove-useless-cat-final branch from 9df6690 to 31fee1f Compare February 24, 2026 14:07
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.

♻️ Duplicate comments (1)
scripts/protoc-swagger-gen.sh (1)

16-19: ⚠️ Potential issue | 🔴 Critical

IBC_RATE_LIMITING_VERSION is still absent — Line 25 will break at runtime.

The cat → grep simplification for the four other versions is correct. However, the removal of the IBC_RATE_LIMITING_VERSION extraction leaves the variable undefined. Because set -u is not in effect the script won't exit immediately, but the variable expands to an empty string, making the clone on Line 25:

git clone -b modules/rate-limiting/ https://github.com/cosmos/ibc-apps ibc-rate-limiting

That branch ref is invalid and the git clone will fail with "Remote branch not found".

🛠️ Proposed fix — restore the definition with the cleaner grep form
 COSMOS_SDK_VERSION=$(grep "$COSMOS_URL v" ./go.mod | sed -n -e "s/^.* //p")
 IBC_VERSION=$(grep "$IBC_URL/$IBC_V v" ./go.mod | sed -n -e "s/^.* //p")
+IBC_RATE_LIMITING_VERSION=$(grep "$IBC_RATE_LIMITING_URL/$IBC_V v" ./go.mod | sed -n -e "s/^.* //p")
 OPINIT_VERSION=$(grep "$OPINIT_URL v" ./go.mod | sed -n -e "s/^.* //p")
 CONNECT_VERSION=$(grep "$CONNECT_URL/$CONNECT_V v" ./go.mod | sed -n -e "s/^.* //p")

Run the following to confirm the variable is nowhere else in the script:

#!/bin/bash
grep -n "IBC_RATE_LIMITING_VERSION" scripts/protoc-swagger-gen.sh
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/protoc-swagger-gen.sh` around lines 16 - 19, The script removed the
IBC_RATE_LIMITING_VERSION variable which causes the git clone on the
rate-limiting branch to fail; restore IBC_RATE_LIMITING_VERSION using the same
grep/sed pattern as the other version vars (e.g., mirror the
COSMOS_SDK_VERSION/IBC_VERSION lines) so the variable is populated before the
git clone; update the variable name IBC_RATE_LIMITING_VERSION in the top
extraction block where COSMOS_SDK_VERSION, IBC_VERSION, OPINIT_VERSION, and
CONNECT_VERSION are defined to match the previous behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@scripts/protoc-swagger-gen.sh`:
- Around line 16-19: The script removed the IBC_RATE_LIMITING_VERSION variable
which causes the git clone on the rate-limiting branch to fail; restore
IBC_RATE_LIMITING_VERSION using the same grep/sed pattern as the other version
vars (e.g., mirror the COSMOS_SDK_VERSION/IBC_VERSION lines) so the variable is
populated before the git clone; update the variable name
IBC_RATE_LIMITING_VERSION in the top extraction block where COSMOS_SDK_VERSION,
IBC_VERSION, OPINIT_VERSION, and CONNECT_VERSION are defined to match the
previous behavior.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to data retention organization setting

📥 Commits

Reviewing files that changed from the base of the PR and between 9df6690 and 31fee1f.

📒 Files selected for processing (1)
  • scripts/protoc-swagger-gen.sh

Signed-off-by: Olexandr88 <radole1203@gmail.com>
@Olexandr88 Olexandr88 force-pushed the chore/remove-useless-cat-final branch from 31fee1f to d25198d Compare February 24, 2026 14:16
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