Skip to content
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

add shellcheck workflow #1147

Merged
merged 6 commits into from
May 12, 2024
Merged

Conversation

hkarani
Copy link
Contributor

@hkarani hkarani commented May 5, 2024

Description

closes #1143

Screenshots

Additional Context

Checklist

Are your changes backwards compatible? Please answer below:

Did you QA this? Could we deploy this straight to production? Please answer below:

For frontend changes: Tested on mobile? Please answer below:

Did you introduce any new environment variables? If so, call them out explicitly here:

Copy link
Contributor

coderabbitai bot commented May 5, 2024

Walkthrough

The new .github/workflows/shell-check.yml GitHub Actions workflow automates the ShellCheck tool's execution on shell scripts in the sndev directory for POSIX compliance. It leverages the ludeeus/action-shellcheck action within the ubuntu-latest environment.

Changes

File Path Change Summary
.github/workflows/shell-check.yml Introduced a GitHub Actions workflow to run ShellCheck on shell scripts in the sndev directory.
.gitignore Excluded scripts/nwc-keys.json related to "nostr wallet connect."
components/image.js Added MEDIA_DOMAIN_REGEXP, renamed function to TrustedImage, updated state variable, and component replacement.
lib/url.js Added MEDIA_DOMAIN_REGEXP regex matching NEXT_PUBLIC_MEDIA_DOMAIN URLs.
pages/settings/wallets/cln.js Changed enabled prop to status in the WalletButtonBar.
pages/settings/wallets/lightning-address.js Changed enabled prop to status in the WalletButtonBar.
scripts/nwc Added a Bash script for setting up and running nostr-wallet-connect-lnd.

Assessment against linked issues

Objective Addressed Explanation
Add GitHub action to shellcheck sndev (#1143)
Ensure the shell scripts in /sndev are POSIX compliant (#1143) POSIX compliance is implied but not explicitly verified in the workflow configuration.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

Documentation and Community

  • 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.

@benalleng
Copy link
Contributor

benalleng commented May 5, 2024

Nice!
got a question about how we can fix the shellcheck failures

./sndev:42:16: note: Double quote to prevent globbing and word splitting. [SC2086]
./sndev:53:16: note: Double quote to prevent globbing and word splitting. [SC2086]
./sndev:64:16: note: Double quote to prevent globbing and word splitting. [SC2086]

for these three they are all pointing to this repeated code block

docker__sn_lnd() {
  t=$1
  if [ "$t" = "-t" ]; then
    shift
  else
    t=""
  fi

  docker__exec $t -u lnd sn_lnd lncli "$@"
}

but i can't immediately see where there isn't a double quote
missed the fact that $t itself had no quotes at all
docker__exec "$t" -u lnd sn_lnd lncli "$@"
same case for those quotation errors on 120, 122, 124

@hkarani
Copy link
Contributor Author

hkarani commented May 6, 2024

Yeah I also got caught by this when I tried to do a test fix. Can ./sndev pass all the tests after the fixes?

@benalleng
Copy link
Contributor

Go ahead and push up the changes recommended by the tests and we'll see!

@huumn
Copy link
Member

huumn commented May 6, 2024

I think we want to ignore shellcheck warnings, ie this workflow should only "fail" when shellcheck reports an error.

Some of the warnings are not real issues and fixing them leads to problems.

@hkarani
Copy link
Contributor Author

hkarani commented May 7, 2024

Shellcheck now only fails with error severity

@huumn huumn merged commit 0c7ff80 into stackernews:master May 12, 2024
6 checks passed
@huumn
Copy link
Member

huumn commented May 15, 2024

@hkarani do you have a lightning address I can send the award to?

@hkarani
Copy link
Contributor Author

hkarani commented May 15, 2024

@huumn my stackernews username https://stacker.news/asterisk32

lnbc200u1pnyfl8zpp5qfxqg3fy7e9t087eh94qgz4qpzh97djdpkvmdkryd80tfrrmkhwqdpcge6kuerfdenjqsrpwd6x2unfwd4nxv3qdahzqum5v93kketj9ehx2amncqzzsxqrrsssp5vk25dhfj30scv60vuqtp8cusdpl0gl4lr6hjlm5aj22vm9rs3njs9qyyssq4yg27eutep99qdmnzx9kvtftw5qk6ehm94pal2th22qvk6vzvk75zt898fmc4exttr5pvhh99pfjmlhu8epg3vqadzptk9stdqmseuqpykm88q

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.

Add github action to shellcheck sndev
3 participants