From f9910160c7729c11e91f6ba967f30a24eff7fd37 Mon Sep 17 00:00:00 2001 From: Stephan Schroevers Date: Sat, 28 Apr 2018 19:34:04 +0200 Subject: [PATCH] WIP: Generate documentation (Manual run with `mvn exec:java@generate-bugpattern-docs -pl refaster-runner`.) TODO: Actually hook this up in a website --- error-prone-contrib/pom.xml | 6 ++++ pom.xml | 36 +++++++++++++++++++ .../src/main/docs/bugpattern/Refaster.md | 16 +++++++++ 3 files changed, 58 insertions(+) create mode 100644 refaster-runner/src/main/docs/bugpattern/Refaster.md diff --git a/error-prone-contrib/pom.xml b/error-prone-contrib/pom.xml index 44e6a451..3420b7d9 100644 --- a/error-prone-contrib/pom.xml +++ b/error-prone-contrib/pom.xml @@ -242,5 +242,11 @@ + + + org.codehaus.mojo + exec-maven-plugin + + diff --git a/pom.xml b/pom.xml index c9cb944a..ed2d5d4e 100644 --- a/pom.xml +++ b/pom.xml @@ -810,6 +810,11 @@ error_prone_core ${version.error-prone} + + ${groupId.error-prone} + error_prone_docgen_processor + ${version.error-prone} + com.google.auto.value auto-value @@ -1089,6 +1094,37 @@ build-helper-maven-plugin 3.3.0 + + org.codehaus.mojo + exec-maven-plugin + 3.0.0 + + com.google.errorprone.DocGenTool + + -bug_patterns=${project.build.directory}/generated-sources/annotations/bugPatterns.txt + -docs_repository=${project.build.directory}/generated-wiki/ + -explanations=${basedir}/src/main/docs/bugpattern/ + -target=external + + true + + + + com.google.errorprone + error_prone_docgen + ${version.error-prone} + + + + + generate-bugpattern-docs + + java + + process-classes + + + org.codehaus.mojo license-maven-plugin diff --git a/refaster-runner/src/main/docs/bugpattern/Refaster.md b/refaster-runner/src/main/docs/bugpattern/Refaster.md new file mode 100644 index 00000000..de6e3ceb --- /dev/null +++ b/refaster-runner/src/main/docs/bugpattern/Refaster.md @@ -0,0 +1,16 @@ +Error Prone's out-of-the-box support for the application of +[Refaster][refaster] templates is somewhat cumbersome. Additionally, by default +the focus of Refaster templates is on one-off code refactorings. + +This plugin attempts to bring Refaster templates on equal footing with other +Error Prone plugins by locating all Refaster templates on the classpath and +reporing any match. The suggested changes can be applied using Error Prone's +built-in [patch][patching] functionality. + +XXX: Expand documentation. Mention: +- The `refaster-resource-compiler`. +- How checks can be restricted using the `NamePattern` flag (see the Javadoc) +- An concrete patching example, with and without `NamePattern`. + +[refaster]: https://errorprone.info/docs/refaster +[patching]: https://errorprone.info/docs/patching