IntelOwl icon indicating copy to clipboard operation
IntelOwl copied to clipboard

Add ShellCheck linter

Open mlodic opened this issue 11 months ago • 6 comments

to properly handle and lint shell scripts in IntelOwl https://github.com/koalaman/shellcheck

mlodic avatar Feb 13 '25 16:02 mlodic

Hey @mlodic,

I'd like to work on this issue. After researching how to integrate ShellCheck with IntelOwl, I found that ShellCheck has some limitations—specifically, it does not automatically scan nested directories and only runs on shell scripts in the root directory.

To address this, one approach is to use the following command to recursively find and lint all shell scripts:

find . -type f -name "*.sh" -exec shellcheck {} +

Alternatively, we could implement a wrapper around ShellCheck to enhance its functionality. I came across this Medium article which explores a convenient way to run ShellCheck in GitHub Actions. It might provide useful insights for our implementation.

Looking forward to your thoughts!

pranjalg1331 avatar Feb 24 '25 06:02 pranjalg1331

Yep, you can try to integrate it! I would go with the "medium" article approach because it would allow to select folders and exclusions. In this way, we can select only the folders where the shell scripts are so we don't have to run that find command which can be computationally onerous

mlodic avatar Feb 24 '25 09:02 mlodic

I assign you but remember that you still have to finish the other task! I appreciated your proactive approach!

mlodic avatar Feb 24 '25 09:02 mlodic

Thank you! Also, how should I handle the errors that ShellCheck shows in already-written scripts (there are a lot of them)?

pranjalg1331 avatar Feb 24 '25 14:02 pranjalg1331

ideally fixing that because otherwise it makes no sense to integrate it :P That's the longest part

mlodic avatar Feb 24 '25 16:02 mlodic

This issue has been marked as stale because it has had no activity for 10 days. If you are still working on this, please provide some updates.

github-actions[bot] avatar Mar 07 '25 09:03 github-actions[bot]