Skip to content

Add linting for shell scripts using shellcheck.#2647

Open
dxapd wants to merge 3 commits into
google:mainfrom
dxapd:shellcheck-impl
Open

Add linting for shell scripts using shellcheck.#2647
dxapd wants to merge 3 commits into
google:mainfrom
dxapd:shellcheck-impl

Conversation

@dxapd

@dxapd dxapd commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

@dxapd dxapd force-pushed the shellcheck-impl branch 4 times, most recently from e460f65 to 4f35a60 Compare June 9, 2026 10:46
@dxapd dxapd force-pushed the shellcheck-impl branch from 4f35a60 to 3427bc9 Compare June 11, 2026 00:05
@dxapd dxapd requested a review from Databean June 11, 2026 01:45
@dxapd dxapd force-pushed the shellcheck-impl branch from 9715054 to bedacfd Compare June 11, 2026 01:45
@dxapd dxapd marked this pull request as ready for review June 11, 2026 01:45
Comment thread base/debian/BUILD.bazel

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's unintuitive to have this BUILD.bazel file outside any bazel repository. Can this be a BUILD.bazel file somewhere in the base/cvd tree with the debian folder symlink in the same directory? Then the BUILD.bazel file can still refer to members inside the debian directory.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For the internal side of this change, consider fake_lint.bzl in cl/865465414. It's worth making the copybara script update in a pending CL internally and making sure it can import this PR before the PR is submitted. Then you can immediately send the copybara script change for review when this PR merges.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

before i do that, how does it work? is there just a different/split version of rules.bzl internally? if I don't make any changes in advance, what would happen during import? would the resulting build just error out encountering the cf_sh_binary in base/debian/BUILD.bazel?

@Databean Databean Jun 11, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The rules.bzl file is mostly shared between the two, but the strategy used for the cf_cc_* targets right now is to define no-op versions of the format_test and clang_tidy_test rules in a different place, and have copybara rewrite the load statements in rules.bzl.

As this PR is written it would find the cf_sh_binary macro, expand it, and then fail to use the shellcheck_test rule. If you want to follow the cf_cc_* strategy, this PR doesn't need to be changed, but there need to be extra internal changes.

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.

2 participants