Skip to main content

Eliminate unused classes

io.moderne.azul.EliminateUnusedClasses

Deprecate and later delete classes that are unused, as detected by Azul Intelligence Cloud.

Recipe source

This recipe is only available to users of Moderne.

This recipe is available under the Moderne Proprietary License.

Options

TypeNameDescriptionExample
URLazulUrl'Azul Intelligence Cloud endpoint.https://YOUR_ENDPOINT.azul.com
StringazulApiKeyAPI key used to make REST requests to Azul Intelligence Cloud.YOUR-API-KEY
StringmarkDeprecatedAfterOptional. Classes that haven't been used in this duration will be marked deprecated but not yet for removal. Defaults to P4WP4W
StringmarkForRemovalAfterOptional. Classes that haven't been used in this duration will be marked deprecated and for removal. Defaults to P1YP3M
StringremoveAfterOptional. Classes that haven't been used in this duration will be removed. Defaults to P2YP1Y

Usage

This recipe has required configuration parameters and can only be run by users of Moderne. To run this recipe, you will need to provide the Moderne CLI run command with the required options. Or, if you'd like to create a declarative recipe, please see the below example of a rewrite.yml file:

rewrite.yml
---
type: specs.openrewrite.org/v1beta/recipe
name: com.yourorg.EliminateUnusedClassesExample
displayName: Eliminate unused classes example
recipeList:
- io.moderne.azul.EliminateUnusedClasses:
azulUrl: https://YOUR_ENDPOINT.azul.com
azulApiKey: YOUR-API-KEY
markDeprecatedAfter: P4W
markForRemovalAfter: P3M
removeAfter: P1Y

You will need to have configured the Moderne CLI on your machine before you can run the following command.

shell
mod run . --recipe EliminateUnusedClasses --recipe-option "azulUrl=https://YOUR_ENDPOINT.azul.com" --recipe-option "azulApiKey=YOUR-API-KEY" --recipe-option "markDeprecatedAfter=P4W" --recipe-option "markForRemovalAfter=P3M" --recipe-option "removeAfter=P1Y"

If the recipe is not available locally, then you can install it using:

mod config recipes jar install org.openrewrite.recipe:rewrite-azul:0.2.0

See how this recipe works across multiple open-source repositories

Run this recipe on OSS repos at scale with the Moderne SaaS.

The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories.

Please contact Moderne for more information about safely running the recipes on your own codebase in a private SaaS.

Data Tables

Reachable classes

io.moderne.azul.table.ReachableClasses

Classes in a repository's source code that are reachable. This data table does not contain information about reachability in libraries.

Column NameDescription
Class nameThe fully qualified name of the class that is reachable.
Last usedThe date and time when the method was last used.
AppEnvThe 'AppEnv' as defined by Azul Intelligence Cloud.