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

Misspelled flags in CLI can cause user data loss #465

Closed
grodin opened this issue May 13, 2024 · 1 comment
Closed

Misspelled flags in CLI can cause user data loss #465

grodin opened this issue May 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@grodin
Copy link

grodin commented May 13, 2024

As part of working on #391, I realised that typo'd flags in the CLI don't stop processing. Since ktfmt overwrites files by default, that's pretty dangerous!

E.g.

$ ktfmt --dry-runn SomeFile.kt

will report the unexpected option --dry-runn but will format and overwrite SomeFile.kt anyway!

I thought this was enough of a showstopper to report it separately.

IMO, all unknown flags should be errors, and no processing should take place when they're encountered.

@hick209 hick209 added the bug Something isn't working label May 13, 2024
@hick209
Copy link
Contributor

hick209 commented May 13, 2024

Great catch! This is a bug indeed and should be fixed

grodin pushed a commit to grodin/ktfmt that referenced this issue May 17, 2024
grodin pushed a commit to grodin/ktfmt that referenced this issue May 17, 2024
grodin pushed a commit to grodin/ktfmt that referenced this issue May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants