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

--editorconfig does not work with --stdin #869

Closed
lwuk opened this issue Aug 27, 2020 · 1 comment · Fixed by #890
Closed

--editorconfig does not work with --stdin #869

lwuk opened this issue Aug 27, 2020 · 1 comment · Fixed by #890
Assignees
Labels
Milestone

Comments

@lwuk
Copy link

lwuk commented Aug 27, 2020

Expected Behavior

The .editorconfig file passed to --editorconfig should have its configuration used by ktlint.

Observed Behavior

--editorconfig argument's configuration is not used when --stdin option is used.

Steps to Reproduce

Make a kotlin file at ~/src/SomeKotlinFile.kt and an editor config at ~/config/.editorconfig.

cat <path-to-home>/src/SomeKotlinFile.kt | ktlint --stdin --editorconfig=<path-to-home>/config/.editorconfig won't use the config's options, while ktlint <path-to-home> --editorconfig=<path-to-home>/config/.editorconfig will.

It will use an .editorconfig in the current directory instead, so the config will be taken into account if ~/config/ is the working directory.

Your Environment

  • Version of ktlint used: 0.38.1
  • Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): command line
@Tapchicoma
Copy link
Collaborator

Yes, usage of --stdin overrides --editorconfig option. Workaround would be:

cd ~/config/ && cat ~/src/SomeKotlinFile.kt | ktlint --stdin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants