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

Use shellcheck (via pantsbuild) #5751

Merged
merged 4 commits into from
Oct 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Added

* Begin introducing `pants <https://www.pantsbuild.org/docs>`_ to improve DX (Developer Experience)
working on StackStorm, improve our security posture, and improve CI reliability thanks in part
to pants' use of PEX lockfiles. This is not a user-facing addition. #5713 #5724 #5726 #5725 #5732 #5733 #5737 #5738 #5758
to pants' use of PEX lockfiles. This is not a user-facing addition. #5713 #5724 #5726 #5725 #5732 #5733 #5737 #5738 #5758 #5751
Contributed by @cognifloyd

Changed
Expand Down
4 changes: 4 additions & 0 deletions contrib/core/actions/send_mail/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
shell_source(
source="send_mail",
skip_shellcheck=True,
)
3 changes: 2 additions & 1 deletion contrib/examples/actions/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
python_sources()

shell_sources(
name="actions0",
name="shell",
skip_shellcheck=True,
)
2 changes: 1 addition & 1 deletion contrib/examples/actions/bash_ping/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1 @@
shell_sources()
shell_sources(skip_shellcheck=True)
6 changes: 5 additions & 1 deletion contrib/examples/actions/bash_random/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
shell_sources()
shell_sources(
overrides={
"random2.sh": {"skip_shellcheck": True},
Comment on lines +1 to +3
Copy link
Member Author

@cognifloyd cognifloyd Oct 5, 2022

Choose a reason for hiding this comment

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

This was a very simple way I could show off the overrides feature of pants.
random.sh passes shellcheck, but random2.sh does not. This way we skip running shellcheck on as few files as possible.

},
)
3 changes: 2 additions & 1 deletion contrib/linux/actions/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
python_sources()

shell_sources(
name="actions0",
name="shell",
skip_shellcheck=True,
)
1 change: 1 addition & 0 deletions pants.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ backend_packages = [

# shell
"pants.backend.shell",
"pants.backend.shell.lint.shellcheck",
]
# pants ignores files in .gitignore, .*/ directories, /dist/ directory, and __pycache__.
pants_ignore.add = [
Expand Down
2 changes: 1 addition & 1 deletion scripts/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
python_sources()

shell_sources(
name="scripts0",
name="shell",
)
9 changes: 8 additions & 1 deletion st2actions/bin/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
shell_sources()
python_sources(
sources=["st2*"],
)

shell_sources(
name="shell",
skip_shellcheck=True,
)
3 changes: 3 additions & 0 deletions st2api/bin/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
python_sources(
sources=["st2*"],
)
3 changes: 3 additions & 0 deletions st2auth/bin/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
python_sources(
sources=["st2*"],
)
10 changes: 9 additions & 1 deletion st2common/bin/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
python_sources()
python_sources(
sources=["*.py", "st2*", "!st2ctl", "!st2-self-check", "!st2-run-pack-tests"],
)

shell_sources(
name="shell",
sources=["st2ctl", "st2-self-check", "st2-run-pack-tests"],
Comment on lines +1 to +7
Copy link
Member Author

Choose a reason for hiding this comment

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

Notice how I've got the st2* glob on python_sources.
That would match the files from shell_sources, so we exclude them from matching using !.

skip_shellcheck=True,
)
3 changes: 2 additions & 1 deletion st2common/bin/migrations/v2.1/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
python_sources()

shell_sources(
name="v2.10",
name="shell",
skip_shellcheck=True,
)
2 changes: 2 additions & 0 deletions st2common/bin/migrations/v3.5/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
# TODO: what to do about st2-migrate-db-dict-field-values ?
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this to be resolved in another PR? Just checking this TODO is still relevant.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah. The TODO is still relevant. I'm not sure how best to handle the symlink - so I'm punting. 🤷

# st2_migrate_db_dict_field_values.py is a symlink to st2-migrate-db-dict-field-values
python_sources()
2 changes: 1 addition & 1 deletion st2common/tests/fixtures/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
python_sources()

shell_sources(
name="fixtures0",
name="shell",
)
3 changes: 3 additions & 0 deletions st2reactor/bin/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
python_sources(
sources=["st2*"],
)
3 changes: 3 additions & 0 deletions st2stream/bin/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
python_sources(
sources=["st2*"],
)
5 changes: 4 additions & 1 deletion st2tests/integration/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
shell_sources()
shell_sources(
name="shell",
skip_shellcheck=True,
)
1 change: 1 addition & 0 deletions st2tests/st2tests/fixtures/packs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ resources(

shell_sources(
name="test_content_version_shell",
skip_shellcheck=True,
sources=[
"test_content_version/**/*.sh",
],
Expand Down
2 changes: 1 addition & 1 deletion st2tests/testpacks/errorcheck/actions/BUILD
Original file line number Diff line number Diff line change
@@ -1 +1 @@
shell_sources()
shell_sources(skip_shellcheck=True)
7 changes: 6 additions & 1 deletion tools/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
python_sources()

shell_sources(
name="tools0",
name="shell",
sources=[
"*.sh",
"st2-setup-*",
],
skip_shellcheck=True,
)