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

cmd/shfmt: add --apply-ignore flag for tools and editors #1051

Merged
merged 1 commit into from
Feb 10, 2024
Merged

Conversation

mvdan
Copy link
Owner

@mvdan mvdan commented Jan 14, 2024

(see commit message)

Fixes #1037.

The EditorConfig ignore=true property is currently only obeyed
when walking directories, which is fine for command line users
running shfmt like

    shfmt -l -w .

However, many tools and editor integrations use shfmt via stdin
or by passing a single file argument, and in those cases,
the ignore=true logic does not kick in at all.

There should be a way for a user to force running shfmt on a file,
and that has always been passing a file as a direct argument, like:

    shfmt -w file.sh

We can't break that, but tools do need a way to obey ignore rules.
For that reason, add an --apply-ignore flag which does just that.

Fixes #1037.
@mvdan mvdan merged commit 63fac7b into master Feb 10, 2024
16 checks passed
@mvdan mvdan deleted the apply-ignore branch February 10, 2024 10:36
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.

Ignored files not ignored when passed by name
1 participant