-
Notifications
You must be signed in to change notification settings - Fork 13
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 linting/static-analysis for shell scripts to CI #80
Comments
We discussed this at the last technical meeting and I'll take a swing at this soon if no one beats me to it. |
It looks like someone has created an action for this here: https://github.com/marketplace/actions/action-shellcheck It would be great if you can add the workflow to run it! |
Thanks for bringing this up, I find shellcheck to be an invaluable tool for managing the inherent risk involved in shell scripts :D |
@EzraBrooks were you intending to take this one or #90 ? |
#90 - my bad, had them all open in tabs and switched to the wrong one. |
Added to next milestone (proposed) humble-2024.04.0 |
Hi team, would you consider pre-commit as part of your workflow? We are using this for ArduPilot development and it helps new contributors run all the linters automatically just before they commit, before it gets to CI. Here is the usage in the README: Feel free to check out that repo, install pre-commit, make some python code changes that ruin formatting (add whitespace) and see how it works locally. You can see here we run an XML formatter: Pre-commit also integrates nicely with Github Actions. There is even support for pre-commit to auto-fix contributions and push a follow up commit. |
The MoveIt team uses pre-commit as well, I'd be open to a contribution of a pre-commit config as a solution to this issue! |
Thanks. Should I open up a discussion or thread to select the set of hooks and configurations? |
I would recommend we start with shellcheck and hadolint, as those both have pre-commit hooks and are already mentioned in this issue and space-ros/docker#82 :) |
@Ryanf55 thanks for the suggestion! I also use pre-commit on several projects and see how it could be valuable here. Also your idea of opening a discussion for the specific settings of these tools makes sense to me. An architectural point that came up during the last release was if these types of checks should be done via GHA directly, how to control dev machine variance, etc. and at the time we were leaning toward integrating it with the containerized build process to reduce requirements for devs and ensure we're "testing like we fly" between local machines and CI. This has been a facet of the the running discussion on build-system rework and I'm interested in integrating a phase for these checks in the new build flow that I'm focused on for this release cycle. I've only used it similar to how you linked in ArduPilot where it's a global install for a single repo, does anyone have thoughts on structuring to cover the whole org without copying config files and GHA jobs between repos? |
Thank you for the feedback.
|
Hello, Would you like me to start a discussion tab to keep this conversation going? I'm happy to contribute an MVP of linting with pre-commit by the April release. |
Yes, please do! |
Discussion: #142 |
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
* Just chmod changes, not a huge diff Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
Signed-off-by: Ryan Friedman <ryanfriedman5410+github@gmail.com>
The Space ROS organization has over 40 shell scripts, but they are currently not subjected to code style or testing requirements so any errors are discovered at the integration level where debugging and attribution is more difficult. For example, the recent space-ros/docker PR 76 fixed space-ros/docker issue 75 by adding common best-practice configuration to the
build.sh
files.I propose adding a shell-focused listing and static analysis pass to CI using shellcheck, an actively developed open source project for detecting common errors in bash/sh scripts.
The text was updated successfully, but these errors were encountered: