Editorconfig: How to autofix all files in a project
There is eclint (and a fork called editorconfig-tools). Run
eclint check 'src/**/*'
to check all files in the src
directory, or
eclint fix 'src/**/*'
to fix them. But please note that the tool can produce some surprises when it comes to indentation! The author of the tool says in a GitHub comment that he has stopped using the tool himself in favour of language-specific linters:
To me, EditorConfig is all about – would you believe it – configuring your editor and nothing more. I don't think it should be responsible for linting or fixing, as there are language-specific tools to accomplish those goals (e.g., ESLint for JavaScript). The only way you can reliably lint or fix indentation is to be aware of the language in question and EditorConfig is language agnostic.
Also, if you use Gradle, Maven or Ant there are tools:
- Gradle: https://plugins.gradle.org/plugin/org.ec4j.editorconfig
To check files
./gradlew editorconfigCheck
To try to fix them automatically
./gradlew editorconfigFormat
Maven: https://mvnrepository.com/artifact/org.ec4j.maven/editorconfig-maven-plugin - https://github.com/ec4j/editorconfig-maven-plugin
Ant: https://github.com/ec4j/editorconfig-ant-tasks