Skip to content

[BE] add SHFMT linter to format shell scripts #157685

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

Open
wants to merge 8 commits into
base: gh/XuehaiPan/356/base
Choose a base branch
from

Conversation

[ghstack-poisoned]
Copy link

pytorch-bot bot commented Jul 7, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/157685

Note: Links to docs will display an error until the docs builds have been completed.

❌ 4 New Failures, 2 Unrelated Failures

As of commit f3965ab with merge base 01f66d0 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@pytorch-bot pytorch-bot bot added ciflow/inductor module: cpu CPU specific problem (e.g., perf, algorithm) module: dynamo release notes: quantization release notes category release notes: releng release notes category labels Jul 7, 2025
XuehaiPan added a commit that referenced this pull request Jul 7, 2025
@facebook-github-bot facebook-github-bot added the module: rocm AMD GPU support for Pytorch label Jul 7, 2025
@XuehaiPan XuehaiPan requested review from malfet and atalman July 7, 2025 02:41
@XuehaiPan XuehaiPan added module: ci Related to continuous integration ciflow/binaries Trigger all binary build and upload jobs on the PR ciflow/trunk Trigger trunk jobs on your pull request module: devx Related to PyTorch contribution experience (HUD, pytorchbot) release notes: devx skip-pr-sanity-checks labels Jul 7, 2025
[ghstack-poisoned]
[ghstack-poisoned]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 7, 2025
@Skylion007
Copy link
Collaborator

Do we have shellcheck enabled? If not, may be a less intrusive check to start with.

@XuehaiPan
Copy link
Collaborator Author

Do we have shellcheck enabled?

No.

[ghstack-poisoned]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 8, 2025
@seemethere
Copy link
Member

Do we have shellcheck enabled?

No.

I actually do believe we have shellcheck enabled, it's just over a smaller subset of things:

pytorch/.lintrunner.toml

Lines 886 to 905 in 86670b3

[[linter]]
code = 'SHELLCHECK'
include_patterns = [
'.ci/pytorch/**/*.sh'
]
exclude_patterns = [
'**/fb/**',
]
command = [
'python3',
'tools/linter/adapters/shellcheck_linter.py',
'--',
'@{{PATHSFILE}}',
]
init_command = [
'python3',
'tools/linter/adapters/pip_init.py',
'--dry-run={{DRYRUN}}',
'shellcheck-py==0.7.2.1',
]

What's the benefit here of shfmt over just enabling shellcheck everywhere else?

@XuehaiPan
Copy link
Collaborator Author

I actually do believe we have shellcheck enabled, it's just over a smaller subset of things:

Thanks for the clarification.

What's the benefit here of shfmt over just enabling shellcheck everywhere else?

It's a formatter to standardize the style for shell scripts and prevent potential merge conflicts like PYFMT for Python code.

FYI, shellcheck --format=diff provides an autofix feature.

XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 9, 2025
[ghstack-poisoned]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 12, 2025
[ghstack-poisoned]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 15, 2025
[ghstack-poisoned]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Jul 21, 2025
[ghstack-poisoned]
XuehaiPan added a commit to XuehaiPan/pytorch that referenced this pull request Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/binaries Trigger all binary build and upload jobs on the PR ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request module: ci Related to continuous integration module: cpu CPU specific problem (e.g., perf, algorithm) module: devx Related to PyTorch contribution experience (HUD, pytorchbot) module: dynamo module: rocm AMD GPU support for Pytorch open source release notes: devx release notes: quantization release notes category release notes: releng release notes category skip-pr-sanity-checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants