You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generate plugin reference docs and deploy via GitHub Pages (#436)
Extend DocumentationSyncTest to generate a Markdown reference page from
RewriteExtension Javadoc and task descriptions. Configure the Javadoc task
for full API docs, and add a GitHub Pages workflow to publish both.
Automatically eliminate technical debt. Apply OpenRewrite recipes to refactor, migrate, and fix source code across Java, Kotlin, Gradle, XML, YAML, properties, and more.
4
+
5
+
## Tasks
6
+
7
+
### `rewriteRun`
8
+
9
+
Apply the active refactoring recipes. Source files will be modified in place.
10
+
11
+
### `rewriteDryRun`
12
+
13
+
Run the active refactoring recipes, producing a patch file. No source files will be changed.
14
+
15
+
### `rewriteDiscover`
16
+
17
+
Lists all available recipes, their visitors, and active recipes configured in the rewrite DSL or rewrite.yml
18
+
19
+
## Configuration
20
+
21
+
The plugin is configured via the `rewrite` DSL block in your `build.gradle` or `build.gradle.kts`:
|`activeRecipes`|`List<String>`| Empty list | Fully qualified class names of recipes to activate. Recipes will only run when explicitly activated here or in a rewrite.yml file. |
35
+
|`activeStyles`|`List<String>`| Empty list | Fully qualified class names of styles to activate. Styles will only be applied when explicitly activated here or in a rewrite.yml file. |
36
+
|`configFile`|`File`|`rewrite.yml`| Path to the OpenRewrite YAML configuration file. Defaults to `rewrite.yml` in the project directory. |
37
+
|`checkstyleConfigFile`|`File`|`null`| Optional path to a Checkstyle configuration file. When set, OpenRewrite will use it to inform Java code style decisions. If not set explicitly, the plugin will attempt to auto-detect a Checkstyle configuration from the Checkstyle Gradle plugin. |
38
+
|`enableExperimentalGradleBuildScriptParsing`|`boolean`|`true`| Whether to parse Gradle build scripts (`build.gradle`) as part of the source set. Defaults to `true`. |
39
+
|`exportDatatables`|`boolean`|`false`| Whether to export data tables to `<build directory>/reports/rewrite/datatables/<timestamp>`. Defaults to `false`. |
40
+
|`exclusions`|`List<String>`| Empty list | Glob patterns for files to exclude from processing. For example: `"src/generated/**"`. |
41
+
|`plainTextMasks`|`List<String>`| Empty list | Glob patterns for files that should be parsed as plain text. Defaults to a comprehensive list including `**/*.md`, `**/*.sql`, `**/*.txt`, and others. Exclusions take precedence over plain text masks. |
42
+
|`sizeThresholdMb`|`int`|`10`| Maximum file size in megabytes. Source files larger than this threshold are skipped during parsing. Defaults to `10`. |
43
+
|`rewriteVersion`|`String`|`null`| Override the version of rewrite core libraries to be used. When `null`, the version bundled with the plugin is used. |
44
+
|`logCompilationWarningsAndErrors`|`boolean`|`false`| Whether to log Java compilation warnings and errors encountered during parsing. Defaults to `false`. |
45
+
|`failOnInvalidActiveRecipes`|`boolean`|`false`| Whether to throw an exception if an activeRecipe fails configuration validation. This may happen if the activeRecipe is improperly configured, or any downstream recipes are improperly configured. For the time, this default is "false" to prevent one improperly configured recipe from failing the build. In the future, this default may be changed to "true" to be more restrictive. |
46
+
|`failOnDryRunResults`|`boolean`|`false`| Whether `rewriteDryRun` should fail the build when it detects that changes would be made. Useful in CI to enforce that all recipes have already been applied. Defaults to `false`. |
47
+
|`throwOnParseFailures`|`boolean`|`false`| Whether to throw an exception when source file parsing fails. Can also be enabled via the project property `-Prewrite.throwOnParseFailures`. Defaults to `false`. |
48
+
49
+
## Javadoc
50
+
51
+
Full API documentation is available in the [Javadoc](apidocs/index.html).
// Match Javadoc comment followed by optional annotations and a field declaration.
130
+
// The Javadoc must start at the beginning of a line (after optional whitespace).
131
+
val javadocFieldPattern =Regex("""(?m)^\s*/\*\*\n((?:\s*\*.*\n)*?)\s*\*/\n(?:\s*@\w+(?:\(.*?\))?\s*\n)*\s*(?:private|public|protected)\s+([\w<>,\s]+?)\s+(\w+)\s*([;=].*)""")
132
+
133
+
for (match in javadocFieldPattern.findAll(extensionSource)) {
0 commit comments