Improve support of default editorconfig properties (#1580)

* Improve support of default editorconfig properties

Deprecate ExperimentalParams.editorConfigDefaults in favor of new parameter
ExperimentalParams.editorConfigDefaults. When used in the old implementation
this resulted in ignoring all ".editorconfig" files on the path to the file.
The new implementation uses properties from the "editorConfigDefaults"
parameter only when no ".editorconfig" files on the path to the file supplies
this property for the filepath.
Closes #1551

API consumers can easily create the EditConfigDefaults by calling
 "EditConfigDefaults.load(path)" or creating it programmatically.

The CLI still supports the "--editorconfig=" option but has improved support.
The path given can be either be a path to file or directory. In case of a
directory path, it is expected that the directory does contain a file with
name ".editorconfig". In of a file path, any valid file name is accepted. The
path can be relative or absolute. Depending on the OS, the "~" at the start of
the path is accepted as well.

BaseCLITest no longer always waits 3 seconds for completion of the asynchronous
process. Once the process is started, it checks every 100 ms whether the process
is still alive (e.g. is running) and stops polling otherwise resulting in better
performance (most notable on local machine). The maximum duration of the CLI
test has been increased to 10 seconds.
29 files changed
tree: 2b967004163d616e23c26e7ba325e0a63f92174e
  1. .github/
  2. buildSrc/
  3. docs/
  4. gradle/
  5. ktlint/
  6. ktlint-core/
  7. ktlint-reporter-baseline/
  8. ktlint-reporter-checkstyle/
  9. ktlint-reporter-format/
  10. ktlint-reporter-html/
  11. ktlint-reporter-json/
  12. ktlint-reporter-plain/
  13. ktlint-reporter-sarif/
  14. ktlint-ruleset-experimental/
  15. ktlint-ruleset-standard/
  16. ktlint-ruleset-template/
  17. ktlint-ruleset-test/
  18. ktlint-test/
  19. ktlint-test-logging/
  20. .announce
  21. .editorconfig
  22. .gitattributes
  23. .gitignore
  24. .homebrew
  25. ADOPTERS.md
  26. build.gradle
  27. CHANGELOG.md
  28. CODE_OF_CONDUCT.md
  29. CONTRIBUTING.md
  30. gradle.properties
  31. gradlew
  32. gradlew.bat
  33. jitpack.yml
  34. LICENSE
  35. mkdocs.yml
  36. README.md
  37. RELEASING.md
  38. settings.gradle.kts
README.md

Key features

  • No configuration required
  • Built-in Rule sets
  • Built-in formatter
  • .editorconfig support
  • Several built-in reporters: plain, json, html and checkstyle
  • Executable jar
  • Allows extension with custom rule sets and reporters

Documentation

User guide

Legal

This project is not affiliated with nor endorsed by JetBrains.
All code, unless specified otherwise, is licensed under the MIT license.
Copyright (c) 2019 Pinterest, Inc.
Copyright (c) 2016-2019 Stanley Shyiko.