The Wayback Machine - https://web.archive.org/web/20220414174040/https://github.com/go-task/task/issues/701
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

Linting of commands #701

Open
orenmazor opened this issue Apr 14, 2022 · 1 comment
Open

Linting of commands #701

orenmazor opened this issue Apr 14, 2022 · 1 comment

Comments

@orenmazor
Copy link

@orenmazor orenmazor commented Apr 14, 2022

So this is not fully fleshed out in my head yet.

The gist is as such: my team currently uses makefiles + shell scripts to do things. this is obviously messy and awful.

I've done a few PoCs to migrate those things into taskfile and it's a beautiful world.

but here's the rub: we use shellcheck in all of our CI/vim/local machines/etc to verify shell scripts for various code smells.

I'd love to figure out a way to do this in taskfile, but I haven't used this tool enough yet to figure out how to do it.

I can think of a few hacky ways to do it. for example: task --shell -t mytaskfile.yaml mytask and it dumps that task as a mini-shell script. I can then pipe that to shellcheck.

or even better, build shellcheck into task: task --lint -t mytaskfile.yaml mytask and it would run each command through shellcheck.

the goal isn't to verify anything or do any complex stuff. the goal is to catch weird little typos or bad commands or other basic tripwire features.

@andreynering
Copy link
Member

@andreynering andreynering commented Apr 14, 2022

Hi @orenmazor,

You seem to work for 1Password? I use that for both work and personal use and love the tool. 🙂


Interesting idea, indeed. I'd say it's a bit unconventional for Task to have official integrations with external tools, although integrations with watchman and Docker were discussed in the past. Go stuff usually try to be self-contained when possible.

For this reason, it'd make more sense to try to do that with mvdan/sh given we already use it for actually running stuff. The problem is, it only contains a formatter, and not a linter AFAIK.

To allow shellcheck use it'd make more sense to have a flag to output the bash so it can be manually redirected to shellcheck (or something else), as you suggested. This is probably relatively simple, and pull requests would be welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment