Refactor AnnotationRule to improve maintainability (#1574)

* Refactor AnnotationRule to improve maintainability

Replace (biggest part of) processing of MODIFIER_LIST and FILE_ANNOTATION_LIST with processing of
individual ANNOTATION_ENTRY. This allows ANNOTATION_ENTRY to be followed by EOL_COMMENT plus
another ANNOTATION_ENTRY.

Reword the violations to be more clear.

Annotation with parameter(s) on same line as annotated construct is rewritten to
annotation on a separate line directly as otherwise a lint violation would remain
after the first format.

Closes #1539 
3 files changed
tree: da8895aedc9aa25b8bed192c725acd5b474be968
  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.