Skip to main content

DevCenter card from a data table column

io.moderne.devcenter.BucketedMetricCard

Read rows from a previously emitted data table, aggregate a numeric column across all rows for this repository, and bucket the result into ordinal DevCenter measures.

Recipe source

GitHub: BucketedMetricCard.java, Issue Tracker, Maven Central

This recipe is available under the Moderne Source Available License.

Options

TypeNameDescriptionExample
StringinputDataTableThe fully qualified class name of the data table to read rows from. This data table is expected to be populated by another recipe earlier in the same recipe list.io.moderne.organizations.table.ClassCohesion
StringcardNameThe display name of this DevCenter card.Class cohesion (LCOM4)
StringcolumnThe numeric column of the input data table to feed into the aggregation function.lcom4
AggregationFunctionaggregationHow to reduce the column's values across all rows in the repository to a single representative value before bucketing. MIN, MAX, SUM, and AVERAGE operate on numeric values of the column. COUNT returns the number of rows the upstream data table emitted for this repository, regardless of column value. UNIQUE returns the number of distinct non-null values of the column. Matching is case-insensitive. Valid options: MIN, MAX, SUM, AVERAGE, COUNT, UNIQUEAVERAGE
Bucket[]bucketsOrdered list of buckets. Each bucket has a name and an inclusive lower bound moreThan — a value is considered to fall into the bucket when value >= moreThan. When multiple buckets apply, the one with the largest moreThan wins. The list order defines the DevCenter measure ordinal: the first bucket maps to ordinal 0, the last to ordinal size - 1. This lets callers control which end of the scale the visualization renders as "worst" (lowest ordinal) versus "best" (highest ordinal).[{"name": "LOW", "moreThan": 10}, {"name": "MEDIUM", "moreThan": 3}, {"name": "HIGH", "moreThan": 0}]

Used by

This recipe is used as part of the following composite recipes:

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.BucketedMetricCardExample
displayName: DevCenter card from a data table column example
recipeList:
- io.moderne.devcenter.BucketedMetricCard:
inputDataTable: io.moderne.organizations.table.ClassCohesion
cardName: Class cohesion (LCOM4)
column: lcom4
aggregation: AVERAGE
buckets: [{"name": "LOW", "moreThan": 10}, {"name": "MEDIUM", "moreThan": 3}, {"name": "HIGH", "moreThan": 0}]

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

shell
mod run . --recipe BucketedMetricCard --recipe-option "inputDataTable=io.moderne.organizations.table.ClassCohesion" --recipe-option "cardName=Class cohesion (LCOM4)" --recipe-option "column=lcom4" --recipe-option "aggregation=AVERAGE" --recipe-option "buckets=[{"name": "LOW", "moreThan": 10}, {"name": "MEDIUM", "moreThan": 3}, {"name": "HIGH", "moreThan": 0}]"

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

mod config recipes jar install io.moderne.recipe:rewrite-devcenter:1.24.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

Upgrades and migrations

io.moderne.devcenter.table.UpgradesAndMigrations

Progress towards organizational objectives on library or language migrations and upgrades.

Column NameDescription
CardThe display name of the DevCenter card
OrdinalThe ordinal position of this value relative to other values.
ValueThe display value of the current state of this repository.
Minimum versionThe minimum matching version that is currently in use.