GithubHelp home page GithubHelp logo

isabella232 / rewrite-gradle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spring-attic/rewrite-gradle

0.0 0.0 0.0 83 KB

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

License: Apache License 2.0

Kotlin 93.38% Shell 6.62%

rewrite-gradle's Introduction

rewrite-gradle is no longer actively maintained by VMware, Inc.

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");
}

rewrite-gradle's People

Contributors

jkschneider avatar trevormarshall avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.