rewrite-gradle

Gradle plugin that automatically discovers Rewrite refactoring rules and applies them to your codebase

License

License

Categories

Categories

Gradle Build Tools
GroupId

GroupId

io.spring.gradle
ArtifactId

ArtifactId

rewrite-gradle
Last Version

Last Version

0.3.2
Release Date

Release Date

Type

Type

jar
Description

Description

rewrite-gradle
Gradle plugin that automatically discovers Rewrite refactoring rules and applies them to your codebase
Project URL

Project URL

https://github.com/spring-gradle-plugins/rewrite-gradle
Source Code Management

Source Code Management

https://github.com/spring-gradle-plugins/rewrite-gradle.git

Download rewrite-gradle

How to add to project

<!-- https://jarcasting.com/artifacts/io.spring.gradle/rewrite-gradle/ -->
<dependency>
    <groupId>io.spring.gradle</groupId>
    <artifactId>rewrite-gradle</artifactId>
    <version>0.3.2</version>
</dependency>
// https://jarcasting.com/artifacts/io.spring.gradle/rewrite-gradle/
implementation 'io.spring.gradle:rewrite-gradle:0.3.2'
// https://jarcasting.com/artifacts/io.spring.gradle/rewrite-gradle/
implementation ("io.spring.gradle:rewrite-gradle:0.3.2")
'io.spring.gradle:rewrite-gradle:jar:0.3.2'
<dependency org="io.spring.gradle" name="rewrite-gradle" rev="0.3.2">
  <artifact name="rewrite-gradle" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.spring.gradle', module='rewrite-gradle', version='0.3.2')
)
libraryDependencies += "io.spring.gradle" % "rewrite-gradle" % "0.3.2"
[io.spring.gradle/rewrite-gradle "0.3.2"]

Dependencies

runtime (3)

Group / Artifact Type Version
com.netflix.devinsight.rewrite : rewrite-core jar 1.2.0
eu.infomas : annotation-detector jar 3.0.5
org.jetbrains.kotlin : kotlin-stdlib-jre8 jar 1.1.0

Project Modules

There are no modules declared in this project.

Rewrite plugin

Build Status Gitter Apache 2.0

A Gradle plugin that discovers and applies Rewrite refactoring rules to your codebase.

Requirements

  • Gradle 2.x (2.9 or later) or Gradle 3.x. Gradle 2.8 and earlier are not supported.
  • Java 8 or later

Using the plugin

To apply the plugin, see the instructions on the Gradle plugin portal.

The Rewrite plugin scans each source set's classpath for methods marked with @AutoRewrite and applies their contents to the source set.

To generate a report of what should be refactored in your project based on the @AutoRewrite methods found, run:

./gradlew lintSource

To automatically fix your code (preserving all of your beautiful code style), run:

./gradlew fixSourceLint && git diff

It is up to you to check the diff, run tests, and commit the resultant changes!

Creating an @AutoRewrite rule

@AutoRewrite must be placed on a public static method that takes a single Refactor argument. The method may return anything you wish or nothing at all.

Below is an example of a rule:

@AutoRewrite(value = "reactor-mono-flatmap", description = "change flatMap to flatMapMany")
public static void migrateMonoFlatMap(Refactor refactor) {
  // a compilation unit representing the source file we are refactoring
  Tr.CompilationUnit cu = refactor.getOriginal();

  refactor.changeMethodName(cu.findMethodCalls("reactor.core.publisher.Mono flatMap(..)"),
    "flatMapMany");
}
io.spring.gradle

Spring Gradle Plugins

Gradle plugins developed by the Spring team

Versions

Version
0.3.2
0.3.1