Skip to content

Add SC2339: warn about ** when globstar is not enabled - #3588

Open
BangarwaAnish wants to merge 1 commit into
koalaman:masterfrom
BangarwaAnish:sc2339-globstar-not-enabled
Open

BangarwaAnish wants to merge 1 commit into
koalaman:masterfrom
BangarwaAnish:sc2339-globstar-not-enabled

Conversation

@BangarwaAnish

@BangarwaAnish BangarwaAnish commented Oct 22, 2026 •

Copy link
Copy Markdown

Fixes #3542

Summary

Adds ShellCheck warning SC2339 for Bash scripts that use ** without globstar being enabled.

Motivation

Without the globstar shell option, ** does not provide recursive pathname expansion. This warning helps identify cases where a pattern may not behave as intended.

Implementation

  • Detects ** glob patterns when globstar is definitely disabled.
  • Tracks globstar state changes through shopt commands.
  • Accounts for shell execution contexts, including functions, subshells, pipelines, and conditional execution.
  • Avoids warnings when the globstar state is unknown, reducing false positives.

This branch has not been deployed

No deployments
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.

Feature request: warning when globstar seems to be used but not set

1 participant