spotless icon indicating copy to clipboard operation
spotless copied to clipboard

[Feature] Support editorconfig

Open xenoterracide opened this issue 5 years ago • 15 comments
trafficstars

Support https://editorconfig.org

instead of this

spotless {
  // optional: limit format enforcement to just the files changed by this feature branch
  ratchetFrom 'origin/main'

  format 'misc', {
    // define the files to apply `misc` to
    target '*.gradle', '*.md', '.gitignore'

    // define the steps to apply to those files
    trimTrailingWhitespace()
    indentWithTabs() // or spaces. Takes an integer argument if you don't like 4
    endWithNewline()
}

you could simply do

spotless {
  editorConfig()
}

which would simply figure out all the same information, and also presumably pass it to other things like

spotless {
   java {
}

would inherit it.

possibly code or coordination of a general library for editor config in java here.

https://github.com/ec4j/editorconfig-gradle-plugin

xenoterracide avatar Nov 14 '20 12:11 xenoterracide

Partial dupe of #142, but each issue is unique enough to stand on its own.

nedtwigg avatar Nov 16 '20 01:11 nedtwigg

I would like to see this. My use case is using the official Android XML format, and should be easy to just export the editorconfig from IntelliJ and that Spotless read it to know how to sort the xml fields for example.

JavierSegoviaCordoba avatar Mar 06 '21 12:03 JavierSegoviaCordoba

That would be really convinient to have such thing in spotless. .editorconfig is widely spread amoung Java community, which uses Intellij Idea Basically, it's placed in the root of the project

I would be great if you add this support for Maven and Gradle :)

andriewski avatar Apr 03 '22 11:04 andriewski

Need this for using .editorconfig for all file types (*.yml, *.sh, etc.)

archongum avatar Aug 03 '23 06:08 archongum

This would really solve a lot of headaches for our team's overall formatting style as we rely on .editorconfig. Would be nice to see an update coming supporting this.

sharath2106 avatar Sep 07 '23 07:09 sharath2106

Need this feature to solve all the headache we've due to different formatting style used in .editorconfig and spotless. Please add support for this.

sonus21 avatar Dec 01 '23 11:12 sonus21

+1 for this feature!

derekobrien27 avatar Apr 01 '24 21:04 derekobrien27