Skip to content

Add shellcheck_toolchain rule#48

Open
UebelAndre wants to merge 3 commits intoaignas:mainfrom
UebelAndre:aspect
Open

Add shellcheck_toolchain rule#48
UebelAndre wants to merge 3 commits intoaignas:mainfrom
UebelAndre:aspect

Conversation

@UebelAndre
Copy link
Contributor

@UebelAndre UebelAndre commented Feb 21, 2026

This allows for users to provide custom shellcheck binaries to power the shellcheck rules.

Additionally, this adds support for .shellcheckrc files via --@rules_shellcheck//shellcheck:rc=<label_of_file>

closes #24

@UebelAndre UebelAndre marked this pull request as ready for review February 21, 2026 16:50
@UebelAndre
Copy link
Contributor Author

@aignas this also fixes the release workflow to not trigger on any push to main. That was a misunderstanding on my part from #47

@UebelAndre
Copy link
Contributor Author

It'd also be awesome if you could cut a release after this PR 🙏

@UebelAndre
Copy link
Contributor Author

@aignas friendly ping here 🙏

Copy link
Owner

@aignas aignas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for all of the contributions.

)

toolchain = ctx.toolchains[TOOLCHAIN_TYPE]
executable = ctx.actions.declare_file("{}{}".format(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, I would like windows addition to be a separate PR, but it is OK this time.

Comment on lines +124 to +137
alias(
name = "shellcheck",
actual = "shellcheck.exe",
)

alias(
name = "{name}",
actual = "shellcheck.exe",
)

shellcheck_toolchain(
name = "toolchain",
shellcheck = ":shellcheck",
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit it would be nice to have a single macro here. That we if we update the macro implementation (e.g. change the alias), then we don't need to refetch everything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean by "single macro". Can you expand?

Comment on lines +129 to +132
alias(
name = "{name}",
actual = "shellcheck.exe",
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please explain why we have an extra alias here instead of just {name} and no shellcheck?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want the consistency of being able to refer to a :shellcheck target but for convenience it's nice to be able to just refer to @repo_name without needing to specify target so I have an alias for both.


on: # yamllint disable rule:truthy
push:
branches:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our CI we are not testing Windows at the moment, but we are adding Windows support in here, shall we add it to our build matrix here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This improves windows support but I didn't add full windows support. That would require a much larger dump of batch to account for runfiles manifests in tests. I can add that to this PR if you want but already felt like it was ballooning quickly. Just let me know

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.

Support specifying .shellcheckrc via a flag

2 participants