From 298ab7f63a2ba7dbc14cddf7bd3e5a3de457fa74 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 9 Mar 2026 17:40:04 +0100 Subject: [PATCH 1/6] OpenRewrite v8.75.2 diff --git c/docs/changelog/8-75-2-Release.md i/docs/changelog/8-75-2-Release.md new file mode 100644 index 0000000000..e687c8e57a --- /dev/null +++ i/docs/changelog/8-75-2-Release.md @@ -0,0 +1,82 @@ +--- +description: What's changed in OpenRewrite version 8.75.2. +--- + +# 8.75.2 release (2026-03-09) + +_Total recipe count: 4202_ + +:::info +This changelog only shows what recipes have been added, removed, or changed. OpenRewrite may do releases that do not include these types of changes. To see these changes, please go to the [releases page](https://github.com/openrewrite/rewrite/releases). +::: + +## Corresponding CLI version + +* Stable CLI version `v3.57.12` +* Staging CLI version: `v3.57.14` + +## Removed Artifacts + +* rewrite-csharp + +## New Recipes + +* [org.openrewrite.gitlab.AddArtifactsExpireIn](https://docs.openrewrite.org/recipes/gitlab/addartifactsexpirein): Set `artifacts:expire_in` in `.gitlab-ci.yml` to prevent storage bloat from indefinitely stored artifacts. +* [org.openrewrite.gitlab.AddCache](https://docs.openrewrite.org/recipes/gitlab/addcache): Add `cache` configuration to `.gitlab-ci.yml` for faster builds. +* [org.openrewrite.gitlab.AddDefaultKeyword](https://docs.openrewrite.org/recipes/gitlab/adddefaultkeyword): Add or update a keyword in the `default` section of `.gitlab-ci.yml`. +* [org.openrewrite.gitlab.AddInterruptible](https://docs.openrewrite.org/recipes/gitlab/addinterruptible): Set `interruptible: true` in `.gitlab-ci.yml` to allow pipelines to be cancelled when superseded. +* [org.openrewrite.gitlab.AddRetry](https://docs.openrewrite.org/recipes/gitlab/addretry): Add `retry` configuration to `.gitlab-ci.yml` for resilience against infrastructure failures. +* [org.openrewrite.gitlab.AddTimeout](https://docs.openrewrite.org/recipes/gitlab/addtimeout): Set `timeout` in `.gitlab-ci.yml` to prevent jobs from hanging indefinitely. +* [org.openrewrite.gitlab.AddWorkflowRules](https://docs.openrewrite.org/recipes/gitlab/addworkflowrules): Add `workflow:rules` to `.gitlab-ci.yml` to control pipeline creation. +* [org.openrewrite.gitlab.BestPractices](https://docs.openrewrite.org/recipes/gitlab/bestpractices): Apply GitLab CI/CD best practices to `.gitlab-ci.yml`. This includes adding `workflow:rules` to prevent duplicate pipelines, setting `interruptible: true` and `retry` in the `default` section, configuring `artifacts:expire_in`, and setting a job `timeout`. +* [org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging](https://docs.openrewrite.org/recipes/java/logging/slf4j/messageformattoparameterizedlogging): Replace `MessageFormat.format()` calls in SLF4J logging statements with parameterized placeholders for improved performance. +* [org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards](https://docs.openrewrite.org/recipes/java/logging/slf4j/removeunnecessaryloglevelguards): Remove `if` statement guards around SLF4J logging calls when parameterized logging makes them unnecessary. +* [org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging](https://docs.openrewrite.org/recipes/java/logging/slf4j/stringformattoparameterizedlogging): Replace `String.format()` calls in SLF4J logging statements with parameterized placeholders for improved performance. +* [org.openrewrite.java.migrate.lombok.UseAllArgsConstructor](https://docs.openrewrite.org/recipes/java/migrate/lombok/useallargsconstructor): Prefer the Lombok `@AllArgsConstructor` annotation over explicitly written out constructors that assign all non-static fields. +* [org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor](https://docs.openrewrite.org/recipes/java/migrate/lombok/userequiredargsconstructor): Prefer the Lombok `@RequiredArgsConstructor` annotation over explicitly written out constructors that only assign final fields. +* [org.openrewrite.java.spring.boot4.RenameDeprecatedStartersManagedVersions](https://docs.openrewrite.org/recipes/java/spring/boot4/renamedeprecatedstartersmanagedversions): Renames deprecated Spring Boot starters to their new names without adding explicit versions, for use in projects where the `io.spring.dependency-management` plugin manages versions via BOM. +* [org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener](https://docs.openrewrite.org/recipes/java/testing/mockito/replacemockitotestexecutionlistener): Replace `@TestExecutionListeners(MockitoTestExecutionListener.class)` with the appropriate Mockito initialization for the test framework in use: `@ExtendWith(MockitoExtension.class)` for JUnit 5, `@RunWith(MockitoJUnitRunner.class)` for JUnit 4, or `MockitoAnnotations.openMocks(this)` for TestNG. +* [org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies](https://docs.openrewrite.org/recipes/java/testing/mockito/replacepowermockdependencies): Replaces PowerMock API dependencies with `mockito-inline` when `mockStatic()`, `whenNew()`, or `@PrepareForTest` usage is detected, or `mockito-core` otherwise. PowerMock features like static mocking, constructor mocking, and final class mocking require the inline mock maker which is bundled in `mockito-inline` for Mockito 3.x/4.x. + +## Removed Recipes + +* **org.openrewrite.javascript.change-import**: Changes an import from one module/member to another, updating all type attributions. +* **org.openrewrite.javascript.cleanup.add-parse-int-radix**: Adds the radix parameter (base 10) to `parseInt()` calls that are missing it, preventing potential parsing issues. +* **org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method**: Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. +* **org.openrewrite.javascript.cleanup.order-imports**: Sort imports by category and module path. Categories: side-effect, namespace, default, named, type. Within each category, imports are sorted alphabetically by module path. Named specifiers within each import are also sorted alphabetically. +* **org.openrewrite.javascript.cleanup.prefer-optional-chain**: Converts ternary expressions like `foo ? foo.bar : undefined` to use optional chaining syntax `foo?.bar`. +* **org.openrewrite.javascript.cleanup.use-object-property-shorthand**: Simplifies object properties where the property name and value/variable name are the same (e.g., `{ x: x }` becomes `{ x }`). Applies to both destructuring patterns and object literals. +* **org.openrewrite.javascript.dependencies.add-dependency**: Adds a new dependency to `package.json` and updates the lock file by running the package manager. +* **org.openrewrite.javascript.dependencies.find-dependency**: Finds dependencies in a project's `package.json`. Can find both direct dependencies and dependencies that transitively include the target package. This recipe is commonly used as a precondition for other recipes. +* **org.openrewrite.javascript.dependencies.upgrade-dependency-version**: Upgrades the version of a direct dependency in `package.json` and updates the lock file by running the package manager. +* **org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version**: Upgrades the version of a transitive dependency by adding override/resolution entries to `package.json` and updates the lock file by running the package manager. +* **org.openrewrite.javascript.format.auto-format**: Format JavaScript and TypeScript code using formatting rules auto-detected from the project's existing code style. +* **org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences**: Convert old-style octal escape sequences (e.g., `\0`, `\123`) to modern hex escape sequences (e.g., `\x00`, `\x53`) or Unicode escape sequences (e.g., `\u0000`, `\u0053`). +* **org.openrewrite.javascript.migrate.es6.modernize-octal-literals**: Convert old-style octal literals (e.g., `0777`) to modern ES6 syntax (e.g., `0o777`). +* **org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys**: Remove duplicate keys in object literals, keeping only the last occurrence (last-wins semantics). +* **org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default**: Converts TypeScript `export =` syntax to ES module `export default` syntax for compatibility with ECMAScript modules. +* **org.openrewrite.node.dependency-vulnerability-check**: This software composition analysis (SCA) tool detects and upgrades dependencies with publicly disclosed vulnerabilities. This recipe both generates a report of vulnerable dependencies and upgrades to newer versions with fixes. This recipe by default only upgrades to the latest **patch** version. If a minor or major upgrade is required to reach the fixed version, this can be controlled using the `maximumUpgradeDelta` option. Vulnerability information comes from the GitHub Security Advisory Database. +* **org.openrewrite.node.migrate.buffer.replace-deprecated-slice**: Replace deprecated `buffer.slice()` calls with `buffer.subarray()` for compatibility with Uint8Array.prototype.slice(). +* **org.openrewrite.node.migrate.buffer.replace-slow-buffer**: Replace deprecated `new SlowBuffer(size)` calls with `Buffer.allocUnsafeSlow(size)`. SlowBuffer was used to create un-pooled Buffer instances, but has been removed in favor of the explicit Buffer.allocUnsafeSlow() method. +* **org.openrewrite.node.migrate.crypto.replace-crypto-fips**: Replace deprecated `crypto.fips` property access with `crypto.getFips()` for reads and `crypto.setFips(value)` for writes. +* **org.openrewrite.node.migrate.crypto.replace-hash-constructor**: Replace deprecated `new crypto.Hash(algorithm)` constructor calls with `crypto.createHash(algorithm)` and `new crypto.Hmac(algorithm, key)` with `crypto.createHmac(algorithm, key)` factory methods. +* **org.openrewrite.node.migrate.fs.replace-dirent-path**: Replaces deprecated `dirent.path` property access with `dirent.parentPath` on `fs.Dirent` instances to address DEP0178 deprecation. +* **org.openrewrite.node.migrate.fs.replace-fs-access-constants**: Replace deprecated file access constants (`fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK`) with their equivalents from `fs.constants`. These constants were removed in Node.js v24+ and should be accessed through the constants namespace. +* **org.openrewrite.node.migrate.fs.replace-fs-truncate-fd**: Replace deprecated `fs.truncate(fd, ...)` and `fs.truncateSync(fd, ...)` calls with `fs.ftruncate(fd, ...)` and `fs.ftruncateSync(fd, ...)` when the first argument is a file descriptor (number). +* **org.openrewrite.node.migrate.fs.replace-stats-constructor**: Replace deprecated `new fs.Stats()` constructor calls with an object literal containing Stats properties initialized to undefined. +* **org.openrewrite.node.migrate.http.replace-outgoing-message-headers**: Replace deprecated `OutgoingMessage.prototype._headers` with `getHeaders()`, `setHeader()`, `removeHeader()` and `OutgoingMessage.prototype._headerNames` with `getHeaderNames()` to address DEP0066 deprecation. +* **org.openrewrite.node.migrate.net.remove-set-simultaneous-accepts**: Remove calls to deprecated `net._setSimultaneousAccepts()` which was an undocumented internal function that is no longer necessary. +* **org.openrewrite.node.migrate.process.coerce-process-exit-code**: Wraps non-integer values passed to `process.exit()` or assigned to `process.exitCode` with `Math.trunc()` to avoid the DEP0164 deprecation warning about implicit coercion to integer. +* **org.openrewrite.node.migrate.process.remove-usage-of-features-tls-underscore_constants**: Remove references to deprecated `process.features.tls_*` properties, replace with `process.features.tls`. +* **org.openrewrite.node.migrate.stream.replace-internal-modules**: Replace deprecated internal stream module imports like `require('node:_stream_readable')` with the public `node:stream` module. +* **org.openrewrite.node.migrate.tls.replace-internal-modules**: Replace deprecated internal TLS module imports `require('node:_tls_common')` and `require('node:_tls_wrap')` with the public `node:tls` module. +* **org.openrewrite.node.migrate.upgrade-node-22**: Migrate deprecated APIs for Node.js 22 compatibility. Addresses Node 22 runtime deprecations and deprecations from earlier versions. +* **org.openrewrite.node.migrate.upgrade-node-24**: Migrate deprecated APIs for Node.js 24 compatibility. Includes all migrations from Node.js 22, plus Node 23 and Node 24 deprecations. +* **org.openrewrite.node.migrate.util.remove-promisify-on-promise**: Removes `util.promisify()` calls on functions that already return a Promise. Since Node.js v17.0.0, calling promisify on a function that returns a Promise emits a runtime deprecation warning (DEP0174). +* **org.openrewrite.node.migrate.util.replace-is-webassembly-compiled-module**: Replace `util.types.isWebAssemblyCompiledModule(value)` with `value instanceof WebAssembly.Module`. +* **org.openrewrite.node.migrate.util.replace-util-extend**: Replace deprecated `util._extend(target, source)` calls with `Object.assign(target, source)` which preserves the mutation behavior. +* **org.openrewrite.node.migrate.util.replace-util-log**: Replace deprecated `util.log()` calls with `console.log()`. Note: `util.log()` included timestamps, but `console.log()` does not. +* **org.openrewrite.node.migrate.util.use-native-type-checking-methods**: The `util` module's type-checking methods have been removed in Node 22. +* **org.openrewrite.node.migrate.zlib.replace-bytes-read**: Replace deprecated `bytesRead` property on zlib streams with `bytesWritten`. +* **org.openrewrite.node.security.remove-redundant-overrides**: Removes overrides/resolutions from package.json that are redundant because the dependency tree already resolves to the overridden version or higher. + diff --git c/sidebars.ts i/sidebars.ts index 24d024c07c..ade66692d0 100644 --- c/sidebars.ts +++ i/sidebars.ts @@ -190,6 +190,7 @@ const sidebars: SidebarsConfig = { keywords: ['changelog'], }, items: [ + 'changelog/8-75-2-Release', 'changelog/8-74-1-Release', 'changelog/8-73-0-Release', 'changelog/8-72-0-Release', diff --git c/src/plugins/latest-versions.js i/src/plugins/latest-versions.js index 54b0e04d94..6f8db41167 100644 --- c/src/plugins/latest-versions.js +++ i/src/plugins/latest-versions.js @@ -40,7 +40,6 @@ const latestVersions = { "{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_ALL}}": "1.23.10", "{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_ANDROID}}": "0.15.7", "{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_APACHE}}": "2.23.1", - "{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_AZUL}}": "0.8.5", "{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_CIRCLECI}}": "3.9.8", "{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_CODEMODS}}": "0.24.4", "{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_CODEMODS_NG}}": "0.18.1", --- docs/changelog/8-75-2-Release.md | 82 ++++++++++++++++++++++++++++++++ sidebars.ts | 1 + src/plugins/latest-versions.js | 1 - 3 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 docs/changelog/8-75-2-Release.md diff --git a/docs/changelog/8-75-2-Release.md b/docs/changelog/8-75-2-Release.md new file mode 100644 index 0000000000..e687c8e57a --- /dev/null +++ b/docs/changelog/8-75-2-Release.md @@ -0,0 +1,82 @@ +--- +description: What's changed in OpenRewrite version 8.75.2. +--- + +# 8.75.2 release (2026-03-09) + +_Total recipe count: 4202_ + +:::info +This changelog only shows what recipes have been added, removed, or changed. OpenRewrite may do releases that do not include these types of changes. To see these changes, please go to the [releases page](https://github.com/openrewrite/rewrite/releases). +::: + +## Corresponding CLI version + +* Stable CLI version `v3.57.12` +* Staging CLI version: `v3.57.14` + +## Removed Artifacts + +* rewrite-csharp + +## New Recipes + +* [org.openrewrite.gitlab.AddArtifactsExpireIn](https://docs.openrewrite.org/recipes/gitlab/addartifactsexpirein): Set `artifacts:expire_in` in `.gitlab-ci.yml` to prevent storage bloat from indefinitely stored artifacts. +* [org.openrewrite.gitlab.AddCache](https://docs.openrewrite.org/recipes/gitlab/addcache): Add `cache` configuration to `.gitlab-ci.yml` for faster builds. +* [org.openrewrite.gitlab.AddDefaultKeyword](https://docs.openrewrite.org/recipes/gitlab/adddefaultkeyword): Add or update a keyword in the `default` section of `.gitlab-ci.yml`. +* [org.openrewrite.gitlab.AddInterruptible](https://docs.openrewrite.org/recipes/gitlab/addinterruptible): Set `interruptible: true` in `.gitlab-ci.yml` to allow pipelines to be cancelled when superseded. +* [org.openrewrite.gitlab.AddRetry](https://docs.openrewrite.org/recipes/gitlab/addretry): Add `retry` configuration to `.gitlab-ci.yml` for resilience against infrastructure failures. +* [org.openrewrite.gitlab.AddTimeout](https://docs.openrewrite.org/recipes/gitlab/addtimeout): Set `timeout` in `.gitlab-ci.yml` to prevent jobs from hanging indefinitely. +* [org.openrewrite.gitlab.AddWorkflowRules](https://docs.openrewrite.org/recipes/gitlab/addworkflowrules): Add `workflow:rules` to `.gitlab-ci.yml` to control pipeline creation. +* [org.openrewrite.gitlab.BestPractices](https://docs.openrewrite.org/recipes/gitlab/bestpractices): Apply GitLab CI/CD best practices to `.gitlab-ci.yml`. This includes adding `workflow:rules` to prevent duplicate pipelines, setting `interruptible: true` and `retry` in the `default` section, configuring `artifacts:expire_in`, and setting a job `timeout`. +* [org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging](https://docs.openrewrite.org/recipes/java/logging/slf4j/messageformattoparameterizedlogging): Replace `MessageFormat.format()` calls in SLF4J logging statements with parameterized placeholders for improved performance. +* [org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards](https://docs.openrewrite.org/recipes/java/logging/slf4j/removeunnecessaryloglevelguards): Remove `if` statement guards around SLF4J logging calls when parameterized logging makes them unnecessary. +* [org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging](https://docs.openrewrite.org/recipes/java/logging/slf4j/stringformattoparameterizedlogging): Replace `String.format()` calls in SLF4J logging statements with parameterized placeholders for improved performance. +* [org.openrewrite.java.migrate.lombok.UseAllArgsConstructor](https://docs.openrewrite.org/recipes/java/migrate/lombok/useallargsconstructor): Prefer the Lombok `@AllArgsConstructor` annotation over explicitly written out constructors that assign all non-static fields. +* [org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor](https://docs.openrewrite.org/recipes/java/migrate/lombok/userequiredargsconstructor): Prefer the Lombok `@RequiredArgsConstructor` annotation over explicitly written out constructors that only assign final fields. +* [org.openrewrite.java.spring.boot4.RenameDeprecatedStartersManagedVersions](https://docs.openrewrite.org/recipes/java/spring/boot4/renamedeprecatedstartersmanagedversions): Renames deprecated Spring Boot starters to their new names without adding explicit versions, for use in projects where the `io.spring.dependency-management` plugin manages versions via BOM. +* [org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener](https://docs.openrewrite.org/recipes/java/testing/mockito/replacemockitotestexecutionlistener): Replace `@TestExecutionListeners(MockitoTestExecutionListener.class)` with the appropriate Mockito initialization for the test framework in use: `@ExtendWith(MockitoExtension.class)` for JUnit 5, `@RunWith(MockitoJUnitRunner.class)` for JUnit 4, or `MockitoAnnotations.openMocks(this)` for TestNG. +* [org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies](https://docs.openrewrite.org/recipes/java/testing/mockito/replacepowermockdependencies): Replaces PowerMock API dependencies with `mockito-inline` when `mockStatic()`, `whenNew()`, or `@PrepareForTest` usage is detected, or `mockito-core` otherwise. PowerMock features like static mocking, constructor mocking, and final class mocking require the inline mock maker which is bundled in `mockito-inline` for Mockito 3.x/4.x. + +## Removed Recipes + +* **org.openrewrite.javascript.change-import**: Changes an import from one module/member to another, updating all type attributions. +* **org.openrewrite.javascript.cleanup.add-parse-int-radix**: Adds the radix parameter (base 10) to `parseInt()` calls that are missing it, preventing potential parsing issues. +* **org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method**: Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. +* **org.openrewrite.javascript.cleanup.order-imports**: Sort imports by category and module path. Categories: side-effect, namespace, default, named, type. Within each category, imports are sorted alphabetically by module path. Named specifiers within each import are also sorted alphabetically. +* **org.openrewrite.javascript.cleanup.prefer-optional-chain**: Converts ternary expressions like `foo ? foo.bar : undefined` to use optional chaining syntax `foo?.bar`. +* **org.openrewrite.javascript.cleanup.use-object-property-shorthand**: Simplifies object properties where the property name and value/variable name are the same (e.g., `{ x: x }` becomes `{ x }`). Applies to both destructuring patterns and object literals. +* **org.openrewrite.javascript.dependencies.add-dependency**: Adds a new dependency to `package.json` and updates the lock file by running the package manager. +* **org.openrewrite.javascript.dependencies.find-dependency**: Finds dependencies in a project's `package.json`. Can find both direct dependencies and dependencies that transitively include the target package. This recipe is commonly used as a precondition for other recipes. +* **org.openrewrite.javascript.dependencies.upgrade-dependency-version**: Upgrades the version of a direct dependency in `package.json` and updates the lock file by running the package manager. +* **org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version**: Upgrades the version of a transitive dependency by adding override/resolution entries to `package.json` and updates the lock file by running the package manager. +* **org.openrewrite.javascript.format.auto-format**: Format JavaScript and TypeScript code using formatting rules auto-detected from the project's existing code style. +* **org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences**: Convert old-style octal escape sequences (e.g., `\0`, `\123`) to modern hex escape sequences (e.g., `\x00`, `\x53`) or Unicode escape sequences (e.g., `\u0000`, `\u0053`). +* **org.openrewrite.javascript.migrate.es6.modernize-octal-literals**: Convert old-style octal literals (e.g., `0777`) to modern ES6 syntax (e.g., `0o777`). +* **org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys**: Remove duplicate keys in object literals, keeping only the last occurrence (last-wins semantics). +* **org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default**: Converts TypeScript `export =` syntax to ES module `export default` syntax for compatibility with ECMAScript modules. +* **org.openrewrite.node.dependency-vulnerability-check**: This software composition analysis (SCA) tool detects and upgrades dependencies with publicly disclosed vulnerabilities. This recipe both generates a report of vulnerable dependencies and upgrades to newer versions with fixes. This recipe by default only upgrades to the latest **patch** version. If a minor or major upgrade is required to reach the fixed version, this can be controlled using the `maximumUpgradeDelta` option. Vulnerability information comes from the GitHub Security Advisory Database. +* **org.openrewrite.node.migrate.buffer.replace-deprecated-slice**: Replace deprecated `buffer.slice()` calls with `buffer.subarray()` for compatibility with Uint8Array.prototype.slice(). +* **org.openrewrite.node.migrate.buffer.replace-slow-buffer**: Replace deprecated `new SlowBuffer(size)` calls with `Buffer.allocUnsafeSlow(size)`. SlowBuffer was used to create un-pooled Buffer instances, but has been removed in favor of the explicit Buffer.allocUnsafeSlow() method. +* **org.openrewrite.node.migrate.crypto.replace-crypto-fips**: Replace deprecated `crypto.fips` property access with `crypto.getFips()` for reads and `crypto.setFips(value)` for writes. +* **org.openrewrite.node.migrate.crypto.replace-hash-constructor**: Replace deprecated `new crypto.Hash(algorithm)` constructor calls with `crypto.createHash(algorithm)` and `new crypto.Hmac(algorithm, key)` with `crypto.createHmac(algorithm, key)` factory methods. +* **org.openrewrite.node.migrate.fs.replace-dirent-path**: Replaces deprecated `dirent.path` property access with `dirent.parentPath` on `fs.Dirent` instances to address DEP0178 deprecation. +* **org.openrewrite.node.migrate.fs.replace-fs-access-constants**: Replace deprecated file access constants (`fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK`) with their equivalents from `fs.constants`. These constants were removed in Node.js v24+ and should be accessed through the constants namespace. +* **org.openrewrite.node.migrate.fs.replace-fs-truncate-fd**: Replace deprecated `fs.truncate(fd, ...)` and `fs.truncateSync(fd, ...)` calls with `fs.ftruncate(fd, ...)` and `fs.ftruncateSync(fd, ...)` when the first argument is a file descriptor (number). +* **org.openrewrite.node.migrate.fs.replace-stats-constructor**: Replace deprecated `new fs.Stats()` constructor calls with an object literal containing Stats properties initialized to undefined. +* **org.openrewrite.node.migrate.http.replace-outgoing-message-headers**: Replace deprecated `OutgoingMessage.prototype._headers` with `getHeaders()`, `setHeader()`, `removeHeader()` and `OutgoingMessage.prototype._headerNames` with `getHeaderNames()` to address DEP0066 deprecation. +* **org.openrewrite.node.migrate.net.remove-set-simultaneous-accepts**: Remove calls to deprecated `net._setSimultaneousAccepts()` which was an undocumented internal function that is no longer necessary. +* **org.openrewrite.node.migrate.process.coerce-process-exit-code**: Wraps non-integer values passed to `process.exit()` or assigned to `process.exitCode` with `Math.trunc()` to avoid the DEP0164 deprecation warning about implicit coercion to integer. +* **org.openrewrite.node.migrate.process.remove-usage-of-features-tls-underscore_constants**: Remove references to deprecated `process.features.tls_*` properties, replace with `process.features.tls`. +* **org.openrewrite.node.migrate.stream.replace-internal-modules**: Replace deprecated internal stream module imports like `require('node:_stream_readable')` with the public `node:stream` module. +* **org.openrewrite.node.migrate.tls.replace-internal-modules**: Replace deprecated internal TLS module imports `require('node:_tls_common')` and `require('node:_tls_wrap')` with the public `node:tls` module. +* **org.openrewrite.node.migrate.upgrade-node-22**: Migrate deprecated APIs for Node.js 22 compatibility. Addresses Node 22 runtime deprecations and deprecations from earlier versions. +* **org.openrewrite.node.migrate.upgrade-node-24**: Migrate deprecated APIs for Node.js 24 compatibility. Includes all migrations from Node.js 22, plus Node 23 and Node 24 deprecations. +* **org.openrewrite.node.migrate.util.remove-promisify-on-promise**: Removes `util.promisify()` calls on functions that already return a Promise. Since Node.js v17.0.0, calling promisify on a function that returns a Promise emits a runtime deprecation warning (DEP0174). +* **org.openrewrite.node.migrate.util.replace-is-webassembly-compiled-module**: Replace `util.types.isWebAssemblyCompiledModule(value)` with `value instanceof WebAssembly.Module`. +* **org.openrewrite.node.migrate.util.replace-util-extend**: Replace deprecated `util._extend(target, source)` calls with `Object.assign(target, source)` which preserves the mutation behavior. +* **org.openrewrite.node.migrate.util.replace-util-log**: Replace deprecated `util.log()` calls with `console.log()`. Note: `util.log()` included timestamps, but `console.log()` does not. +* **org.openrewrite.node.migrate.util.use-native-type-checking-methods**: The `util` module's type-checking methods have been removed in Node 22. +* **org.openrewrite.node.migrate.zlib.replace-bytes-read**: Replace deprecated `bytesRead` property on zlib streams with `bytesWritten`. +* **org.openrewrite.node.security.remove-redundant-overrides**: Removes overrides/resolutions from package.json that are redundant because the dependency tree already resolves to the overridden version or higher. + diff --git a/sidebars.ts b/sidebars.ts index 24d024c07c..ade66692d0 100644 --- a/sidebars.ts +++ b/sidebars.ts @@ -190,6 +190,7 @@ const sidebars: SidebarsConfig = { keywords: ['changelog'], }, items: [ + 'changelog/8-75-2-Release', 'changelog/8-74-1-Release', 'changelog/8-73-0-Release', 'changelog/8-72-0-Release', diff --git a/src/plugins/latest-versions.js b/src/plugins/latest-versions.js index 54b0e04d94..6f8db41167 100644 --- a/src/plugins/latest-versions.js +++ b/src/plugins/latest-versions.js @@ -40,7 +40,6 @@ const latestVersions = { "{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_ALL}}": "1.23.10", "{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_ANDROID}}": "0.15.7", "{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_APACHE}}": "2.23.1", - "{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_AZUL}}": "0.8.5", "{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_CIRCLECI}}": "3.9.8", "{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_CODEMODS}}": "0.24.4", "{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_CODEMODS_NG}}": "0.18.1", From 4f0ace166e47cb4a86c8991c1a412e736793ec10 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 9 Mar 2026 17:40:19 +0100 Subject: [PATCH 2/6] Update existing recipes diff --git c/docs/recipes/csharp/search/findtypes.md i/docs/recipes/csharp/search/findtypes.md deleted file mode 100644 index afd6cef86b..0000000000 --- c/docs/recipes/csharp/search/findtypes.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -sidebar_label: "Find types" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Find types - -**org.openrewrite.java.search.FindTypes** - -_Find type references by name._ - -:::info -This Java recipe works on Csharp code. -::: - -## Recipe source - -[GitHub: FindTypes.java](https://github.com/openrewrite/rewrite/blob/main/rewrite-java/src/main/java/org/openrewrite/java/search/FindTypes.java), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-java/) - -This recipe is available under the [Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `String` | fullyQualifiedTypeName | A fully-qualified type name, that is used to find matching type references. Supports glob expressions. `java..*` finds every type from every subpackage of the `java` package. | `java.util.List` | -| `Boolean` | checkAssignability | *Optional*. When enabled, find type references that are assignable to the provided type. | | - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [Find deprecated `PathMatcher` usage](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/java/spring/framework/finddeprecatedpathmatcherusage) -* [Report types deprecated or removed in WebLogic version 14.1.2](/recipes/com/oracle/weblogic/rewrite/reportdeprecatedorremoved1412.md) -* [Report types deprecated or removed in WebLogic version 15.1.1](/recipes/com/oracle/weblogic/rewrite/reportdeprecatedorremoved1511.md) - -## Example - -###### Parameters -| Parameter | Value | -| --- | --- | -|fullyQualifiedTypeName|`a.A1`| -|checkAssignability|`false`| - - - - - - -###### Before -```java -import a.A1; -public class B extends A1 {} -``` - -###### After -```java -import a.A1; -public class B extends /*~~>*/A1 {} -``` - - - - -```diff -@@ -2,1 +2,1 @@ -import a.A1; --public class B extends A1 {} -+public class B extends /*~~>*/A1 {} - -``` - - - - -## Usage - -This recipe has required configuration parameters. Recipes with required configuration parameters cannot be activated directly (unless you are running them via the Moderne CLI). To activate this recipe you must create a new recipe which fills in the required parameters. In your `rewrite.yml` create a new recipe with a unique name. For example: `com.yourorg.FindTypesExample`. -Here's how you can define and customize such a recipe within your rewrite.yml: -```yaml title="rewrite.yml" ---- -type: specs.openrewrite.org/v1beta/recipe -name: com.yourorg.FindTypesExample -displayName: Find types example -recipeList: - - org.openrewrite.java.search.FindTypes: - fullyQualifiedTypeName: java.util.List -``` - -Now that `com.yourorg.FindTypesExample` has been defined, activate it in your build file: - - - -1. Add the following to your `build.gradle` file: -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("com.yourorg.FindTypesExample") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} -``` -2. Run `gradle rewriteRun` to run the recipe. - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - com.yourorg.FindTypesExample - - - - - - -``` -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe FindTypes --recipe-option "fullyQualifiedTypeName=java.util.List" -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite:rewrite-java:{{VERSION_ORG_OPENREWRITE_REWRITE_JAVA}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Type uses -**org.openrewrite.java.table.TypeUses** - -_The source code of matching type uses._ - -| Column Name | Description | -| ----------- | ----------- | -| Source file | The source file that the method call occurred in. | -| Source | The source code of the type use. | -| Concrete type | The concrete type in use, which may be a subtype of a searched type. | - - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git c/docs/recipes/gitlab/adddefaultkeyword.md i/docs/recipes/gitlab/adddefaultkeyword.md deleted file mode 100644 index ca1dd4c0d2..0000000000 --- c/docs/recipes/gitlab/adddefaultkeyword.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -sidebar_label: "Add default keyword" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Add default keyword - -**org.openrewrite.gitlab.AddDefaultKeyword** - -_Add or update a keyword in the `default` section of `.gitlab-ci.yml`._ - -## Recipe source - -[GitHub: AddDefaultKeyword.java](https://github.com/openrewrite/rewrite-gitlab/blob/main/src/main/java/org/openrewrite/gitlab/AddDefaultKeyword.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-gitlab/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-gitlab/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `String` | keyword | The keyword to add under the `default` section. | `image` | -| `String` | value | The value for the keyword. | `ruby:3.0` | -| `Boolean` | acceptTheirs | *Optional*. When the keyword already exists, prefer the original value. | | - - -## Definition - - - -* [Merge YAML snippet](../yaml/mergeyaml) - * key: `$` - * yaml: `default: null: null` - * filePattern: `.gitlab-ci.yml` - - - - - -```yaml ---- -type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.gitlab.AddDefaultKeyword -displayName: Add default keyword -description: | - Add or update a keyword in the `default` section of `.gitlab-ci.yml`. - - - -recipeList: - - org.openrewrite.yaml.MergeYaml: - key: $ - yaml: default: - null: null - filePattern: .gitlab-ci.yml - -``` - - -## Example - -###### Parameters -| Parameter | Value | -| --- | --- | -|keyword|`image`| -|value|`ruby:3.0`| -|acceptTheirs|`null`| - - - -###### New file -```yaml title=".gitlab-ci.yml" -default: - image: ruby:3.0 -``` - - - -## Usage - -This recipe has required configuration parameters. Recipes with required configuration parameters cannot be activated directly (unless you are running them via the Moderne CLI). To activate this recipe you must create a new recipe which fills in the required parameters. In your `rewrite.yml` create a new recipe with a unique name. For example: `com.yourorg.AddDefaultKeywordExample`. -Here's how you can define and customize such a recipe within your rewrite.yml: -```yaml title="rewrite.yml" ---- -type: specs.openrewrite.org/v1beta/recipe -name: com.yourorg.AddDefaultKeywordExample -displayName: Add default keyword example -recipeList: - - org.openrewrite.gitlab.AddDefaultKeyword: - keyword: image - value: ruby:3.0 -``` - -Now that `com.yourorg.AddDefaultKeywordExample` has been defined, activate it and take a dependency on `org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}}` in your build file: - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("com.yourorg.AddDefaultKeywordExample") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}}") -} -``` -2. Run `gradle rewriteRun` to run the recipe. - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - com.yourorg.AddDefaultKeywordExample - - - - - org.openrewrite.recipe - rewrite-gitlab - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}} - - - - - - -``` -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe AddDefaultKeyword --recipe-option "keyword=image" --recipe-option "value=ruby:3.0" -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git c/docs/recipes/gitlab/addtimeout.md i/docs/recipes/gitlab/addtimeout.md deleted file mode 100644 index 9ff82e3838..0000000000 --- c/docs/recipes/gitlab/addtimeout.md +++ /dev/null @@ -1,259 +0,0 @@ ---- -sidebar_label: "Add job timeout" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Add job timeout - -**org.openrewrite.gitlab.AddTimeout** - -_Set `timeout` in `.gitlab-ci.yml` to prevent jobs from hanging indefinitely._ - -## Recipe source - -[GitHub: AddTimeout.java](https://github.com/openrewrite/rewrite-gitlab/blob/main/src/main/java/org/openrewrite/gitlab/AddTimeout.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-gitlab/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-gitlab/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `String` | timeout | The timeout duration. | `1 hour` | -| `String` | jobName | *Optional*. The job to set timeout on. If not provided, applies to the `default` section. | `build_job` | -| `Boolean` | acceptTheirs | *Optional*. When the setting already exists, prefer the original value. | | - - -## Definition - - - -* [Merge YAML snippet](../yaml/mergeyaml) - * key: `$` - * yaml: `default: timeout: null` - * filePattern: `.gitlab-ci.yml` - - - - - -```yaml ---- -type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.gitlab.AddTimeout -displayName: Add job timeout -description: | - Set `timeout` in `.gitlab-ci.yml` to prevent jobs from hanging indefinitely. - - - -recipeList: - - org.openrewrite.yaml.MergeYaml: - key: $ - yaml: default: - timeout: null - filePattern: .gitlab-ci.yml - -``` - - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [GitLab CI best practices](/recipes/gitlab/bestpractices.md) - -## Example - -###### Parameters -| Parameter | Value | -| --- | --- | -|timeout|`1 hour`| -|jobName|`null`| -|acceptTheirs|`null`| - - - -###### New file -```yaml title=".gitlab-ci.yml" -default: - timeout: 1 hour -``` - - - -## Usage - -This recipe has required configuration parameters. Recipes with required configuration parameters cannot be activated directly (unless you are running them via the Moderne CLI). To activate this recipe you must create a new recipe which fills in the required parameters. In your `rewrite.yml` create a new recipe with a unique name. For example: `com.yourorg.AddTimeoutExample`. -Here's how you can define and customize such a recipe within your rewrite.yml: -```yaml title="rewrite.yml" ---- -type: specs.openrewrite.org/v1beta/recipe -name: com.yourorg.AddTimeoutExample -displayName: Add job timeout example -recipeList: - - org.openrewrite.gitlab.AddTimeout: - timeout: 1 hour - jobName: build_job -``` - -Now that `com.yourorg.AddTimeoutExample` has been defined, activate it and take a dependency on `org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}}` in your build file: - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("com.yourorg.AddTimeoutExample") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}}") -} -``` -2. Run `gradle rewriteRun` to run the recipe. - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - com.yourorg.AddTimeoutExample - - - - - org.openrewrite.recipe - rewrite-gitlab - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}} - - - - - - -``` -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe AddTimeout --recipe-option "timeout=1 hour" --recipe-option "jobName=build_job" -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git c/docs/recipes/java/logging/slf4j/messageformattoparameterizedlogging.md i/docs/recipes/java/logging/slf4j/messageformattoparameterizedlogging.md deleted file mode 100644 index 0725068486..0000000000 --- c/docs/recipes/java/logging/slf4j/messageformattoparameterizedlogging.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -sidebar_label: "`MessageFormat.format()` in logging statements should use SLF4J parameterized logging" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# `MessageFormat.format()` in logging statements should use SLF4J parameterized logging - -**org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging** - -_Replace `MessageFormat.format()` calls in SLF4J logging statements with parameterized placeholders for improved performance._ - -### Tags - -* [slf4j](/reference/recipes-by-tag#slf4j) -* [logging](/reference/recipes-by-tag#logging) - -## Recipe source - -[GitHub: MessageFormatToParameterizedLogging.java](https://github.com/openrewrite/rewrite-logging-frameworks/blob/main/src/main/java/org/openrewrite/java/logging/slf4j/MessageFormatToParameterizedLogging.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-logging-frameworks/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-logging-frameworks/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [SLF4J best practices](/recipes/java/logging/slf4j/slf4jbestpractices.md) - - -## Usage - -This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-logging-frameworks` in your build file or by running a shell command (in which case no build changes are needed): - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") -} -``` - -2. Run `gradle rewriteRun` to run the recipe. - - - - -1. Create a file named `init.gradle` in the root of your project. - -```groovy title="init.gradle" -initscript { - repositories { - maven { url "https://plugins.gradle.org/m2" } - } - dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } -} -rootProject { - plugins.apply(org.openrewrite.gradle.RewritePlugin) - dependencies { - rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") - } - rewrite { - activeRecipe("org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging") - setExportDatatables(true) - } - afterEvaluate { - if (repositories.isEmpty()) { - repositories { - mavenCentral() - } - } - } -} -``` - -2. Run the recipe. - -```shell title="shell" -gradle --init-script init.gradle rewriteRun -``` - - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging - - - - - org.openrewrite.recipe - rewrite-logging-frameworks - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} - - - - - - -``` - -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. - -```shell title="shell" -mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-logging-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging -Drewrite.exportDatatables=true -``` - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe MessageFormatToParameterizedLogging -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git c/docs/recipes/java/logging/slf4j/removeunnecessaryloglevelguards.md i/docs/recipes/java/logging/slf4j/removeunnecessaryloglevelguards.md deleted file mode 100644 index 87b9b363d1..0000000000 --- c/docs/recipes/java/logging/slf4j/removeunnecessaryloglevelguards.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -sidebar_label: "Remove unnecessary log level guards" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Remove unnecessary log level guards - -**org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards** - -_Remove `if` statement guards around SLF4J logging calls when parameterized logging makes them unnecessary._ - -### Tags - -* [slf4j](/reference/recipes-by-tag#slf4j) -* [logging](/reference/recipes-by-tag#logging) - -## Recipe source - -[GitHub: RemoveUnnecessaryLogLevelGuards.java](https://github.com/openrewrite/rewrite-logging-frameworks/blob/main/src/main/java/org/openrewrite/java/logging/slf4j/RemoveUnnecessaryLogLevelGuards.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-logging-frameworks/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-logging-frameworks/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [SLF4J best practices](/recipes/java/logging/slf4j/slf4jbestpractices.md) - - -## Usage - -This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-logging-frameworks` in your build file or by running a shell command (in which case no build changes are needed): - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") -} -``` - -2. Run `gradle rewriteRun` to run the recipe. - - - - -1. Create a file named `init.gradle` in the root of your project. - -```groovy title="init.gradle" -initscript { - repositories { - maven { url "https://plugins.gradle.org/m2" } - } - dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } -} -rootProject { - plugins.apply(org.openrewrite.gradle.RewritePlugin) - dependencies { - rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") - } - rewrite { - activeRecipe("org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards") - setExportDatatables(true) - } - afterEvaluate { - if (repositories.isEmpty()) { - repositories { - mavenCentral() - } - } - } -} -``` - -2. Run the recipe. - -```shell title="shell" -gradle --init-script init.gradle rewriteRun -``` - - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards - - - - - org.openrewrite.recipe - rewrite-logging-frameworks - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} - - - - - - -``` - -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. - -```shell title="shell" -mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-logging-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards -Drewrite.exportDatatables=true -``` - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe RemoveUnnecessaryLogLevelGuards -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git c/docs/recipes/java/logging/slf4j/stringformattoparameterizedlogging.md i/docs/recipes/java/logging/slf4j/stringformattoparameterizedlogging.md deleted file mode 100644 index 5fa00d32f7..0000000000 --- c/docs/recipes/java/logging/slf4j/stringformattoparameterizedlogging.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -sidebar_label: "`String.format()` in logging statements should use SLF4J parameterized logging" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# `String.format()` in logging statements should use SLF4J parameterized logging - -**org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging** - -_Replace `String.format()` calls in SLF4J logging statements with parameterized placeholders for improved performance._ - -### Tags - -* [slf4j](/reference/recipes-by-tag#slf4j) -* [logging](/reference/recipes-by-tag#logging) - -## Recipe source - -[GitHub: StringFormatToParameterizedLogging.java](https://github.com/openrewrite/rewrite-logging-frameworks/blob/main/src/main/java/org/openrewrite/java/logging/slf4j/StringFormatToParameterizedLogging.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-logging-frameworks/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-logging-frameworks/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [SLF4J best practices](/recipes/java/logging/slf4j/slf4jbestpractices.md) - - -## Usage - -This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-logging-frameworks` in your build file or by running a shell command (in which case no build changes are needed): - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") -} -``` - -2. Run `gradle rewriteRun` to run the recipe. - - - - -1. Create a file named `init.gradle` in the root of your project. - -```groovy title="init.gradle" -initscript { - repositories { - maven { url "https://plugins.gradle.org/m2" } - } - dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } -} -rootProject { - plugins.apply(org.openrewrite.gradle.RewritePlugin) - dependencies { - rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") - } - rewrite { - activeRecipe("org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging") - setExportDatatables(true) - } - afterEvaluate { - if (repositories.isEmpty()) { - repositories { - mavenCentral() - } - } - } -} -``` - -2. Run the recipe. - -```shell title="shell" -gradle --init-script init.gradle rewriteRun -``` - - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging - - - - - org.openrewrite.recipe - rewrite-logging-frameworks - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} - - - - - - -``` - -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. - -```shell title="shell" -mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-logging-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging -Drewrite.exportDatatables=true -``` - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe StringFormatToParameterizedLogging -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git c/docs/recipes/java/migrate/lombok/useallargsconstructor.md i/docs/recipes/java/migrate/lombok/useallargsconstructor.md deleted file mode 100644 index 3a1d2cf798..0000000000 --- c/docs/recipes/java/migrate/lombok/useallargsconstructor.md +++ /dev/null @@ -1,234 +0,0 @@ ---- -sidebar_label: "Use `@AllArgsConstructor` where applicable" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Use `@AllArgsConstructor` where applicable - -**org.openrewrite.java.migrate.lombok.UseAllArgsConstructor** - -_Prefer the Lombok `@AllArgsConstructor` annotation over explicitly written out constructors that assign all non-static fields._ - -## Recipe source - -[GitHub: UseAllArgsConstructor.java](https://github.com/openrewrite/rewrite-migrate-java/blob/main/src/main/java/org/openrewrite/java/migrate/lombok/UseAllArgsConstructor.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-migrate-java/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-migrate-java/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [Lombok Best Practices](/recipes/java/migrate/lombok/lombokbestpractices.md) - - -## Usage - -This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-migrate-java` in your build file or by running a shell command (in which case no build changes are needed): - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("org.openrewrite.java.migrate.lombok.UseAllArgsConstructor") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}}") -} -``` - -2. Run `gradle rewriteRun` to run the recipe. - - - - -1. Create a file named `init.gradle` in the root of your project. - -```groovy title="init.gradle" -initscript { - repositories { - maven { url "https://plugins.gradle.org/m2" } - } - dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } -} -rootProject { - plugins.apply(org.openrewrite.gradle.RewritePlugin) - dependencies { - rewrite("org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}}") - } - rewrite { - activeRecipe("org.openrewrite.java.migrate.lombok.UseAllArgsConstructor") - setExportDatatables(true) - } - afterEvaluate { - if (repositories.isEmpty()) { - repositories { - mavenCentral() - } - } - } -} -``` - -2. Run the recipe. - -```shell title="shell" -gradle --init-script init.gradle rewriteRun -``` - - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - org.openrewrite.java.migrate.lombok.UseAllArgsConstructor - - - - - org.openrewrite.recipe - rewrite-migrate-java - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}} - - - - - - -``` - -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. - -```shell title="shell" -mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.migrate.lombok.UseAllArgsConstructor -Drewrite.exportDatatables=true -``` - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe UseAllArgsConstructor -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git c/docs/recipes/java/migrate/lombok/userequiredargsconstructor.md i/docs/recipes/java/migrate/lombok/userequiredargsconstructor.md deleted file mode 100644 index b1c9b585b5..0000000000 --- c/docs/recipes/java/migrate/lombok/userequiredargsconstructor.md +++ /dev/null @@ -1,234 +0,0 @@ ---- -sidebar_label: "Use `@RequiredArgsConstructor` where applicable" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Use `@RequiredArgsConstructor` where applicable - -**org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor** - -_Prefer the Lombok `@RequiredArgsConstructor` annotation over explicitly written out constructors that only assign final fields._ - -## Recipe source - -[GitHub: UseRequiredArgsConstructor.java](https://github.com/openrewrite/rewrite-migrate-java/blob/main/src/main/java/org/openrewrite/java/migrate/lombok/UseRequiredArgsConstructor.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-migrate-java/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-migrate-java/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [Lombok Best Practices](/recipes/java/migrate/lombok/lombokbestpractices.md) - - -## Usage - -This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-migrate-java` in your build file or by running a shell command (in which case no build changes are needed): - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}}") -} -``` - -2. Run `gradle rewriteRun` to run the recipe. - - - - -1. Create a file named `init.gradle` in the root of your project. - -```groovy title="init.gradle" -initscript { - repositories { - maven { url "https://plugins.gradle.org/m2" } - } - dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } -} -rootProject { - plugins.apply(org.openrewrite.gradle.RewritePlugin) - dependencies { - rewrite("org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}}") - } - rewrite { - activeRecipe("org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor") - setExportDatatables(true) - } - afterEvaluate { - if (repositories.isEmpty()) { - repositories { - mavenCentral() - } - } - } -} -``` - -2. Run the recipe. - -```shell title="shell" -gradle --init-script init.gradle rewriteRun -``` - - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor - - - - - org.openrewrite.recipe - rewrite-migrate-java - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}} - - - - - - -``` - -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. - -```shell title="shell" -mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor -Drewrite.exportDatatables=true -``` - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe UseRequiredArgsConstructor -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git c/docs/recipes/java/testing/mockito/replacemockitotestexecutionlistener.md i/docs/recipes/java/testing/mockito/replacemockitotestexecutionlistener.md deleted file mode 100644 index 2ca00eb43d..0000000000 --- c/docs/recipes/java/testing/mockito/replacemockitotestexecutionlistener.md +++ /dev/null @@ -1,234 +0,0 @@ ---- -sidebar_label: "Replace `MockitoTestExecutionListener` with the equivalent Mockito test initialization" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Replace `MockitoTestExecutionListener` with the equivalent Mockito test initialization - -**org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener** - -_Replace `@TestExecutionListeners(MockitoTestExecutionListener.class)` with the appropriate Mockito initialization for the test framework in use: `@ExtendWith(MockitoExtension.class)` for JUnit 5, `@RunWith(MockitoJUnitRunner.class)` for JUnit 4, or `MockitoAnnotations.openMocks(this)` for TestNG._ - -## Recipe source - -[GitHub: ReplaceMockitoTestExecutionListener.java](https://github.com/openrewrite/rewrite-testing-frameworks/blob/main/src/main/java/org/openrewrite/java/testing/mockito/ReplaceMockitoTestExecutionListener.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-testing-frameworks/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-testing-frameworks/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [Mockito 3.x migration from 1.x](/recipes/java/testing/mockito/mockito1to3migration.md) - - -## Usage - -This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-testing-frameworks` in your build file or by running a shell command (in which case no build changes are needed): - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}}") -} -``` - -2. Run `gradle rewriteRun` to run the recipe. - - - - -1. Create a file named `init.gradle` in the root of your project. - -```groovy title="init.gradle" -initscript { - repositories { - maven { url "https://plugins.gradle.org/m2" } - } - dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } -} -rootProject { - plugins.apply(org.openrewrite.gradle.RewritePlugin) - dependencies { - rewrite("org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}}") - } - rewrite { - activeRecipe("org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener") - setExportDatatables(true) - } - afterEvaluate { - if (repositories.isEmpty()) { - repositories { - mavenCentral() - } - } - } -} -``` - -2. Run the recipe. - -```shell title="shell" -gradle --init-script init.gradle rewriteRun -``` - - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener - - - - - org.openrewrite.recipe - rewrite-testing-frameworks - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}} - - - - - - -``` - -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. - -```shell title="shell" -mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener -Drewrite.exportDatatables=true -``` - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe ReplaceMockitoTestExecutionListener -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git c/docs/recipes/java/testing/mockito/replacepowermockdependencies.md i/docs/recipes/java/testing/mockito/replacepowermockdependencies.md deleted file mode 100644 index d5a8e52d91..0000000000 --- c/docs/recipes/java/testing/mockito/replacepowermockdependencies.md +++ /dev/null @@ -1,234 +0,0 @@ ---- -sidebar_label: "Replace PowerMock dependencies with Mockito equivalents" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Replace PowerMock dependencies with Mockito equivalents - -**org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies** - -_Replaces PowerMock API dependencies with `mockito-inline` when `mockStatic()`, `whenNew()`, or `@PrepareForTest` usage is detected, or `mockito-core` otherwise. PowerMock features like static mocking, constructor mocking, and final class mocking require the inline mock maker which is bundled in `mockito-inline` for Mockito 3.x/4.x._ - -## Recipe source - -[GitHub: ReplacePowerMockDependencies.java](https://github.com/openrewrite/rewrite-testing-frameworks/blob/main/src/main/java/org/openrewrite/java/testing/mockito/ReplacePowerMockDependencies.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-testing-frameworks/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-testing-frameworks/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [Replace PowerMock with raw Mockito](/recipes/java/testing/mockito/replacepowermockito.md) - - -## Usage - -This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-testing-frameworks` in your build file or by running a shell command (in which case no build changes are needed): - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}}") -} -``` - -2. Run `gradle rewriteRun` to run the recipe. - - - - -1. Create a file named `init.gradle` in the root of your project. - -```groovy title="init.gradle" -initscript { - repositories { - maven { url "https://plugins.gradle.org/m2" } - } - dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } -} -rootProject { - plugins.apply(org.openrewrite.gradle.RewritePlugin) - dependencies { - rewrite("org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}}") - } - rewrite { - activeRecipe("org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies") - setExportDatatables(true) - } - afterEvaluate { - if (repositories.isEmpty()) { - repositories { - mavenCentral() - } - } - } -} -``` - -2. Run the recipe. - -```shell title="shell" -gradle --init-script init.gradle rewriteRun -``` - - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies - - - - - org.openrewrite.recipe - rewrite-testing-frameworks - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}} - - - - - - -``` - -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. - -```shell title="shell" -mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies -Drewrite.exportDatatables=true -``` - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe ReplacePowerMockDependencies -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git c/docs/recipes/javascript/README.md i/docs/recipes/javascript/README.md index 12d0883bb3..ce94840433 100644 --- c/docs/recipes/javascript/README.md +++ i/docs/recipes/javascript/README.md @@ -6,15 +6,10 @@ description: Javascript OpenRewrite recipes. ## Categories -* [Cleanup](/recipes/javascript/cleanup) -* [Dependencies](/recipes/javascript/dependencies) -* [Format](/recipes/javascript/format) -* [Migrate](/recipes/javascript/migrate) * [Search](/recipes/javascript/search) ## Recipes -* [Change import](./change-import.md) * [Change method name](./changemethodname.md) * [Change type](./changetype.md) * [Delete method argument](./deletemethodargument.md) diff --git c/docs/recipes/javascript/change-import.md i/docs/recipes/javascript/change-import.md deleted file mode 100644 index 7e643eaeb2..0000000000 --- c/docs/recipes/javascript/change-import.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -sidebar_label: "Change import" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Change import - -**org.openrewrite.javascript.change-import** - -_Changes an import from one module/member to another, updating all type attributions._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.change-import](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.change-import), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `null` | oldModule | The module to change imports from | `react-dom/test-utils` | -| `null` | oldMember | The member to change (or 'default' for default imports, '*' for namespace imports) | `act` | -| `null` | newModule | The module to change imports to | `react` | -| `null` | newMember | *Optional*. The new member name. If not specified, keeps the same member name. | `act` | -| `null` | newAlias | *Optional*. Optional alias for the new import. Required when newMember is 'default' or '*'. | | - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.change-import -``` diff --git c/docs/recipes/javascript/cleanup/README.md i/docs/recipes/javascript/cleanup/README.md deleted file mode 100644 index bca5006cbf..0000000000 --- c/docs/recipes/javascript/cleanup/README.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -description: Cleanup OpenRewrite recipes. ---- - -# Cleanup - -## Recipes - -* [Add radix to `parseInt`](./add-parse-int-radix.md) -* [Detect async callbacks in synchronous array methods](./async-callback-in-sync-array-method.md) -* [Order imports](./order-imports.md) -* [Prefer optional chaining](./prefer-optional-chain.md) -* [Use object property shorthand](./use-object-property-shorthand.md) - - diff --git c/docs/recipes/javascript/cleanup/add-parse-int-radix.md i/docs/recipes/javascript/cleanup/add-parse-int-radix.md deleted file mode 100644 index a934d645d0..0000000000 --- c/docs/recipes/javascript/cleanup/add-parse-int-radix.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Add radix to `parseInt`" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Add radix to `parseInt` - -**org.openrewrite.javascript.cleanup.add-parse-int-radix** - -_Adds the radix parameter (base 10) to `parseInt()` calls that are missing it, preventing potential parsing issues._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.cleanup.add-parse-int-radix](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.cleanup.add-parse-int-radix), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.cleanup.add-parse-int-radix -``` diff --git c/docs/recipes/javascript/cleanup/async-callback-in-sync-array-method.md i/docs/recipes/javascript/cleanup/async-callback-in-sync-array-method.md deleted file mode 100644 index 6e30276d76..0000000000 --- c/docs/recipes/javascript/cleanup/async-callback-in-sync-array-method.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -sidebar_label: "Detect async callbacks in synchronous array methods" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Detect async callbacks in synchronous array methods - -**org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method** - -_Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy._ - -### Tags - -* [async](/reference/recipes-by-tag#async) -* [bug](/reference/recipes-by-tag#bug) -* [cleanup](/reference/recipes-by-tag#cleanup) -* [typescript](/reference/recipes-by-tag#typescript) -* [javascript](/reference/recipes-by-tag#javascript) - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method -``` diff --git c/docs/recipes/javascript/cleanup/order-imports.md i/docs/recipes/javascript/cleanup/order-imports.md deleted file mode 100644 index 87cc8e49dc..0000000000 --- c/docs/recipes/javascript/cleanup/order-imports.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Order imports" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Order imports - -**org.openrewrite.javascript.cleanup.order-imports** - -_Sort imports by category and module path. Categories: side-effect, namespace, default, named, type. Within each category, imports are sorted alphabetically by module path. Named specifiers within each import are also sorted alphabetically._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.cleanup.order-imports](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.cleanup.order-imports), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.cleanup.order-imports -``` diff --git c/docs/recipes/javascript/cleanup/prefer-optional-chain.md i/docs/recipes/javascript/cleanup/prefer-optional-chain.md deleted file mode 100644 index 6e0cc57859..0000000000 --- c/docs/recipes/javascript/cleanup/prefer-optional-chain.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Prefer optional chaining" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Prefer optional chaining - -**org.openrewrite.javascript.cleanup.prefer-optional-chain** - -_Converts ternary expressions like `foo ? foo.bar : undefined` to use optional chaining syntax `foo?.bar`._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.cleanup.prefer-optional-chain](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.cleanup.prefer-optional-chain), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.cleanup.prefer-optional-chain -``` diff --git c/docs/recipes/javascript/cleanup/use-object-property-shorthand.md i/docs/recipes/javascript/cleanup/use-object-property-shorthand.md deleted file mode 100644 index 832f4125d8..0000000000 --- c/docs/recipes/javascript/cleanup/use-object-property-shorthand.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Use object property shorthand" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Use object property shorthand - -**org.openrewrite.javascript.cleanup.use-object-property-shorthand** - -_Simplifies object properties where the property name and value/variable name are the same (e.g., `{ x: x }` becomes `{ x }`). Applies to both destructuring patterns and object literals._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.cleanup.use-object-property-shorthand](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.cleanup.use-object-property-shorthand), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.cleanup.use-object-property-shorthand -``` diff --git c/docs/recipes/javascript/dependencies/README.md i/docs/recipes/javascript/dependencies/README.md deleted file mode 100644 index 154192622f..0000000000 --- c/docs/recipes/javascript/dependencies/README.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -description: Dependencies OpenRewrite recipes. ---- - -# Dependencies - -## Recipes - -* [Add npm dependency](./add-dependency.md) -* [Find Node.js dependency](./find-dependency.md) -* [Upgrade npm dependency version](./upgrade-dependency-version.md) -* [Upgrade transitive npm dependency version](./upgrade-transitive-dependency-version.md) - - diff --git c/docs/recipes/javascript/dependencies/add-dependency.md i/docs/recipes/javascript/dependencies/add-dependency.md deleted file mode 100644 index c824895493..0000000000 --- c/docs/recipes/javascript/dependencies/add-dependency.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -sidebar_label: "Add npm dependency" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Add npm dependency - -**org.openrewrite.javascript.dependencies.add-dependency** - -_Adds a new dependency to `package.json` and updates the lock file by running the package manager._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.dependencies.add-dependency](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.dependencies.add-dependency), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `null` | packageName | The name of the npm package to add (e.g., `lodash`, `@types/node`) | `lodash` | -| `null` | version | The version constraint to set (e.g., `^5.0.0`, `~2.1.0`, `3.0.0`) | `^5.0.0` | -| `null` | scope | *Optional*. The dependency scope: `dependencies`, `devDependencies`, `peerDependencies`, or `optionalDependencies` | `dependencies` | - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.dependencies.add-dependency -``` diff --git c/docs/recipes/javascript/dependencies/find-dependency.md i/docs/recipes/javascript/dependencies/find-dependency.md deleted file mode 100644 index f57deba2a6..0000000000 --- c/docs/recipes/javascript/dependencies/find-dependency.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -sidebar_label: "Find Node.js dependency" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Find Node.js dependency - -**org.openrewrite.javascript.dependencies.find-dependency** - -_Finds dependencies in a project's `package.json`. Can find both direct dependencies and dependencies that transitively include the target package. This recipe is commonly used as a precondition for other recipes._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.dependencies.find-dependency](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.dependencies.find-dependency), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `null` | packageName | The name of the npm package to find. Supports glob patterns. | `lodash` | -| `null` | version | *Optional*. An exact version number or semver selector used to select the version number. Leave empty to match any version. | `^18.0.0` | -| `null` | onlyDirect | *Optional*. If true (default), only matches dependencies that directly match the package name. If false, also marks direct dependencies that have the target package as a transitive dependency. | `true` | - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.dependencies.find-dependency -``` diff --git c/docs/recipes/javascript/dependencies/upgrade-dependency-version.md i/docs/recipes/javascript/dependencies/upgrade-dependency-version.md deleted file mode 100644 index 2bcda36913..0000000000 --- c/docs/recipes/javascript/dependencies/upgrade-dependency-version.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -sidebar_label: "Upgrade npm dependency version" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Upgrade npm dependency version - -**org.openrewrite.javascript.dependencies.upgrade-dependency-version** - -_Upgrades the version of a direct dependency in `package.json` and updates the lock file by running the package manager._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.dependencies.upgrade-dependency-version](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.dependencies.upgrade-dependency-version), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `null` | packageName | The name of the npm package to upgrade (e.g., `lodash`, `@types/node`) | `lodash` | -| `null` | newVersion | The version constraint to set (e.g., `^5.0.0`, `~2.1.0`, `3.0.0`) | `^5.0.0` | - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.dependencies.upgrade-dependency-version -``` diff --git c/docs/recipes/javascript/dependencies/upgrade-transitive-dependency-version.md i/docs/recipes/javascript/dependencies/upgrade-transitive-dependency-version.md deleted file mode 100644 index 34c2cf4a47..0000000000 --- c/docs/recipes/javascript/dependencies/upgrade-transitive-dependency-version.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -sidebar_label: "Upgrade transitive npm dependency version" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Upgrade transitive npm dependency version - -**org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version** - -_Upgrades the version of a transitive dependency by adding override/resolution entries to `package.json` and updates the lock file by running the package manager._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `null` | packageName | The name of the npm package to upgrade (e.g., `lodash`, `@types/node`) | `lodash` | -| `null` | newVersion | The version constraint to set (e.g., `^5.0.0`, `~2.1.0`, `3.0.0`) | `^5.0.0` | -| `null` | dependencyPath | *Optional*. Optional path to scope the override to a specific dependency chain. Use '>' as separator (e.g., 'express>accepts'). When not specified, applies globally to all transitive occurrences. | `express>accepts` | - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version -``` diff --git c/docs/recipes/javascript/format/README.md i/docs/recipes/javascript/format/README.md deleted file mode 100644 index d64e1bc88b..0000000000 --- c/docs/recipes/javascript/format/README.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -description: Format OpenRewrite recipes. ---- - -# Format - -## Recipes - -* [Auto-format JavaScript/TypeScript code](./auto-format.md) - - diff --git c/docs/recipes/javascript/format/auto-format.md i/docs/recipes/javascript/format/auto-format.md deleted file mode 100644 index 59cdfc8c70..0000000000 --- c/docs/recipes/javascript/format/auto-format.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Auto-format JavaScript/TypeScript code" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Auto-format JavaScript/TypeScript code - -**org.openrewrite.javascript.format.auto-format** - -_Format JavaScript and TypeScript code using formatting rules auto-detected from the project's existing code style._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.format.auto-format](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.format.auto-format), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.format.auto-format -``` diff --git c/docs/recipes/javascript/migrate/README.md i/docs/recipes/javascript/migrate/README.md deleted file mode 100644 index 4e5cf01c73..0000000000 --- c/docs/recipes/javascript/migrate/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -description: Migrate OpenRewrite recipes. ---- - -# Migrate - -## Categories - -* [Es6](/recipes/javascript/migrate/es6) -* [Typescript](/recipes/javascript/migrate/typescript) - - diff --git c/docs/recipes/javascript/migrate/es6/README.md i/docs/recipes/javascript/migrate/es6/README.md deleted file mode 100644 index 3ad0cbe566..0000000000 --- c/docs/recipes/javascript/migrate/es6/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -description: Es6 OpenRewrite recipes. ---- - -# Es6 - -## Recipes - -* [Modernize octal escape sequences](./modernize-octal-escape-sequences.md) -* [Modernize octal literals](./modernize-octal-literals.md) -* [Remove duplicate object keys](./remove-duplicate-object-keys.md) - - diff --git c/docs/recipes/javascript/migrate/es6/modernize-octal-escape-sequences.md i/docs/recipes/javascript/migrate/es6/modernize-octal-escape-sequences.md deleted file mode 100644 index 7386242b49..0000000000 --- c/docs/recipes/javascript/migrate/es6/modernize-octal-escape-sequences.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -sidebar_label: "Modernize octal escape sequences" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Modernize octal escape sequences - -**org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences** - -_Convert old-style octal escape sequences (e.g., `\0`, `\123`) to modern hex escape sequences (e.g., `\x00`, `\x53`) or Unicode escape sequences (e.g., `\u0000`, `\u0053`)._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `null` | useUnicodeEscapes | *Optional*. Use Unicode escape sequences (`\uXXXX`) instead of hex escape sequences (`\xXX`). Default is `false`. | `true` | - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences -``` diff --git c/docs/recipes/javascript/migrate/es6/modernize-octal-literals.md i/docs/recipes/javascript/migrate/es6/modernize-octal-literals.md deleted file mode 100644 index 8444707c22..0000000000 --- c/docs/recipes/javascript/migrate/es6/modernize-octal-literals.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Modernize octal literals" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Modernize octal literals - -**org.openrewrite.javascript.migrate.es6.modernize-octal-literals** - -_Convert old-style octal literals (e.g., `0777`) to modern ES6 syntax (e.g., `0o777`)._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.migrate.es6.modernize-octal-literals](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.migrate.es6.modernize-octal-literals), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.migrate.es6.modernize-octal-literals -``` diff --git c/docs/recipes/javascript/migrate/es6/remove-duplicate-object-keys.md i/docs/recipes/javascript/migrate/es6/remove-duplicate-object-keys.md deleted file mode 100644 index 2e5941767a..0000000000 --- c/docs/recipes/javascript/migrate/es6/remove-duplicate-object-keys.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Remove duplicate object keys" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Remove duplicate object keys - -**org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys** - -_Remove duplicate keys in object literals, keeping only the last occurrence (last-wins semantics)._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys -``` diff --git c/docs/recipes/javascript/migrate/typescript/README.md i/docs/recipes/javascript/migrate/typescript/README.md deleted file mode 100644 index fc27fa1a37..0000000000 --- c/docs/recipes/javascript/migrate/typescript/README.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -description: Typescript OpenRewrite recipes. ---- - -# Typescript - -## Recipes - -* [Convert `export =` to `export default`](./export-assignment-to-export-default.md) - - diff --git c/docs/recipes/javascript/migrate/typescript/export-assignment-to-export-default.md i/docs/recipes/javascript/migrate/typescript/export-assignment-to-export-default.md deleted file mode 100644 index ffb5016b10..0000000000 --- c/docs/recipes/javascript/migrate/typescript/export-assignment-to-export-default.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Convert `export =` to `export default`" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Convert `export =` to `export default` - -**org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default** - -_Converts TypeScript `export =` syntax to ES module `export default` syntax for compatibility with ECMAScript modules._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default -``` --- docs/recipes/csharp/search/findtypes.md | 252 ----------------- docs/recipes/gitlab/adddefaultkeyword.md | 252 ----------------- docs/recipes/gitlab/addtimeout.md | 259 ------------------ .../messageformattoparameterizedlogging.md | 239 ---------------- .../slf4j/removeunnecessaryloglevelguards.md | 239 ---------------- .../stringformattoparameterizedlogging.md | 239 ---------------- .../migrate/lombok/useallargsconstructor.md | 234 ---------------- .../lombok/userequiredargsconstructor.md | 234 ---------------- .../replacemockitotestexecutionlistener.md | 234 ---------------- .../mockito/replacepowermockdependencies.md | 234 ---------------- docs/recipes/javascript/README.md | 5 - docs/recipes/javascript/change-import.md | 48 ---- docs/recipes/javascript/cleanup/README.md | 15 - .../javascript/cleanup/add-parse-int-radix.md | 38 --- .../async-callback-in-sync-array-method.md | 46 ---- .../javascript/cleanup/order-imports.md | 38 --- .../cleanup/prefer-optional-chain.md | 38 --- .../cleanup/use-object-property-shorthand.md | 38 --- .../recipes/javascript/dependencies/README.md | 14 - .../javascript/dependencies/add-dependency.md | 46 ---- .../dependencies/find-dependency.md | 46 ---- .../upgrade-dependency-version.md | 45 --- .../upgrade-transitive-dependency-version.md | 46 ---- docs/recipes/javascript/format/README.md | 11 - docs/recipes/javascript/format/auto-format.md | 38 --- docs/recipes/javascript/migrate/README.md | 12 - docs/recipes/javascript/migrate/es6/README.md | 13 - .../es6/modernize-octal-escape-sequences.md | 44 --- .../migrate/es6/modernize-octal-literals.md | 38 --- .../es6/remove-duplicate-object-keys.md | 38 --- .../javascript/migrate/typescript/README.md | 11 - .../export-assignment-to-export-default.md | 38 --- 32 files changed, 3122 deletions(-) delete mode 100644 docs/recipes/csharp/search/findtypes.md delete mode 100644 docs/recipes/gitlab/adddefaultkeyword.md delete mode 100644 docs/recipes/gitlab/addtimeout.md delete mode 100644 docs/recipes/java/logging/slf4j/messageformattoparameterizedlogging.md delete mode 100644 docs/recipes/java/logging/slf4j/removeunnecessaryloglevelguards.md delete mode 100644 docs/recipes/java/logging/slf4j/stringformattoparameterizedlogging.md delete mode 100644 docs/recipes/java/migrate/lombok/useallargsconstructor.md delete mode 100644 docs/recipes/java/migrate/lombok/userequiredargsconstructor.md delete mode 100644 docs/recipes/java/testing/mockito/replacemockitotestexecutionlistener.md delete mode 100644 docs/recipes/java/testing/mockito/replacepowermockdependencies.md delete mode 100644 docs/recipes/javascript/change-import.md delete mode 100644 docs/recipes/javascript/cleanup/README.md delete mode 100644 docs/recipes/javascript/cleanup/add-parse-int-radix.md delete mode 100644 docs/recipes/javascript/cleanup/async-callback-in-sync-array-method.md delete mode 100644 docs/recipes/javascript/cleanup/order-imports.md delete mode 100644 docs/recipes/javascript/cleanup/prefer-optional-chain.md delete mode 100644 docs/recipes/javascript/cleanup/use-object-property-shorthand.md delete mode 100644 docs/recipes/javascript/dependencies/README.md delete mode 100644 docs/recipes/javascript/dependencies/add-dependency.md delete mode 100644 docs/recipes/javascript/dependencies/find-dependency.md delete mode 100644 docs/recipes/javascript/dependencies/upgrade-dependency-version.md delete mode 100644 docs/recipes/javascript/dependencies/upgrade-transitive-dependency-version.md delete mode 100644 docs/recipes/javascript/format/README.md delete mode 100644 docs/recipes/javascript/format/auto-format.md delete mode 100644 docs/recipes/javascript/migrate/README.md delete mode 100644 docs/recipes/javascript/migrate/es6/README.md delete mode 100644 docs/recipes/javascript/migrate/es6/modernize-octal-escape-sequences.md delete mode 100644 docs/recipes/javascript/migrate/es6/modernize-octal-literals.md delete mode 100644 docs/recipes/javascript/migrate/es6/remove-duplicate-object-keys.md delete mode 100644 docs/recipes/javascript/migrate/typescript/README.md delete mode 100644 docs/recipes/javascript/migrate/typescript/export-assignment-to-export-default.md diff --git a/docs/recipes/csharp/search/findtypes.md b/docs/recipes/csharp/search/findtypes.md deleted file mode 100644 index afd6cef86b..0000000000 --- a/docs/recipes/csharp/search/findtypes.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -sidebar_label: "Find types" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Find types - -**org.openrewrite.java.search.FindTypes** - -_Find type references by name._ - -:::info -This Java recipe works on Csharp code. -::: - -## Recipe source - -[GitHub: FindTypes.java](https://github.com/openrewrite/rewrite/blob/main/rewrite-java/src/main/java/org/openrewrite/java/search/FindTypes.java), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-java/) - -This recipe is available under the [Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `String` | fullyQualifiedTypeName | A fully-qualified type name, that is used to find matching type references. Supports glob expressions. `java..*` finds every type from every subpackage of the `java` package. | `java.util.List` | -| `Boolean` | checkAssignability | *Optional*. When enabled, find type references that are assignable to the provided type. | | - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [Find deprecated `PathMatcher` usage](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/java/spring/framework/finddeprecatedpathmatcherusage) -* [Report types deprecated or removed in WebLogic version 14.1.2](/recipes/com/oracle/weblogic/rewrite/reportdeprecatedorremoved1412.md) -* [Report types deprecated or removed in WebLogic version 15.1.1](/recipes/com/oracle/weblogic/rewrite/reportdeprecatedorremoved1511.md) - -## Example - -###### Parameters -| Parameter | Value | -| --- | --- | -|fullyQualifiedTypeName|`a.A1`| -|checkAssignability|`false`| - - - - - - -###### Before -```java -import a.A1; -public class B extends A1 {} -``` - -###### After -```java -import a.A1; -public class B extends /*~~>*/A1 {} -``` - - - - -```diff -@@ -2,1 +2,1 @@ -import a.A1; --public class B extends A1 {} -+public class B extends /*~~>*/A1 {} - -``` - - - - -## Usage - -This recipe has required configuration parameters. Recipes with required configuration parameters cannot be activated directly (unless you are running them via the Moderne CLI). To activate this recipe you must create a new recipe which fills in the required parameters. In your `rewrite.yml` create a new recipe with a unique name. For example: `com.yourorg.FindTypesExample`. -Here's how you can define and customize such a recipe within your rewrite.yml: -```yaml title="rewrite.yml" ---- -type: specs.openrewrite.org/v1beta/recipe -name: com.yourorg.FindTypesExample -displayName: Find types example -recipeList: - - org.openrewrite.java.search.FindTypes: - fullyQualifiedTypeName: java.util.List -``` - -Now that `com.yourorg.FindTypesExample` has been defined, activate it in your build file: - - - -1. Add the following to your `build.gradle` file: -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("com.yourorg.FindTypesExample") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} -``` -2. Run `gradle rewriteRun` to run the recipe. - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - com.yourorg.FindTypesExample - - - - - - -``` -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe FindTypes --recipe-option "fullyQualifiedTypeName=java.util.List" -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite:rewrite-java:{{VERSION_ORG_OPENREWRITE_REWRITE_JAVA}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Type uses -**org.openrewrite.java.table.TypeUses** - -_The source code of matching type uses._ - -| Column Name | Description | -| ----------- | ----------- | -| Source file | The source file that the method call occurred in. | -| Source | The source code of the type use. | -| Concrete type | The concrete type in use, which may be a subtype of a searched type. | - - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git a/docs/recipes/gitlab/adddefaultkeyword.md b/docs/recipes/gitlab/adddefaultkeyword.md deleted file mode 100644 index ca1dd4c0d2..0000000000 --- a/docs/recipes/gitlab/adddefaultkeyword.md +++ /dev/null @@ -1,252 +0,0 @@ ---- -sidebar_label: "Add default keyword" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Add default keyword - -**org.openrewrite.gitlab.AddDefaultKeyword** - -_Add or update a keyword in the `default` section of `.gitlab-ci.yml`._ - -## Recipe source - -[GitHub: AddDefaultKeyword.java](https://github.com/openrewrite/rewrite-gitlab/blob/main/src/main/java/org/openrewrite/gitlab/AddDefaultKeyword.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-gitlab/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-gitlab/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `String` | keyword | The keyword to add under the `default` section. | `image` | -| `String` | value | The value for the keyword. | `ruby:3.0` | -| `Boolean` | acceptTheirs | *Optional*. When the keyword already exists, prefer the original value. | | - - -## Definition - - - -* [Merge YAML snippet](../yaml/mergeyaml) - * key: `$` - * yaml: `default: null: null` - * filePattern: `.gitlab-ci.yml` - - - - - -```yaml ---- -type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.gitlab.AddDefaultKeyword -displayName: Add default keyword -description: | - Add or update a keyword in the `default` section of `.gitlab-ci.yml`. - - - -recipeList: - - org.openrewrite.yaml.MergeYaml: - key: $ - yaml: default: - null: null - filePattern: .gitlab-ci.yml - -``` - - -## Example - -###### Parameters -| Parameter | Value | -| --- | --- | -|keyword|`image`| -|value|`ruby:3.0`| -|acceptTheirs|`null`| - - - -###### New file -```yaml title=".gitlab-ci.yml" -default: - image: ruby:3.0 -``` - - - -## Usage - -This recipe has required configuration parameters. Recipes with required configuration parameters cannot be activated directly (unless you are running them via the Moderne CLI). To activate this recipe you must create a new recipe which fills in the required parameters. In your `rewrite.yml` create a new recipe with a unique name. For example: `com.yourorg.AddDefaultKeywordExample`. -Here's how you can define and customize such a recipe within your rewrite.yml: -```yaml title="rewrite.yml" ---- -type: specs.openrewrite.org/v1beta/recipe -name: com.yourorg.AddDefaultKeywordExample -displayName: Add default keyword example -recipeList: - - org.openrewrite.gitlab.AddDefaultKeyword: - keyword: image - value: ruby:3.0 -``` - -Now that `com.yourorg.AddDefaultKeywordExample` has been defined, activate it and take a dependency on `org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}}` in your build file: - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("com.yourorg.AddDefaultKeywordExample") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}}") -} -``` -2. Run `gradle rewriteRun` to run the recipe. - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - com.yourorg.AddDefaultKeywordExample - - - - - org.openrewrite.recipe - rewrite-gitlab - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}} - - - - - - -``` -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe AddDefaultKeyword --recipe-option "keyword=image" --recipe-option "value=ruby:3.0" -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git a/docs/recipes/gitlab/addtimeout.md b/docs/recipes/gitlab/addtimeout.md deleted file mode 100644 index 9ff82e3838..0000000000 --- a/docs/recipes/gitlab/addtimeout.md +++ /dev/null @@ -1,259 +0,0 @@ ---- -sidebar_label: "Add job timeout" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Add job timeout - -**org.openrewrite.gitlab.AddTimeout** - -_Set `timeout` in `.gitlab-ci.yml` to prevent jobs from hanging indefinitely._ - -## Recipe source - -[GitHub: AddTimeout.java](https://github.com/openrewrite/rewrite-gitlab/blob/main/src/main/java/org/openrewrite/gitlab/AddTimeout.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-gitlab/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-gitlab/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `String` | timeout | The timeout duration. | `1 hour` | -| `String` | jobName | *Optional*. The job to set timeout on. If not provided, applies to the `default` section. | `build_job` | -| `Boolean` | acceptTheirs | *Optional*. When the setting already exists, prefer the original value. | | - - -## Definition - - - -* [Merge YAML snippet](../yaml/mergeyaml) - * key: `$` - * yaml: `default: timeout: null` - * filePattern: `.gitlab-ci.yml` - - - - - -```yaml ---- -type: specs.openrewrite.org/v1beta/recipe -name: org.openrewrite.gitlab.AddTimeout -displayName: Add job timeout -description: | - Set `timeout` in `.gitlab-ci.yml` to prevent jobs from hanging indefinitely. - - - -recipeList: - - org.openrewrite.yaml.MergeYaml: - key: $ - yaml: default: - timeout: null - filePattern: .gitlab-ci.yml - -``` - - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [GitLab CI best practices](/recipes/gitlab/bestpractices.md) - -## Example - -###### Parameters -| Parameter | Value | -| --- | --- | -|timeout|`1 hour`| -|jobName|`null`| -|acceptTheirs|`null`| - - - -###### New file -```yaml title=".gitlab-ci.yml" -default: - timeout: 1 hour -``` - - - -## Usage - -This recipe has required configuration parameters. Recipes with required configuration parameters cannot be activated directly (unless you are running them via the Moderne CLI). To activate this recipe you must create a new recipe which fills in the required parameters. In your `rewrite.yml` create a new recipe with a unique name. For example: `com.yourorg.AddTimeoutExample`. -Here's how you can define and customize such a recipe within your rewrite.yml: -```yaml title="rewrite.yml" ---- -type: specs.openrewrite.org/v1beta/recipe -name: com.yourorg.AddTimeoutExample -displayName: Add job timeout example -recipeList: - - org.openrewrite.gitlab.AddTimeout: - timeout: 1 hour - jobName: build_job -``` - -Now that `com.yourorg.AddTimeoutExample` has been defined, activate it and take a dependency on `org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}}` in your build file: - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("com.yourorg.AddTimeoutExample") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}}") -} -``` -2. Run `gradle rewriteRun` to run the recipe. - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - com.yourorg.AddTimeoutExample - - - - - org.openrewrite.recipe - rewrite-gitlab - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}} - - - - - - -``` -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe AddTimeout --recipe-option "timeout=1 hour" --recipe-option "jobName=build_job" -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git a/docs/recipes/java/logging/slf4j/messageformattoparameterizedlogging.md b/docs/recipes/java/logging/slf4j/messageformattoparameterizedlogging.md deleted file mode 100644 index 0725068486..0000000000 --- a/docs/recipes/java/logging/slf4j/messageformattoparameterizedlogging.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -sidebar_label: "`MessageFormat.format()` in logging statements should use SLF4J parameterized logging" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# `MessageFormat.format()` in logging statements should use SLF4J parameterized logging - -**org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging** - -_Replace `MessageFormat.format()` calls in SLF4J logging statements with parameterized placeholders for improved performance._ - -### Tags - -* [slf4j](/reference/recipes-by-tag#slf4j) -* [logging](/reference/recipes-by-tag#logging) - -## Recipe source - -[GitHub: MessageFormatToParameterizedLogging.java](https://github.com/openrewrite/rewrite-logging-frameworks/blob/main/src/main/java/org/openrewrite/java/logging/slf4j/MessageFormatToParameterizedLogging.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-logging-frameworks/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-logging-frameworks/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [SLF4J best practices](/recipes/java/logging/slf4j/slf4jbestpractices.md) - - -## Usage - -This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-logging-frameworks` in your build file or by running a shell command (in which case no build changes are needed): - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") -} -``` - -2. Run `gradle rewriteRun` to run the recipe. - - - - -1. Create a file named `init.gradle` in the root of your project. - -```groovy title="init.gradle" -initscript { - repositories { - maven { url "https://plugins.gradle.org/m2" } - } - dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } -} -rootProject { - plugins.apply(org.openrewrite.gradle.RewritePlugin) - dependencies { - rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") - } - rewrite { - activeRecipe("org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging") - setExportDatatables(true) - } - afterEvaluate { - if (repositories.isEmpty()) { - repositories { - mavenCentral() - } - } - } -} -``` - -2. Run the recipe. - -```shell title="shell" -gradle --init-script init.gradle rewriteRun -``` - - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging - - - - - org.openrewrite.recipe - rewrite-logging-frameworks - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} - - - - - - -``` - -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. - -```shell title="shell" -mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-logging-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging -Drewrite.exportDatatables=true -``` - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe MessageFormatToParameterizedLogging -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git a/docs/recipes/java/logging/slf4j/removeunnecessaryloglevelguards.md b/docs/recipes/java/logging/slf4j/removeunnecessaryloglevelguards.md deleted file mode 100644 index 87b9b363d1..0000000000 --- a/docs/recipes/java/logging/slf4j/removeunnecessaryloglevelguards.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -sidebar_label: "Remove unnecessary log level guards" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Remove unnecessary log level guards - -**org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards** - -_Remove `if` statement guards around SLF4J logging calls when parameterized logging makes them unnecessary._ - -### Tags - -* [slf4j](/reference/recipes-by-tag#slf4j) -* [logging](/reference/recipes-by-tag#logging) - -## Recipe source - -[GitHub: RemoveUnnecessaryLogLevelGuards.java](https://github.com/openrewrite/rewrite-logging-frameworks/blob/main/src/main/java/org/openrewrite/java/logging/slf4j/RemoveUnnecessaryLogLevelGuards.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-logging-frameworks/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-logging-frameworks/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [SLF4J best practices](/recipes/java/logging/slf4j/slf4jbestpractices.md) - - -## Usage - -This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-logging-frameworks` in your build file or by running a shell command (in which case no build changes are needed): - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") -} -``` - -2. Run `gradle rewriteRun` to run the recipe. - - - - -1. Create a file named `init.gradle` in the root of your project. - -```groovy title="init.gradle" -initscript { - repositories { - maven { url "https://plugins.gradle.org/m2" } - } - dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } -} -rootProject { - plugins.apply(org.openrewrite.gradle.RewritePlugin) - dependencies { - rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") - } - rewrite { - activeRecipe("org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards") - setExportDatatables(true) - } - afterEvaluate { - if (repositories.isEmpty()) { - repositories { - mavenCentral() - } - } - } -} -``` - -2. Run the recipe. - -```shell title="shell" -gradle --init-script init.gradle rewriteRun -``` - - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards - - - - - org.openrewrite.recipe - rewrite-logging-frameworks - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} - - - - - - -``` - -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. - -```shell title="shell" -mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-logging-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards -Drewrite.exportDatatables=true -``` - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe RemoveUnnecessaryLogLevelGuards -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git a/docs/recipes/java/logging/slf4j/stringformattoparameterizedlogging.md b/docs/recipes/java/logging/slf4j/stringformattoparameterizedlogging.md deleted file mode 100644 index 5fa00d32f7..0000000000 --- a/docs/recipes/java/logging/slf4j/stringformattoparameterizedlogging.md +++ /dev/null @@ -1,239 +0,0 @@ ---- -sidebar_label: "`String.format()` in logging statements should use SLF4J parameterized logging" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# `String.format()` in logging statements should use SLF4J parameterized logging - -**org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging** - -_Replace `String.format()` calls in SLF4J logging statements with parameterized placeholders for improved performance._ - -### Tags - -* [slf4j](/reference/recipes-by-tag#slf4j) -* [logging](/reference/recipes-by-tag#logging) - -## Recipe source - -[GitHub: StringFormatToParameterizedLogging.java](https://github.com/openrewrite/rewrite-logging-frameworks/blob/main/src/main/java/org/openrewrite/java/logging/slf4j/StringFormatToParameterizedLogging.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-logging-frameworks/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-logging-frameworks/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [SLF4J best practices](/recipes/java/logging/slf4j/slf4jbestpractices.md) - - -## Usage - -This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-logging-frameworks` in your build file or by running a shell command (in which case no build changes are needed): - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") -} -``` - -2. Run `gradle rewriteRun` to run the recipe. - - - - -1. Create a file named `init.gradle` in the root of your project. - -```groovy title="init.gradle" -initscript { - repositories { - maven { url "https://plugins.gradle.org/m2" } - } - dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } -} -rootProject { - plugins.apply(org.openrewrite.gradle.RewritePlugin) - dependencies { - rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") - } - rewrite { - activeRecipe("org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging") - setExportDatatables(true) - } - afterEvaluate { - if (repositories.isEmpty()) { - repositories { - mavenCentral() - } - } - } -} -``` - -2. Run the recipe. - -```shell title="shell" -gradle --init-script init.gradle rewriteRun -``` - - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging - - - - - org.openrewrite.recipe - rewrite-logging-frameworks - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} - - - - - - -``` - -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. - -```shell title="shell" -mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-logging-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging -Drewrite.exportDatatables=true -``` - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe StringFormatToParameterizedLogging -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git a/docs/recipes/java/migrate/lombok/useallargsconstructor.md b/docs/recipes/java/migrate/lombok/useallargsconstructor.md deleted file mode 100644 index 3a1d2cf798..0000000000 --- a/docs/recipes/java/migrate/lombok/useallargsconstructor.md +++ /dev/null @@ -1,234 +0,0 @@ ---- -sidebar_label: "Use `@AllArgsConstructor` where applicable" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Use `@AllArgsConstructor` where applicable - -**org.openrewrite.java.migrate.lombok.UseAllArgsConstructor** - -_Prefer the Lombok `@AllArgsConstructor` annotation over explicitly written out constructors that assign all non-static fields._ - -## Recipe source - -[GitHub: UseAllArgsConstructor.java](https://github.com/openrewrite/rewrite-migrate-java/blob/main/src/main/java/org/openrewrite/java/migrate/lombok/UseAllArgsConstructor.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-migrate-java/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-migrate-java/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [Lombok Best Practices](/recipes/java/migrate/lombok/lombokbestpractices.md) - - -## Usage - -This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-migrate-java` in your build file or by running a shell command (in which case no build changes are needed): - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("org.openrewrite.java.migrate.lombok.UseAllArgsConstructor") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}}") -} -``` - -2. Run `gradle rewriteRun` to run the recipe. - - - - -1. Create a file named `init.gradle` in the root of your project. - -```groovy title="init.gradle" -initscript { - repositories { - maven { url "https://plugins.gradle.org/m2" } - } - dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } -} -rootProject { - plugins.apply(org.openrewrite.gradle.RewritePlugin) - dependencies { - rewrite("org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}}") - } - rewrite { - activeRecipe("org.openrewrite.java.migrate.lombok.UseAllArgsConstructor") - setExportDatatables(true) - } - afterEvaluate { - if (repositories.isEmpty()) { - repositories { - mavenCentral() - } - } - } -} -``` - -2. Run the recipe. - -```shell title="shell" -gradle --init-script init.gradle rewriteRun -``` - - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - org.openrewrite.java.migrate.lombok.UseAllArgsConstructor - - - - - org.openrewrite.recipe - rewrite-migrate-java - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}} - - - - - - -``` - -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. - -```shell title="shell" -mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.migrate.lombok.UseAllArgsConstructor -Drewrite.exportDatatables=true -``` - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe UseAllArgsConstructor -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git a/docs/recipes/java/migrate/lombok/userequiredargsconstructor.md b/docs/recipes/java/migrate/lombok/userequiredargsconstructor.md deleted file mode 100644 index b1c9b585b5..0000000000 --- a/docs/recipes/java/migrate/lombok/userequiredargsconstructor.md +++ /dev/null @@ -1,234 +0,0 @@ ---- -sidebar_label: "Use `@RequiredArgsConstructor` where applicable" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Use `@RequiredArgsConstructor` where applicable - -**org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor** - -_Prefer the Lombok `@RequiredArgsConstructor` annotation over explicitly written out constructors that only assign final fields._ - -## Recipe source - -[GitHub: UseRequiredArgsConstructor.java](https://github.com/openrewrite/rewrite-migrate-java/blob/main/src/main/java/org/openrewrite/java/migrate/lombok/UseRequiredArgsConstructor.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-migrate-java/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-migrate-java/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [Lombok Best Practices](/recipes/java/migrate/lombok/lombokbestpractices.md) - - -## Usage - -This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-migrate-java` in your build file or by running a shell command (in which case no build changes are needed): - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}}") -} -``` - -2. Run `gradle rewriteRun` to run the recipe. - - - - -1. Create a file named `init.gradle` in the root of your project. - -```groovy title="init.gradle" -initscript { - repositories { - maven { url "https://plugins.gradle.org/m2" } - } - dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } -} -rootProject { - plugins.apply(org.openrewrite.gradle.RewritePlugin) - dependencies { - rewrite("org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}}") - } - rewrite { - activeRecipe("org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor") - setExportDatatables(true) - } - afterEvaluate { - if (repositories.isEmpty()) { - repositories { - mavenCentral() - } - } - } -} -``` - -2. Run the recipe. - -```shell title="shell" -gradle --init-script init.gradle rewriteRun -``` - - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor - - - - - org.openrewrite.recipe - rewrite-migrate-java - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}} - - - - - - -``` - -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. - -```shell title="shell" -mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor -Drewrite.exportDatatables=true -``` - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe UseRequiredArgsConstructor -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git a/docs/recipes/java/testing/mockito/replacemockitotestexecutionlistener.md b/docs/recipes/java/testing/mockito/replacemockitotestexecutionlistener.md deleted file mode 100644 index 2ca00eb43d..0000000000 --- a/docs/recipes/java/testing/mockito/replacemockitotestexecutionlistener.md +++ /dev/null @@ -1,234 +0,0 @@ ---- -sidebar_label: "Replace `MockitoTestExecutionListener` with the equivalent Mockito test initialization" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Replace `MockitoTestExecutionListener` with the equivalent Mockito test initialization - -**org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener** - -_Replace `@TestExecutionListeners(MockitoTestExecutionListener.class)` with the appropriate Mockito initialization for the test framework in use: `@ExtendWith(MockitoExtension.class)` for JUnit 5, `@RunWith(MockitoJUnitRunner.class)` for JUnit 4, or `MockitoAnnotations.openMocks(this)` for TestNG._ - -## Recipe source - -[GitHub: ReplaceMockitoTestExecutionListener.java](https://github.com/openrewrite/rewrite-testing-frameworks/blob/main/src/main/java/org/openrewrite/java/testing/mockito/ReplaceMockitoTestExecutionListener.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-testing-frameworks/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-testing-frameworks/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [Mockito 3.x migration from 1.x](/recipes/java/testing/mockito/mockito1to3migration.md) - - -## Usage - -This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-testing-frameworks` in your build file or by running a shell command (in which case no build changes are needed): - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}}") -} -``` - -2. Run `gradle rewriteRun` to run the recipe. - - - - -1. Create a file named `init.gradle` in the root of your project. - -```groovy title="init.gradle" -initscript { - repositories { - maven { url "https://plugins.gradle.org/m2" } - } - dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } -} -rootProject { - plugins.apply(org.openrewrite.gradle.RewritePlugin) - dependencies { - rewrite("org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}}") - } - rewrite { - activeRecipe("org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener") - setExportDatatables(true) - } - afterEvaluate { - if (repositories.isEmpty()) { - repositories { - mavenCentral() - } - } - } -} -``` - -2. Run the recipe. - -```shell title="shell" -gradle --init-script init.gradle rewriteRun -``` - - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener - - - - - org.openrewrite.recipe - rewrite-testing-frameworks - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}} - - - - - - -``` - -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. - -```shell title="shell" -mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener -Drewrite.exportDatatables=true -``` - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe ReplaceMockitoTestExecutionListener -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git a/docs/recipes/java/testing/mockito/replacepowermockdependencies.md b/docs/recipes/java/testing/mockito/replacepowermockdependencies.md deleted file mode 100644 index d5a8e52d91..0000000000 --- a/docs/recipes/java/testing/mockito/replacepowermockdependencies.md +++ /dev/null @@ -1,234 +0,0 @@ ---- -sidebar_label: "Replace PowerMock dependencies with Mockito equivalents" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Replace PowerMock dependencies with Mockito equivalents - -**org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies** - -_Replaces PowerMock API dependencies with `mockito-inline` when `mockStatic()`, `whenNew()`, or `@PrepareForTest` usage is detected, or `mockito-core` otherwise. PowerMock features like static mocking, constructor mocking, and final class mocking require the inline mock maker which is bundled in `mockito-inline` for Mockito 3.x/4.x._ - -## Recipe source - -[GitHub: ReplacePowerMockDependencies.java](https://github.com/openrewrite/rewrite-testing-frameworks/blob/main/src/main/java/org/openrewrite/java/testing/mockito/ReplacePowerMockDependencies.java), -[Issue Tracker](https://github.com/openrewrite/rewrite-testing-frameworks/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-testing-frameworks/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Used by - -This recipe is used as part of the following composite recipes: - -* [Replace PowerMock with raw Mockito](/recipes/java/testing/mockito/replacepowermockito.md) - - -## Usage - -This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-testing-frameworks` in your build file or by running a shell command (in which case no build changes are needed): - - - -1. Add the following to your `build.gradle` file: - -```groovy title="build.gradle" -plugins { - id("org.openrewrite.rewrite") version("latest.release") -} - -rewrite { - activeRecipe("org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies") - setExportDatatables(true) -} - -repositories { - mavenCentral() -} - -dependencies { - rewrite("org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}}") -} -``` - -2. Run `gradle rewriteRun` to run the recipe. - - - - -1. Create a file named `init.gradle` in the root of your project. - -```groovy title="init.gradle" -initscript { - repositories { - maven { url "https://plugins.gradle.org/m2" } - } - dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } -} -rootProject { - plugins.apply(org.openrewrite.gradle.RewritePlugin) - dependencies { - rewrite("org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}}") - } - rewrite { - activeRecipe("org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies") - setExportDatatables(true) - } - afterEvaluate { - if (repositories.isEmpty()) { - repositories { - mavenCentral() - } - } - } -} -``` - -2. Run the recipe. - -```shell title="shell" -gradle --init-script init.gradle rewriteRun -``` - - - - -1. Add the following to your `pom.xml` file: - -```xml title="pom.xml" - - - - - org.openrewrite.maven - rewrite-maven-plugin - {{VERSION_REWRITE_MAVEN_PLUGIN}} - - true - - org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies - - - - - org.openrewrite.recipe - rewrite-testing-frameworks - {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}} - - - - - - -``` - -2. Run `mvn rewrite:run` to run the recipe. - - - -You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. - -```shell title="shell" -mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies -Drewrite.exportDatatables=true -``` - - - -You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. - -```shell title="shell" -mod run . --recipe ReplacePowerMockDependencies -``` - -If the recipe is not available locally, then you can install it using: -```shell -mod config recipes jar install org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}} -``` - - - -## See how this recipe works across multiple open-source repositories - -import RecipeCallout from '@site/src/components/ModerneLink'; - - - -The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. - -Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. -## Data Tables - - - - -### Source files that had results -**org.openrewrite.table.SourcesFileResults** - -_Source files that were modified by the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | -| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | -| Recipe that made changes | The specific recipe that made a change. | -| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | -| Cycle | The recipe cycle in which the change was made. | - - - - - -### Source files that had search results -**org.openrewrite.table.SearchResults** - -_Search results that were found during the recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path of search result before the run | The source path of the file with the search result markers present. | -| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | -| Result | The trimmed printed tree of the LST element that the marker is attached to. | -| Description | The content of the description of the marker. | -| Recipe that added the search marker | The specific recipe that added the Search marker. | - - - - - -### Source files that errored on a recipe -**org.openrewrite.table.SourcesFileErrors** - -_The details of all errors produced by a recipe run._ - -| Column Name | Description | -| ----------- | ----------- | -| Source path | The file that failed to parse. | -| Recipe that made changes | The specific recipe that made a change. | -| Stack trace | The stack trace of the failure. | - - - - - -### Recipe performance -**org.openrewrite.table.RecipeRunStats** - -_Statistics used in analyzing the performance of recipes._ - -| Column Name | Description | -| ----------- | ----------- | -| The recipe | The recipe whose stats are being measured both individually and cumulatively. | -| Source file count | The number of source files the recipe ran over. | -| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | -| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | -| Max scanning time (ns) | The max time scanning any one source file. | -| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | -| Max edit time (ns) | The max time editing any one source file. | - - - - diff --git a/docs/recipes/javascript/README.md b/docs/recipes/javascript/README.md index 12d0883bb3..ce94840433 100644 --- a/docs/recipes/javascript/README.md +++ b/docs/recipes/javascript/README.md @@ -6,15 +6,10 @@ description: Javascript OpenRewrite recipes. ## Categories -* [Cleanup](/recipes/javascript/cleanup) -* [Dependencies](/recipes/javascript/dependencies) -* [Format](/recipes/javascript/format) -* [Migrate](/recipes/javascript/migrate) * [Search](/recipes/javascript/search) ## Recipes -* [Change import](./change-import.md) * [Change method name](./changemethodname.md) * [Change type](./changetype.md) * [Delete method argument](./deletemethodargument.md) diff --git a/docs/recipes/javascript/change-import.md b/docs/recipes/javascript/change-import.md deleted file mode 100644 index 7e643eaeb2..0000000000 --- a/docs/recipes/javascript/change-import.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -sidebar_label: "Change import" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Change import - -**org.openrewrite.javascript.change-import** - -_Changes an import from one module/member to another, updating all type attributions._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.change-import](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.change-import), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `null` | oldModule | The module to change imports from | `react-dom/test-utils` | -| `null` | oldMember | The member to change (or 'default' for default imports, '*' for namespace imports) | `act` | -| `null` | newModule | The module to change imports to | `react` | -| `null` | newMember | *Optional*. The new member name. If not specified, keeps the same member name. | `act` | -| `null` | newAlias | *Optional*. Optional alias for the new import. Required when newMember is 'default' or '*'. | | - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.change-import -``` diff --git a/docs/recipes/javascript/cleanup/README.md b/docs/recipes/javascript/cleanup/README.md deleted file mode 100644 index bca5006cbf..0000000000 --- a/docs/recipes/javascript/cleanup/README.md +++ /dev/null @@ -1,15 +0,0 @@ ---- -description: Cleanup OpenRewrite recipes. ---- - -# Cleanup - -## Recipes - -* [Add radix to `parseInt`](./add-parse-int-radix.md) -* [Detect async callbacks in synchronous array methods](./async-callback-in-sync-array-method.md) -* [Order imports](./order-imports.md) -* [Prefer optional chaining](./prefer-optional-chain.md) -* [Use object property shorthand](./use-object-property-shorthand.md) - - diff --git a/docs/recipes/javascript/cleanup/add-parse-int-radix.md b/docs/recipes/javascript/cleanup/add-parse-int-radix.md deleted file mode 100644 index a934d645d0..0000000000 --- a/docs/recipes/javascript/cleanup/add-parse-int-radix.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Add radix to `parseInt`" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Add radix to `parseInt` - -**org.openrewrite.javascript.cleanup.add-parse-int-radix** - -_Adds the radix parameter (base 10) to `parseInt()` calls that are missing it, preventing potential parsing issues._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.cleanup.add-parse-int-radix](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.cleanup.add-parse-int-radix), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.cleanup.add-parse-int-radix -``` diff --git a/docs/recipes/javascript/cleanup/async-callback-in-sync-array-method.md b/docs/recipes/javascript/cleanup/async-callback-in-sync-array-method.md deleted file mode 100644 index 6e30276d76..0000000000 --- a/docs/recipes/javascript/cleanup/async-callback-in-sync-array-method.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -sidebar_label: "Detect async callbacks in synchronous array methods" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Detect async callbacks in synchronous array methods - -**org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method** - -_Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy._ - -### Tags - -* [async](/reference/recipes-by-tag#async) -* [bug](/reference/recipes-by-tag#bug) -* [cleanup](/reference/recipes-by-tag#cleanup) -* [typescript](/reference/recipes-by-tag#typescript) -* [javascript](/reference/recipes-by-tag#javascript) - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method -``` diff --git a/docs/recipes/javascript/cleanup/order-imports.md b/docs/recipes/javascript/cleanup/order-imports.md deleted file mode 100644 index 87cc8e49dc..0000000000 --- a/docs/recipes/javascript/cleanup/order-imports.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Order imports" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Order imports - -**org.openrewrite.javascript.cleanup.order-imports** - -_Sort imports by category and module path. Categories: side-effect, namespace, default, named, type. Within each category, imports are sorted alphabetically by module path. Named specifiers within each import are also sorted alphabetically._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.cleanup.order-imports](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.cleanup.order-imports), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.cleanup.order-imports -``` diff --git a/docs/recipes/javascript/cleanup/prefer-optional-chain.md b/docs/recipes/javascript/cleanup/prefer-optional-chain.md deleted file mode 100644 index 6e0cc57859..0000000000 --- a/docs/recipes/javascript/cleanup/prefer-optional-chain.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Prefer optional chaining" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Prefer optional chaining - -**org.openrewrite.javascript.cleanup.prefer-optional-chain** - -_Converts ternary expressions like `foo ? foo.bar : undefined` to use optional chaining syntax `foo?.bar`._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.cleanup.prefer-optional-chain](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.cleanup.prefer-optional-chain), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.cleanup.prefer-optional-chain -``` diff --git a/docs/recipes/javascript/cleanup/use-object-property-shorthand.md b/docs/recipes/javascript/cleanup/use-object-property-shorthand.md deleted file mode 100644 index 832f4125d8..0000000000 --- a/docs/recipes/javascript/cleanup/use-object-property-shorthand.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Use object property shorthand" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Use object property shorthand - -**org.openrewrite.javascript.cleanup.use-object-property-shorthand** - -_Simplifies object properties where the property name and value/variable name are the same (e.g., `{ x: x }` becomes `{ x }`). Applies to both destructuring patterns and object literals._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.cleanup.use-object-property-shorthand](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.cleanup.use-object-property-shorthand), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.cleanup.use-object-property-shorthand -``` diff --git a/docs/recipes/javascript/dependencies/README.md b/docs/recipes/javascript/dependencies/README.md deleted file mode 100644 index 154192622f..0000000000 --- a/docs/recipes/javascript/dependencies/README.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -description: Dependencies OpenRewrite recipes. ---- - -# Dependencies - -## Recipes - -* [Add npm dependency](./add-dependency.md) -* [Find Node.js dependency](./find-dependency.md) -* [Upgrade npm dependency version](./upgrade-dependency-version.md) -* [Upgrade transitive npm dependency version](./upgrade-transitive-dependency-version.md) - - diff --git a/docs/recipes/javascript/dependencies/add-dependency.md b/docs/recipes/javascript/dependencies/add-dependency.md deleted file mode 100644 index c824895493..0000000000 --- a/docs/recipes/javascript/dependencies/add-dependency.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -sidebar_label: "Add npm dependency" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Add npm dependency - -**org.openrewrite.javascript.dependencies.add-dependency** - -_Adds a new dependency to `package.json` and updates the lock file by running the package manager._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.dependencies.add-dependency](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.dependencies.add-dependency), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `null` | packageName | The name of the npm package to add (e.g., `lodash`, `@types/node`) | `lodash` | -| `null` | version | The version constraint to set (e.g., `^5.0.0`, `~2.1.0`, `3.0.0`) | `^5.0.0` | -| `null` | scope | *Optional*. The dependency scope: `dependencies`, `devDependencies`, `peerDependencies`, or `optionalDependencies` | `dependencies` | - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.dependencies.add-dependency -``` diff --git a/docs/recipes/javascript/dependencies/find-dependency.md b/docs/recipes/javascript/dependencies/find-dependency.md deleted file mode 100644 index f57deba2a6..0000000000 --- a/docs/recipes/javascript/dependencies/find-dependency.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -sidebar_label: "Find Node.js dependency" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Find Node.js dependency - -**org.openrewrite.javascript.dependencies.find-dependency** - -_Finds dependencies in a project's `package.json`. Can find both direct dependencies and dependencies that transitively include the target package. This recipe is commonly used as a precondition for other recipes._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.dependencies.find-dependency](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.dependencies.find-dependency), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `null` | packageName | The name of the npm package to find. Supports glob patterns. | `lodash` | -| `null` | version | *Optional*. An exact version number or semver selector used to select the version number. Leave empty to match any version. | `^18.0.0` | -| `null` | onlyDirect | *Optional*. If true (default), only matches dependencies that directly match the package name. If false, also marks direct dependencies that have the target package as a transitive dependency. | `true` | - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.dependencies.find-dependency -``` diff --git a/docs/recipes/javascript/dependencies/upgrade-dependency-version.md b/docs/recipes/javascript/dependencies/upgrade-dependency-version.md deleted file mode 100644 index 2bcda36913..0000000000 --- a/docs/recipes/javascript/dependencies/upgrade-dependency-version.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -sidebar_label: "Upgrade npm dependency version" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Upgrade npm dependency version - -**org.openrewrite.javascript.dependencies.upgrade-dependency-version** - -_Upgrades the version of a direct dependency in `package.json` and updates the lock file by running the package manager._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.dependencies.upgrade-dependency-version](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.dependencies.upgrade-dependency-version), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `null` | packageName | The name of the npm package to upgrade (e.g., `lodash`, `@types/node`) | `lodash` | -| `null` | newVersion | The version constraint to set (e.g., `^5.0.0`, `~2.1.0`, `3.0.0`) | `^5.0.0` | - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.dependencies.upgrade-dependency-version -``` diff --git a/docs/recipes/javascript/dependencies/upgrade-transitive-dependency-version.md b/docs/recipes/javascript/dependencies/upgrade-transitive-dependency-version.md deleted file mode 100644 index 34c2cf4a47..0000000000 --- a/docs/recipes/javascript/dependencies/upgrade-transitive-dependency-version.md +++ /dev/null @@ -1,46 +0,0 @@ ---- -sidebar_label: "Upgrade transitive npm dependency version" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Upgrade transitive npm dependency version - -**org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version** - -_Upgrades the version of a transitive dependency by adding override/resolution entries to `package.json` and updates the lock file by running the package manager._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `null` | packageName | The name of the npm package to upgrade (e.g., `lodash`, `@types/node`) | `lodash` | -| `null` | newVersion | The version constraint to set (e.g., `^5.0.0`, `~2.1.0`, `3.0.0`) | `^5.0.0` | -| `null` | dependencyPath | *Optional*. Optional path to scope the override to a specific dependency chain. Use '>' as separator (e.g., 'express>accepts'). When not specified, applies globally to all transitive occurrences. | `express>accepts` | - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version -``` diff --git a/docs/recipes/javascript/format/README.md b/docs/recipes/javascript/format/README.md deleted file mode 100644 index d64e1bc88b..0000000000 --- a/docs/recipes/javascript/format/README.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -description: Format OpenRewrite recipes. ---- - -# Format - -## Recipes - -* [Auto-format JavaScript/TypeScript code](./auto-format.md) - - diff --git a/docs/recipes/javascript/format/auto-format.md b/docs/recipes/javascript/format/auto-format.md deleted file mode 100644 index 59cdfc8c70..0000000000 --- a/docs/recipes/javascript/format/auto-format.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Auto-format JavaScript/TypeScript code" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Auto-format JavaScript/TypeScript code - -**org.openrewrite.javascript.format.auto-format** - -_Format JavaScript and TypeScript code using formatting rules auto-detected from the project's existing code style._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.format.auto-format](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.format.auto-format), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.format.auto-format -``` diff --git a/docs/recipes/javascript/migrate/README.md b/docs/recipes/javascript/migrate/README.md deleted file mode 100644 index 4e5cf01c73..0000000000 --- a/docs/recipes/javascript/migrate/README.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -description: Migrate OpenRewrite recipes. ---- - -# Migrate - -## Categories - -* [Es6](/recipes/javascript/migrate/es6) -* [Typescript](/recipes/javascript/migrate/typescript) - - diff --git a/docs/recipes/javascript/migrate/es6/README.md b/docs/recipes/javascript/migrate/es6/README.md deleted file mode 100644 index 3ad0cbe566..0000000000 --- a/docs/recipes/javascript/migrate/es6/README.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -description: Es6 OpenRewrite recipes. ---- - -# Es6 - -## Recipes - -* [Modernize octal escape sequences](./modernize-octal-escape-sequences.md) -* [Modernize octal literals](./modernize-octal-literals.md) -* [Remove duplicate object keys](./remove-duplicate-object-keys.md) - - diff --git a/docs/recipes/javascript/migrate/es6/modernize-octal-escape-sequences.md b/docs/recipes/javascript/migrate/es6/modernize-octal-escape-sequences.md deleted file mode 100644 index 7386242b49..0000000000 --- a/docs/recipes/javascript/migrate/es6/modernize-octal-escape-sequences.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -sidebar_label: "Modernize octal escape sequences" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Modernize octal escape sequences - -**org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences** - -_Convert old-style octal escape sequences (e.g., `\0`, `\123`) to modern hex escape sequences (e.g., `\x00`, `\x53`) or Unicode escape sequences (e.g., `\u0000`, `\u0053`)._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - -## Options - -| Type | Name | Description | Example | -| --- | --- | --- | --- | -| `null` | useUnicodeEscapes | *Optional*. Use Unicode escape sequences (`\uXXXX`) instead of hex escape sequences (`\xXX`). Default is `false`. | `true` | - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences -``` diff --git a/docs/recipes/javascript/migrate/es6/modernize-octal-literals.md b/docs/recipes/javascript/migrate/es6/modernize-octal-literals.md deleted file mode 100644 index 8444707c22..0000000000 --- a/docs/recipes/javascript/migrate/es6/modernize-octal-literals.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Modernize octal literals" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Modernize octal literals - -**org.openrewrite.javascript.migrate.es6.modernize-octal-literals** - -_Convert old-style octal literals (e.g., `0777`) to modern ES6 syntax (e.g., `0o777`)._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.migrate.es6.modernize-octal-literals](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.migrate.es6.modernize-octal-literals), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.migrate.es6.modernize-octal-literals -``` diff --git a/docs/recipes/javascript/migrate/es6/remove-duplicate-object-keys.md b/docs/recipes/javascript/migrate/es6/remove-duplicate-object-keys.md deleted file mode 100644 index 2e5941767a..0000000000 --- a/docs/recipes/javascript/migrate/es6/remove-duplicate-object-keys.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Remove duplicate object keys" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Remove duplicate object keys - -**org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys** - -_Remove duplicate keys in object literals, keeping only the last occurrence (last-wins semantics)._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys -``` diff --git a/docs/recipes/javascript/migrate/typescript/README.md b/docs/recipes/javascript/migrate/typescript/README.md deleted file mode 100644 index fc27fa1a37..0000000000 --- a/docs/recipes/javascript/migrate/typescript/README.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -description: Typescript OpenRewrite recipes. ---- - -# Typescript - -## Recipes - -* [Convert `export =` to `export default`](./export-assignment-to-export-default.md) - - diff --git a/docs/recipes/javascript/migrate/typescript/export-assignment-to-export-default.md b/docs/recipes/javascript/migrate/typescript/export-assignment-to-export-default.md deleted file mode 100644 index ffb5016b10..0000000000 --- a/docs/recipes/javascript/migrate/typescript/export-assignment-to-export-default.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -sidebar_label: "Convert `export =` to `export default`" ---- - -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - -# Convert `export =` to `export default` - -**org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default** - -_Converts TypeScript `export =` syntax to ES module `export default` syntax for compatibility with ECMAScript modules._ - -## Recipe source - -[GitHub: rewrite+org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default](https://github.com/search?type=code&q=repo:openrewrite/rewrite+org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default), -[Issue Tracker](https://github.com/openrewrite/rewrite/issues), -[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-javascript/) - -This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). - - -## Usage - -In order to run JavaScript recipes, you will need to use the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro). -For JavaScript specific configuration instructions, please see our [configuring JavaScript guide](https://docs.moderne.io/user-documentation/moderne-cli/how-to-guides/javascript). - -Once the CLI is installed, you can install this JavaScript recipe package by running the following command: - -```shell title="Install the recipe package" -mod config recipes npm install @openrewrite/rewrite -``` - -Then, you can run the recipe via: - -```shell title="Run the recipe" -mod run . --recipe org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default -``` From 24e34f84791890ed5fc08c9228524e67e0bd37c8 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 9 Mar 2026 17:40:29 +0100 Subject: [PATCH 3/6] Add new recipes --- docs/recipes/csharp/search/findtypes.md | 252 +++++++++++++++++ docs/recipes/gitlab/adddefaultkeyword.md | 252 +++++++++++++++++ docs/recipes/gitlab/addtimeout.md | 259 ++++++++++++++++++ .../messageformattoparameterizedlogging.md | 239 ++++++++++++++++ .../slf4j/removeunnecessaryloglevelguards.md | 239 ++++++++++++++++ .../stringformattoparameterizedlogging.md | 239 ++++++++++++++++ .../migrate/lombok/useallargsconstructor.md | 234 ++++++++++++++++ .../lombok/userequiredargsconstructor.md | 234 ++++++++++++++++ .../replacemockitotestexecutionlistener.md | 234 ++++++++++++++++ .../mockito/replacepowermockdependencies.md | 234 ++++++++++++++++ 10 files changed, 2416 insertions(+) create mode 100644 docs/recipes/csharp/search/findtypes.md create mode 100644 docs/recipes/gitlab/adddefaultkeyword.md create mode 100644 docs/recipes/gitlab/addtimeout.md create mode 100644 docs/recipes/java/logging/slf4j/messageformattoparameterizedlogging.md create mode 100644 docs/recipes/java/logging/slf4j/removeunnecessaryloglevelguards.md create mode 100644 docs/recipes/java/logging/slf4j/stringformattoparameterizedlogging.md create mode 100644 docs/recipes/java/migrate/lombok/useallargsconstructor.md create mode 100644 docs/recipes/java/migrate/lombok/userequiredargsconstructor.md create mode 100644 docs/recipes/java/testing/mockito/replacemockitotestexecutionlistener.md create mode 100644 docs/recipes/java/testing/mockito/replacepowermockdependencies.md diff --git a/docs/recipes/csharp/search/findtypes.md b/docs/recipes/csharp/search/findtypes.md new file mode 100644 index 0000000000..afd6cef86b --- /dev/null +++ b/docs/recipes/csharp/search/findtypes.md @@ -0,0 +1,252 @@ +--- +sidebar_label: "Find types" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Find types + +**org.openrewrite.java.search.FindTypes** + +_Find type references by name._ + +:::info +This Java recipe works on Csharp code. +::: + +## Recipe source + +[GitHub: FindTypes.java](https://github.com/openrewrite/rewrite/blob/main/rewrite-java/src/main/java/org/openrewrite/java/search/FindTypes.java), +[Issue Tracker](https://github.com/openrewrite/rewrite/issues), +[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-java/) + +This recipe is available under the [Apache License Version 2.0](https://www.apache.org/licenses/LICENSE-2.0). + +## Options + +| Type | Name | Description | Example | +| --- | --- | --- | --- | +| `String` | fullyQualifiedTypeName | A fully-qualified type name, that is used to find matching type references. Supports glob expressions. `java..*` finds every type from every subpackage of the `java` package. | `java.util.List` | +| `Boolean` | checkAssignability | *Optional*. When enabled, find type references that are assignable to the provided type. | | + + +## Used by + +This recipe is used as part of the following composite recipes: + +* [Find deprecated `PathMatcher` usage](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/java/spring/framework/finddeprecatedpathmatcherusage) +* [Report types deprecated or removed in WebLogic version 14.1.2](/recipes/com/oracle/weblogic/rewrite/reportdeprecatedorremoved1412.md) +* [Report types deprecated or removed in WebLogic version 15.1.1](/recipes/com/oracle/weblogic/rewrite/reportdeprecatedorremoved1511.md) + +## Example + +###### Parameters +| Parameter | Value | +| --- | --- | +|fullyQualifiedTypeName|`a.A1`| +|checkAssignability|`false`| + + + + + + +###### Before +```java +import a.A1; +public class B extends A1 {} +``` + +###### After +```java +import a.A1; +public class B extends /*~~>*/A1 {} +``` + + + + +```diff +@@ -2,1 +2,1 @@ +import a.A1; +-public class B extends A1 {} ++public class B extends /*~~>*/A1 {} + +``` + + + + +## Usage + +This recipe has required configuration parameters. Recipes with required configuration parameters cannot be activated directly (unless you are running them via the Moderne CLI). To activate this recipe you must create a new recipe which fills in the required parameters. In your `rewrite.yml` create a new recipe with a unique name. For example: `com.yourorg.FindTypesExample`. +Here's how you can define and customize such a recipe within your rewrite.yml: +```yaml title="rewrite.yml" +--- +type: specs.openrewrite.org/v1beta/recipe +name: com.yourorg.FindTypesExample +displayName: Find types example +recipeList: + - org.openrewrite.java.search.FindTypes: + fullyQualifiedTypeName: java.util.List +``` + +Now that `com.yourorg.FindTypesExample` has been defined, activate it in your build file: + + + +1. Add the following to your `build.gradle` file: +```groovy title="build.gradle" +plugins { + id("org.openrewrite.rewrite") version("latest.release") +} + +rewrite { + activeRecipe("com.yourorg.FindTypesExample") + setExportDatatables(true) +} + +repositories { + mavenCentral() +} +``` +2. Run `gradle rewriteRun` to run the recipe. + + + +1. Add the following to your `pom.xml` file: + +```xml title="pom.xml" + + + + + org.openrewrite.maven + rewrite-maven-plugin + {{VERSION_REWRITE_MAVEN_PLUGIN}} + + true + + com.yourorg.FindTypesExample + + + + + + +``` +2. Run `mvn rewrite:run` to run the recipe. + + + +You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. + +```shell title="shell" +mod run . --recipe FindTypes --recipe-option "fullyQualifiedTypeName=java.util.List" +``` + +If the recipe is not available locally, then you can install it using: +```shell +mod config recipes jar install org.openrewrite:rewrite-java:{{VERSION_ORG_OPENREWRITE_REWRITE_JAVA}} +``` + + + +## See how this recipe works across multiple open-source repositories + +import RecipeCallout from '@site/src/components/ModerneLink'; + + + +The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. + +Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. +## Data Tables + + + + +### Type uses +**org.openrewrite.java.table.TypeUses** + +_The source code of matching type uses._ + +| Column Name | Description | +| ----------- | ----------- | +| Source file | The source file that the method call occurred in. | +| Source | The source code of the type use. | +| Concrete type | The concrete type in use, which may be a subtype of a searched type. | + + + + + +### Source files that had results +**org.openrewrite.table.SourcesFileResults** + +_Source files that were modified by the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | +| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | +| Recipe that made changes | The specific recipe that made a change. | +| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | +| Cycle | The recipe cycle in which the change was made. | + + + + + +### Source files that had search results +**org.openrewrite.table.SearchResults** + +_Search results that were found during the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path of search result before the run | The source path of the file with the search result markers present. | +| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Result | The trimmed printed tree of the LST element that the marker is attached to. | +| Description | The content of the description of the marker. | +| Recipe that added the search marker | The specific recipe that added the Search marker. | + + + + + +### Source files that errored on a recipe +**org.openrewrite.table.SourcesFileErrors** + +_The details of all errors produced by a recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path | The file that failed to parse. | +| Recipe that made changes | The specific recipe that made a change. | +| Stack trace | The stack trace of the failure. | + + + + + +### Recipe performance +**org.openrewrite.table.RecipeRunStats** + +_Statistics used in analyzing the performance of recipes._ + +| Column Name | Description | +| ----------- | ----------- | +| The recipe | The recipe whose stats are being measured both individually and cumulatively. | +| Source file count | The number of source files the recipe ran over. | +| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | +| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | +| Max scanning time (ns) | The max time scanning any one source file. | +| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | +| Max edit time (ns) | The max time editing any one source file. | + + + + diff --git a/docs/recipes/gitlab/adddefaultkeyword.md b/docs/recipes/gitlab/adddefaultkeyword.md new file mode 100644 index 0000000000..ca1dd4c0d2 --- /dev/null +++ b/docs/recipes/gitlab/adddefaultkeyword.md @@ -0,0 +1,252 @@ +--- +sidebar_label: "Add default keyword" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Add default keyword + +**org.openrewrite.gitlab.AddDefaultKeyword** + +_Add or update a keyword in the `default` section of `.gitlab-ci.yml`._ + +## Recipe source + +[GitHub: AddDefaultKeyword.java](https://github.com/openrewrite/rewrite-gitlab/blob/main/src/main/java/org/openrewrite/gitlab/AddDefaultKeyword.java), +[Issue Tracker](https://github.com/openrewrite/rewrite-gitlab/issues), +[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-gitlab/) + +This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). + +## Options + +| Type | Name | Description | Example | +| --- | --- | --- | --- | +| `String` | keyword | The keyword to add under the `default` section. | `image` | +| `String` | value | The value for the keyword. | `ruby:3.0` | +| `Boolean` | acceptTheirs | *Optional*. When the keyword already exists, prefer the original value. | | + + +## Definition + + + +* [Merge YAML snippet](../yaml/mergeyaml) + * key: `$` + * yaml: `default: null: null` + * filePattern: `.gitlab-ci.yml` + + + + + +```yaml +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.gitlab.AddDefaultKeyword +displayName: Add default keyword +description: | + Add or update a keyword in the `default` section of `.gitlab-ci.yml`. + + + +recipeList: + - org.openrewrite.yaml.MergeYaml: + key: $ + yaml: default: + null: null + filePattern: .gitlab-ci.yml + +``` + + +## Example + +###### Parameters +| Parameter | Value | +| --- | --- | +|keyword|`image`| +|value|`ruby:3.0`| +|acceptTheirs|`null`| + + + +###### New file +```yaml title=".gitlab-ci.yml" +default: + image: ruby:3.0 +``` + + + +## Usage + +This recipe has required configuration parameters. Recipes with required configuration parameters cannot be activated directly (unless you are running them via the Moderne CLI). To activate this recipe you must create a new recipe which fills in the required parameters. In your `rewrite.yml` create a new recipe with a unique name. For example: `com.yourorg.AddDefaultKeywordExample`. +Here's how you can define and customize such a recipe within your rewrite.yml: +```yaml title="rewrite.yml" +--- +type: specs.openrewrite.org/v1beta/recipe +name: com.yourorg.AddDefaultKeywordExample +displayName: Add default keyword example +recipeList: + - org.openrewrite.gitlab.AddDefaultKeyword: + keyword: image + value: ruby:3.0 +``` + +Now that `com.yourorg.AddDefaultKeywordExample` has been defined, activate it and take a dependency on `org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}}` in your build file: + + + +1. Add the following to your `build.gradle` file: + +```groovy title="build.gradle" +plugins { + id("org.openrewrite.rewrite") version("latest.release") +} + +rewrite { + activeRecipe("com.yourorg.AddDefaultKeywordExample") + setExportDatatables(true) +} + +repositories { + mavenCentral() +} + +dependencies { + rewrite("org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}}") +} +``` +2. Run `gradle rewriteRun` to run the recipe. + + + +1. Add the following to your `pom.xml` file: + +```xml title="pom.xml" + + + + + org.openrewrite.maven + rewrite-maven-plugin + {{VERSION_REWRITE_MAVEN_PLUGIN}} + + true + + com.yourorg.AddDefaultKeywordExample + + + + + org.openrewrite.recipe + rewrite-gitlab + {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}} + + + + + + +``` +2. Run `mvn rewrite:run` to run the recipe. + + + +You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. + +```shell title="shell" +mod run . --recipe AddDefaultKeyword --recipe-option "keyword=image" --recipe-option "value=ruby:3.0" +``` + +If the recipe is not available locally, then you can install it using: +```shell +mod config recipes jar install org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}} +``` + + + +## See how this recipe works across multiple open-source repositories + +import RecipeCallout from '@site/src/components/ModerneLink'; + + + +The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. + +Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. +## Data Tables + + + + +### Source files that had results +**org.openrewrite.table.SourcesFileResults** + +_Source files that were modified by the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | +| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | +| Recipe that made changes | The specific recipe that made a change. | +| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | +| Cycle | The recipe cycle in which the change was made. | + + + + + +### Source files that had search results +**org.openrewrite.table.SearchResults** + +_Search results that were found during the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path of search result before the run | The source path of the file with the search result markers present. | +| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Result | The trimmed printed tree of the LST element that the marker is attached to. | +| Description | The content of the description of the marker. | +| Recipe that added the search marker | The specific recipe that added the Search marker. | + + + + + +### Source files that errored on a recipe +**org.openrewrite.table.SourcesFileErrors** + +_The details of all errors produced by a recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path | The file that failed to parse. | +| Recipe that made changes | The specific recipe that made a change. | +| Stack trace | The stack trace of the failure. | + + + + + +### Recipe performance +**org.openrewrite.table.RecipeRunStats** + +_Statistics used in analyzing the performance of recipes._ + +| Column Name | Description | +| ----------- | ----------- | +| The recipe | The recipe whose stats are being measured both individually and cumulatively. | +| Source file count | The number of source files the recipe ran over. | +| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | +| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | +| Max scanning time (ns) | The max time scanning any one source file. | +| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | +| Max edit time (ns) | The max time editing any one source file. | + + + + diff --git a/docs/recipes/gitlab/addtimeout.md b/docs/recipes/gitlab/addtimeout.md new file mode 100644 index 0000000000..9ff82e3838 --- /dev/null +++ b/docs/recipes/gitlab/addtimeout.md @@ -0,0 +1,259 @@ +--- +sidebar_label: "Add job timeout" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Add job timeout + +**org.openrewrite.gitlab.AddTimeout** + +_Set `timeout` in `.gitlab-ci.yml` to prevent jobs from hanging indefinitely._ + +## Recipe source + +[GitHub: AddTimeout.java](https://github.com/openrewrite/rewrite-gitlab/blob/main/src/main/java/org/openrewrite/gitlab/AddTimeout.java), +[Issue Tracker](https://github.com/openrewrite/rewrite-gitlab/issues), +[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-gitlab/) + +This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). + +## Options + +| Type | Name | Description | Example | +| --- | --- | --- | --- | +| `String` | timeout | The timeout duration. | `1 hour` | +| `String` | jobName | *Optional*. The job to set timeout on. If not provided, applies to the `default` section. | `build_job` | +| `Boolean` | acceptTheirs | *Optional*. When the setting already exists, prefer the original value. | | + + +## Definition + + + +* [Merge YAML snippet](../yaml/mergeyaml) + * key: `$` + * yaml: `default: timeout: null` + * filePattern: `.gitlab-ci.yml` + + + + + +```yaml +--- +type: specs.openrewrite.org/v1beta/recipe +name: org.openrewrite.gitlab.AddTimeout +displayName: Add job timeout +description: | + Set `timeout` in `.gitlab-ci.yml` to prevent jobs from hanging indefinitely. + + + +recipeList: + - org.openrewrite.yaml.MergeYaml: + key: $ + yaml: default: + timeout: null + filePattern: .gitlab-ci.yml + +``` + + + +## Used by + +This recipe is used as part of the following composite recipes: + +* [GitLab CI best practices](/recipes/gitlab/bestpractices.md) + +## Example + +###### Parameters +| Parameter | Value | +| --- | --- | +|timeout|`1 hour`| +|jobName|`null`| +|acceptTheirs|`null`| + + + +###### New file +```yaml title=".gitlab-ci.yml" +default: + timeout: 1 hour +``` + + + +## Usage + +This recipe has required configuration parameters. Recipes with required configuration parameters cannot be activated directly (unless you are running them via the Moderne CLI). To activate this recipe you must create a new recipe which fills in the required parameters. In your `rewrite.yml` create a new recipe with a unique name. For example: `com.yourorg.AddTimeoutExample`. +Here's how you can define and customize such a recipe within your rewrite.yml: +```yaml title="rewrite.yml" +--- +type: specs.openrewrite.org/v1beta/recipe +name: com.yourorg.AddTimeoutExample +displayName: Add job timeout example +recipeList: + - org.openrewrite.gitlab.AddTimeout: + timeout: 1 hour + jobName: build_job +``` + +Now that `com.yourorg.AddTimeoutExample` has been defined, activate it and take a dependency on `org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}}` in your build file: + + + +1. Add the following to your `build.gradle` file: + +```groovy title="build.gradle" +plugins { + id("org.openrewrite.rewrite") version("latest.release") +} + +rewrite { + activeRecipe("com.yourorg.AddTimeoutExample") + setExportDatatables(true) +} + +repositories { + mavenCentral() +} + +dependencies { + rewrite("org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}}") +} +``` +2. Run `gradle rewriteRun` to run the recipe. + + + +1. Add the following to your `pom.xml` file: + +```xml title="pom.xml" + + + + + org.openrewrite.maven + rewrite-maven-plugin + {{VERSION_REWRITE_MAVEN_PLUGIN}} + + true + + com.yourorg.AddTimeoutExample + + + + + org.openrewrite.recipe + rewrite-gitlab + {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}} + + + + + + +``` +2. Run `mvn rewrite:run` to run the recipe. + + + +You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. + +```shell title="shell" +mod run . --recipe AddTimeout --recipe-option "timeout=1 hour" --recipe-option "jobName=build_job" +``` + +If the recipe is not available locally, then you can install it using: +```shell +mod config recipes jar install org.openrewrite.recipe:rewrite-gitlab:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_GITLAB}} +``` + + + +## See how this recipe works across multiple open-source repositories + +import RecipeCallout from '@site/src/components/ModerneLink'; + + + +The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. + +Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. +## Data Tables + + + + +### Source files that had results +**org.openrewrite.table.SourcesFileResults** + +_Source files that were modified by the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | +| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | +| Recipe that made changes | The specific recipe that made a change. | +| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | +| Cycle | The recipe cycle in which the change was made. | + + + + + +### Source files that had search results +**org.openrewrite.table.SearchResults** + +_Search results that were found during the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path of search result before the run | The source path of the file with the search result markers present. | +| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Result | The trimmed printed tree of the LST element that the marker is attached to. | +| Description | The content of the description of the marker. | +| Recipe that added the search marker | The specific recipe that added the Search marker. | + + + + + +### Source files that errored on a recipe +**org.openrewrite.table.SourcesFileErrors** + +_The details of all errors produced by a recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path | The file that failed to parse. | +| Recipe that made changes | The specific recipe that made a change. | +| Stack trace | The stack trace of the failure. | + + + + + +### Recipe performance +**org.openrewrite.table.RecipeRunStats** + +_Statistics used in analyzing the performance of recipes._ + +| Column Name | Description | +| ----------- | ----------- | +| The recipe | The recipe whose stats are being measured both individually and cumulatively. | +| Source file count | The number of source files the recipe ran over. | +| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | +| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | +| Max scanning time (ns) | The max time scanning any one source file. | +| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | +| Max edit time (ns) | The max time editing any one source file. | + + + + diff --git a/docs/recipes/java/logging/slf4j/messageformattoparameterizedlogging.md b/docs/recipes/java/logging/slf4j/messageformattoparameterizedlogging.md new file mode 100644 index 0000000000..0725068486 --- /dev/null +++ b/docs/recipes/java/logging/slf4j/messageformattoparameterizedlogging.md @@ -0,0 +1,239 @@ +--- +sidebar_label: "`MessageFormat.format()` in logging statements should use SLF4J parameterized logging" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `MessageFormat.format()` in logging statements should use SLF4J parameterized logging + +**org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging** + +_Replace `MessageFormat.format()` calls in SLF4J logging statements with parameterized placeholders for improved performance._ + +### Tags + +* [slf4j](/reference/recipes-by-tag#slf4j) +* [logging](/reference/recipes-by-tag#logging) + +## Recipe source + +[GitHub: MessageFormatToParameterizedLogging.java](https://github.com/openrewrite/rewrite-logging-frameworks/blob/main/src/main/java/org/openrewrite/java/logging/slf4j/MessageFormatToParameterizedLogging.java), +[Issue Tracker](https://github.com/openrewrite/rewrite-logging-frameworks/issues), +[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-logging-frameworks/) + +This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). + + +## Used by + +This recipe is used as part of the following composite recipes: + +* [SLF4J best practices](/recipes/java/logging/slf4j/slf4jbestpractices.md) + + +## Usage + +This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-logging-frameworks` in your build file or by running a shell command (in which case no build changes are needed): + + + +1. Add the following to your `build.gradle` file: + +```groovy title="build.gradle" +plugins { + id("org.openrewrite.rewrite") version("latest.release") +} + +rewrite { + activeRecipe("org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging") + setExportDatatables(true) +} + +repositories { + mavenCentral() +} + +dependencies { + rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") +} +``` + +2. Run `gradle rewriteRun` to run the recipe. + + + + +1. Create a file named `init.gradle` in the root of your project. + +```groovy title="init.gradle" +initscript { + repositories { + maven { url "https://plugins.gradle.org/m2" } + } + dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } +} +rootProject { + plugins.apply(org.openrewrite.gradle.RewritePlugin) + dependencies { + rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") + } + rewrite { + activeRecipe("org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging") + setExportDatatables(true) + } + afterEvaluate { + if (repositories.isEmpty()) { + repositories { + mavenCentral() + } + } + } +} +``` + +2. Run the recipe. + +```shell title="shell" +gradle --init-script init.gradle rewriteRun +``` + + + + +1. Add the following to your `pom.xml` file: + +```xml title="pom.xml" + + + + + org.openrewrite.maven + rewrite-maven-plugin + {{VERSION_REWRITE_MAVEN_PLUGIN}} + + true + + org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging + + + + + org.openrewrite.recipe + rewrite-logging-frameworks + {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} + + + + + + +``` + +2. Run `mvn rewrite:run` to run the recipe. + + + +You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. + +```shell title="shell" +mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-logging-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.logging.slf4j.MessageFormatToParameterizedLogging -Drewrite.exportDatatables=true +``` + + + +You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. + +```shell title="shell" +mod run . --recipe MessageFormatToParameterizedLogging +``` + +If the recipe is not available locally, then you can install it using: +```shell +mod config recipes jar install org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} +``` + + + +## See how this recipe works across multiple open-source repositories + +import RecipeCallout from '@site/src/components/ModerneLink'; + + + +The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. + +Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. +## Data Tables + + + + +### Source files that had results +**org.openrewrite.table.SourcesFileResults** + +_Source files that were modified by the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | +| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | +| Recipe that made changes | The specific recipe that made a change. | +| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | +| Cycle | The recipe cycle in which the change was made. | + + + + + +### Source files that had search results +**org.openrewrite.table.SearchResults** + +_Search results that were found during the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path of search result before the run | The source path of the file with the search result markers present. | +| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Result | The trimmed printed tree of the LST element that the marker is attached to. | +| Description | The content of the description of the marker. | +| Recipe that added the search marker | The specific recipe that added the Search marker. | + + + + + +### Source files that errored on a recipe +**org.openrewrite.table.SourcesFileErrors** + +_The details of all errors produced by a recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path | The file that failed to parse. | +| Recipe that made changes | The specific recipe that made a change. | +| Stack trace | The stack trace of the failure. | + + + + + +### Recipe performance +**org.openrewrite.table.RecipeRunStats** + +_Statistics used in analyzing the performance of recipes._ + +| Column Name | Description | +| ----------- | ----------- | +| The recipe | The recipe whose stats are being measured both individually and cumulatively. | +| Source file count | The number of source files the recipe ran over. | +| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | +| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | +| Max scanning time (ns) | The max time scanning any one source file. | +| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | +| Max edit time (ns) | The max time editing any one source file. | + + + + diff --git a/docs/recipes/java/logging/slf4j/removeunnecessaryloglevelguards.md b/docs/recipes/java/logging/slf4j/removeunnecessaryloglevelguards.md new file mode 100644 index 0000000000..87b9b363d1 --- /dev/null +++ b/docs/recipes/java/logging/slf4j/removeunnecessaryloglevelguards.md @@ -0,0 +1,239 @@ +--- +sidebar_label: "Remove unnecessary log level guards" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Remove unnecessary log level guards + +**org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards** + +_Remove `if` statement guards around SLF4J logging calls when parameterized logging makes them unnecessary._ + +### Tags + +* [slf4j](/reference/recipes-by-tag#slf4j) +* [logging](/reference/recipes-by-tag#logging) + +## Recipe source + +[GitHub: RemoveUnnecessaryLogLevelGuards.java](https://github.com/openrewrite/rewrite-logging-frameworks/blob/main/src/main/java/org/openrewrite/java/logging/slf4j/RemoveUnnecessaryLogLevelGuards.java), +[Issue Tracker](https://github.com/openrewrite/rewrite-logging-frameworks/issues), +[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-logging-frameworks/) + +This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). + + +## Used by + +This recipe is used as part of the following composite recipes: + +* [SLF4J best practices](/recipes/java/logging/slf4j/slf4jbestpractices.md) + + +## Usage + +This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-logging-frameworks` in your build file or by running a shell command (in which case no build changes are needed): + + + +1. Add the following to your `build.gradle` file: + +```groovy title="build.gradle" +plugins { + id("org.openrewrite.rewrite") version("latest.release") +} + +rewrite { + activeRecipe("org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards") + setExportDatatables(true) +} + +repositories { + mavenCentral() +} + +dependencies { + rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") +} +``` + +2. Run `gradle rewriteRun` to run the recipe. + + + + +1. Create a file named `init.gradle` in the root of your project. + +```groovy title="init.gradle" +initscript { + repositories { + maven { url "https://plugins.gradle.org/m2" } + } + dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } +} +rootProject { + plugins.apply(org.openrewrite.gradle.RewritePlugin) + dependencies { + rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") + } + rewrite { + activeRecipe("org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards") + setExportDatatables(true) + } + afterEvaluate { + if (repositories.isEmpty()) { + repositories { + mavenCentral() + } + } + } +} +``` + +2. Run the recipe. + +```shell title="shell" +gradle --init-script init.gradle rewriteRun +``` + + + + +1. Add the following to your `pom.xml` file: + +```xml title="pom.xml" + + + + + org.openrewrite.maven + rewrite-maven-plugin + {{VERSION_REWRITE_MAVEN_PLUGIN}} + + true + + org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards + + + + + org.openrewrite.recipe + rewrite-logging-frameworks + {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} + + + + + + +``` + +2. Run `mvn rewrite:run` to run the recipe. + + + +You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. + +```shell title="shell" +mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-logging-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.logging.slf4j.RemoveUnnecessaryLogLevelGuards -Drewrite.exportDatatables=true +``` + + + +You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. + +```shell title="shell" +mod run . --recipe RemoveUnnecessaryLogLevelGuards +``` + +If the recipe is not available locally, then you can install it using: +```shell +mod config recipes jar install org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} +``` + + + +## See how this recipe works across multiple open-source repositories + +import RecipeCallout from '@site/src/components/ModerneLink'; + + + +The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. + +Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. +## Data Tables + + + + +### Source files that had results +**org.openrewrite.table.SourcesFileResults** + +_Source files that were modified by the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | +| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | +| Recipe that made changes | The specific recipe that made a change. | +| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | +| Cycle | The recipe cycle in which the change was made. | + + + + + +### Source files that had search results +**org.openrewrite.table.SearchResults** + +_Search results that were found during the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path of search result before the run | The source path of the file with the search result markers present. | +| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Result | The trimmed printed tree of the LST element that the marker is attached to. | +| Description | The content of the description of the marker. | +| Recipe that added the search marker | The specific recipe that added the Search marker. | + + + + + +### Source files that errored on a recipe +**org.openrewrite.table.SourcesFileErrors** + +_The details of all errors produced by a recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path | The file that failed to parse. | +| Recipe that made changes | The specific recipe that made a change. | +| Stack trace | The stack trace of the failure. | + + + + + +### Recipe performance +**org.openrewrite.table.RecipeRunStats** + +_Statistics used in analyzing the performance of recipes._ + +| Column Name | Description | +| ----------- | ----------- | +| The recipe | The recipe whose stats are being measured both individually and cumulatively. | +| Source file count | The number of source files the recipe ran over. | +| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | +| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | +| Max scanning time (ns) | The max time scanning any one source file. | +| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | +| Max edit time (ns) | The max time editing any one source file. | + + + + diff --git a/docs/recipes/java/logging/slf4j/stringformattoparameterizedlogging.md b/docs/recipes/java/logging/slf4j/stringformattoparameterizedlogging.md new file mode 100644 index 0000000000..5fa00d32f7 --- /dev/null +++ b/docs/recipes/java/logging/slf4j/stringformattoparameterizedlogging.md @@ -0,0 +1,239 @@ +--- +sidebar_label: "`String.format()` in logging statements should use SLF4J parameterized logging" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# `String.format()` in logging statements should use SLF4J parameterized logging + +**org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging** + +_Replace `String.format()` calls in SLF4J logging statements with parameterized placeholders for improved performance._ + +### Tags + +* [slf4j](/reference/recipes-by-tag#slf4j) +* [logging](/reference/recipes-by-tag#logging) + +## Recipe source + +[GitHub: StringFormatToParameterizedLogging.java](https://github.com/openrewrite/rewrite-logging-frameworks/blob/main/src/main/java/org/openrewrite/java/logging/slf4j/StringFormatToParameterizedLogging.java), +[Issue Tracker](https://github.com/openrewrite/rewrite-logging-frameworks/issues), +[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-logging-frameworks/) + +This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). + + +## Used by + +This recipe is used as part of the following composite recipes: + +* [SLF4J best practices](/recipes/java/logging/slf4j/slf4jbestpractices.md) + + +## Usage + +This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-logging-frameworks` in your build file or by running a shell command (in which case no build changes are needed): + + + +1. Add the following to your `build.gradle` file: + +```groovy title="build.gradle" +plugins { + id("org.openrewrite.rewrite") version("latest.release") +} + +rewrite { + activeRecipe("org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging") + setExportDatatables(true) +} + +repositories { + mavenCentral() +} + +dependencies { + rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") +} +``` + +2. Run `gradle rewriteRun` to run the recipe. + + + + +1. Create a file named `init.gradle` in the root of your project. + +```groovy title="init.gradle" +initscript { + repositories { + maven { url "https://plugins.gradle.org/m2" } + } + dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } +} +rootProject { + plugins.apply(org.openrewrite.gradle.RewritePlugin) + dependencies { + rewrite("org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}}") + } + rewrite { + activeRecipe("org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging") + setExportDatatables(true) + } + afterEvaluate { + if (repositories.isEmpty()) { + repositories { + mavenCentral() + } + } + } +} +``` + +2. Run the recipe. + +```shell title="shell" +gradle --init-script init.gradle rewriteRun +``` + + + + +1. Add the following to your `pom.xml` file: + +```xml title="pom.xml" + + + + + org.openrewrite.maven + rewrite-maven-plugin + {{VERSION_REWRITE_MAVEN_PLUGIN}} + + true + + org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging + + + + + org.openrewrite.recipe + rewrite-logging-frameworks + {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} + + + + + + +``` + +2. Run `mvn rewrite:run` to run the recipe. + + + +You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. + +```shell title="shell" +mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-logging-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.logging.slf4j.StringFormatToParameterizedLogging -Drewrite.exportDatatables=true +``` + + + +You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. + +```shell title="shell" +mod run . --recipe StringFormatToParameterizedLogging +``` + +If the recipe is not available locally, then you can install it using: +```shell +mod config recipes jar install org.openrewrite.recipe:rewrite-logging-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_LOGGING_FRAMEWORKS}} +``` + + + +## See how this recipe works across multiple open-source repositories + +import RecipeCallout from '@site/src/components/ModerneLink'; + + + +The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. + +Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. +## Data Tables + + + + +### Source files that had results +**org.openrewrite.table.SourcesFileResults** + +_Source files that were modified by the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | +| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | +| Recipe that made changes | The specific recipe that made a change. | +| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | +| Cycle | The recipe cycle in which the change was made. | + + + + + +### Source files that had search results +**org.openrewrite.table.SearchResults** + +_Search results that were found during the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path of search result before the run | The source path of the file with the search result markers present. | +| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Result | The trimmed printed tree of the LST element that the marker is attached to. | +| Description | The content of the description of the marker. | +| Recipe that added the search marker | The specific recipe that added the Search marker. | + + + + + +### Source files that errored on a recipe +**org.openrewrite.table.SourcesFileErrors** + +_The details of all errors produced by a recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path | The file that failed to parse. | +| Recipe that made changes | The specific recipe that made a change. | +| Stack trace | The stack trace of the failure. | + + + + + +### Recipe performance +**org.openrewrite.table.RecipeRunStats** + +_Statistics used in analyzing the performance of recipes._ + +| Column Name | Description | +| ----------- | ----------- | +| The recipe | The recipe whose stats are being measured both individually and cumulatively. | +| Source file count | The number of source files the recipe ran over. | +| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | +| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | +| Max scanning time (ns) | The max time scanning any one source file. | +| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | +| Max edit time (ns) | The max time editing any one source file. | + + + + diff --git a/docs/recipes/java/migrate/lombok/useallargsconstructor.md b/docs/recipes/java/migrate/lombok/useallargsconstructor.md new file mode 100644 index 0000000000..3a1d2cf798 --- /dev/null +++ b/docs/recipes/java/migrate/lombok/useallargsconstructor.md @@ -0,0 +1,234 @@ +--- +sidebar_label: "Use `@AllArgsConstructor` where applicable" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Use `@AllArgsConstructor` where applicable + +**org.openrewrite.java.migrate.lombok.UseAllArgsConstructor** + +_Prefer the Lombok `@AllArgsConstructor` annotation over explicitly written out constructors that assign all non-static fields._ + +## Recipe source + +[GitHub: UseAllArgsConstructor.java](https://github.com/openrewrite/rewrite-migrate-java/blob/main/src/main/java/org/openrewrite/java/migrate/lombok/UseAllArgsConstructor.java), +[Issue Tracker](https://github.com/openrewrite/rewrite-migrate-java/issues), +[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-migrate-java/) + +This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). + + +## Used by + +This recipe is used as part of the following composite recipes: + +* [Lombok Best Practices](/recipes/java/migrate/lombok/lombokbestpractices.md) + + +## Usage + +This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-migrate-java` in your build file or by running a shell command (in which case no build changes are needed): + + + +1. Add the following to your `build.gradle` file: + +```groovy title="build.gradle" +plugins { + id("org.openrewrite.rewrite") version("latest.release") +} + +rewrite { + activeRecipe("org.openrewrite.java.migrate.lombok.UseAllArgsConstructor") + setExportDatatables(true) +} + +repositories { + mavenCentral() +} + +dependencies { + rewrite("org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}}") +} +``` + +2. Run `gradle rewriteRun` to run the recipe. + + + + +1. Create a file named `init.gradle` in the root of your project. + +```groovy title="init.gradle" +initscript { + repositories { + maven { url "https://plugins.gradle.org/m2" } + } + dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } +} +rootProject { + plugins.apply(org.openrewrite.gradle.RewritePlugin) + dependencies { + rewrite("org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}}") + } + rewrite { + activeRecipe("org.openrewrite.java.migrate.lombok.UseAllArgsConstructor") + setExportDatatables(true) + } + afterEvaluate { + if (repositories.isEmpty()) { + repositories { + mavenCentral() + } + } + } +} +``` + +2. Run the recipe. + +```shell title="shell" +gradle --init-script init.gradle rewriteRun +``` + + + + +1. Add the following to your `pom.xml` file: + +```xml title="pom.xml" + + + + + org.openrewrite.maven + rewrite-maven-plugin + {{VERSION_REWRITE_MAVEN_PLUGIN}} + + true + + org.openrewrite.java.migrate.lombok.UseAllArgsConstructor + + + + + org.openrewrite.recipe + rewrite-migrate-java + {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}} + + + + + + +``` + +2. Run `mvn rewrite:run` to run the recipe. + + + +You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. + +```shell title="shell" +mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.migrate.lombok.UseAllArgsConstructor -Drewrite.exportDatatables=true +``` + + + +You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. + +```shell title="shell" +mod run . --recipe UseAllArgsConstructor +``` + +If the recipe is not available locally, then you can install it using: +```shell +mod config recipes jar install org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}} +``` + + + +## See how this recipe works across multiple open-source repositories + +import RecipeCallout from '@site/src/components/ModerneLink'; + + + +The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. + +Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. +## Data Tables + + + + +### Source files that had results +**org.openrewrite.table.SourcesFileResults** + +_Source files that were modified by the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | +| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | +| Recipe that made changes | The specific recipe that made a change. | +| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | +| Cycle | The recipe cycle in which the change was made. | + + + + + +### Source files that had search results +**org.openrewrite.table.SearchResults** + +_Search results that were found during the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path of search result before the run | The source path of the file with the search result markers present. | +| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Result | The trimmed printed tree of the LST element that the marker is attached to. | +| Description | The content of the description of the marker. | +| Recipe that added the search marker | The specific recipe that added the Search marker. | + + + + + +### Source files that errored on a recipe +**org.openrewrite.table.SourcesFileErrors** + +_The details of all errors produced by a recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path | The file that failed to parse. | +| Recipe that made changes | The specific recipe that made a change. | +| Stack trace | The stack trace of the failure. | + + + + + +### Recipe performance +**org.openrewrite.table.RecipeRunStats** + +_Statistics used in analyzing the performance of recipes._ + +| Column Name | Description | +| ----------- | ----------- | +| The recipe | The recipe whose stats are being measured both individually and cumulatively. | +| Source file count | The number of source files the recipe ran over. | +| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | +| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | +| Max scanning time (ns) | The max time scanning any one source file. | +| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | +| Max edit time (ns) | The max time editing any one source file. | + + + + diff --git a/docs/recipes/java/migrate/lombok/userequiredargsconstructor.md b/docs/recipes/java/migrate/lombok/userequiredargsconstructor.md new file mode 100644 index 0000000000..b1c9b585b5 --- /dev/null +++ b/docs/recipes/java/migrate/lombok/userequiredargsconstructor.md @@ -0,0 +1,234 @@ +--- +sidebar_label: "Use `@RequiredArgsConstructor` where applicable" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Use `@RequiredArgsConstructor` where applicable + +**org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor** + +_Prefer the Lombok `@RequiredArgsConstructor` annotation over explicitly written out constructors that only assign final fields._ + +## Recipe source + +[GitHub: UseRequiredArgsConstructor.java](https://github.com/openrewrite/rewrite-migrate-java/blob/main/src/main/java/org/openrewrite/java/migrate/lombok/UseRequiredArgsConstructor.java), +[Issue Tracker](https://github.com/openrewrite/rewrite-migrate-java/issues), +[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-migrate-java/) + +This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). + + +## Used by + +This recipe is used as part of the following composite recipes: + +* [Lombok Best Practices](/recipes/java/migrate/lombok/lombokbestpractices.md) + + +## Usage + +This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-migrate-java` in your build file or by running a shell command (in which case no build changes are needed): + + + +1. Add the following to your `build.gradle` file: + +```groovy title="build.gradle" +plugins { + id("org.openrewrite.rewrite") version("latest.release") +} + +rewrite { + activeRecipe("org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor") + setExportDatatables(true) +} + +repositories { + mavenCentral() +} + +dependencies { + rewrite("org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}}") +} +``` + +2. Run `gradle rewriteRun` to run the recipe. + + + + +1. Create a file named `init.gradle` in the root of your project. + +```groovy title="init.gradle" +initscript { + repositories { + maven { url "https://plugins.gradle.org/m2" } + } + dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } +} +rootProject { + plugins.apply(org.openrewrite.gradle.RewritePlugin) + dependencies { + rewrite("org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}}") + } + rewrite { + activeRecipe("org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor") + setExportDatatables(true) + } + afterEvaluate { + if (repositories.isEmpty()) { + repositories { + mavenCentral() + } + } + } +} +``` + +2. Run the recipe. + +```shell title="shell" +gradle --init-script init.gradle rewriteRun +``` + + + + +1. Add the following to your `pom.xml` file: + +```xml title="pom.xml" + + + + + org.openrewrite.maven + rewrite-maven-plugin + {{VERSION_REWRITE_MAVEN_PLUGIN}} + + true + + org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor + + + + + org.openrewrite.recipe + rewrite-migrate-java + {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}} + + + + + + +``` + +2. Run `mvn rewrite:run` to run the recipe. + + + +You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. + +```shell title="shell" +mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-migrate-java:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.migrate.lombok.UseRequiredArgsConstructor -Drewrite.exportDatatables=true +``` + + + +You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. + +```shell title="shell" +mod run . --recipe UseRequiredArgsConstructor +``` + +If the recipe is not available locally, then you can install it using: +```shell +mod config recipes jar install org.openrewrite.recipe:rewrite-migrate-java:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_MIGRATE_JAVA}} +``` + + + +## See how this recipe works across multiple open-source repositories + +import RecipeCallout from '@site/src/components/ModerneLink'; + + + +The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. + +Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. +## Data Tables + + + + +### Source files that had results +**org.openrewrite.table.SourcesFileResults** + +_Source files that were modified by the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | +| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | +| Recipe that made changes | The specific recipe that made a change. | +| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | +| Cycle | The recipe cycle in which the change was made. | + + + + + +### Source files that had search results +**org.openrewrite.table.SearchResults** + +_Search results that were found during the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path of search result before the run | The source path of the file with the search result markers present. | +| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Result | The trimmed printed tree of the LST element that the marker is attached to. | +| Description | The content of the description of the marker. | +| Recipe that added the search marker | The specific recipe that added the Search marker. | + + + + + +### Source files that errored on a recipe +**org.openrewrite.table.SourcesFileErrors** + +_The details of all errors produced by a recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path | The file that failed to parse. | +| Recipe that made changes | The specific recipe that made a change. | +| Stack trace | The stack trace of the failure. | + + + + + +### Recipe performance +**org.openrewrite.table.RecipeRunStats** + +_Statistics used in analyzing the performance of recipes._ + +| Column Name | Description | +| ----------- | ----------- | +| The recipe | The recipe whose stats are being measured both individually and cumulatively. | +| Source file count | The number of source files the recipe ran over. | +| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | +| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | +| Max scanning time (ns) | The max time scanning any one source file. | +| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | +| Max edit time (ns) | The max time editing any one source file. | + + + + diff --git a/docs/recipes/java/testing/mockito/replacemockitotestexecutionlistener.md b/docs/recipes/java/testing/mockito/replacemockitotestexecutionlistener.md new file mode 100644 index 0000000000..2ca00eb43d --- /dev/null +++ b/docs/recipes/java/testing/mockito/replacemockitotestexecutionlistener.md @@ -0,0 +1,234 @@ +--- +sidebar_label: "Replace `MockitoTestExecutionListener` with the equivalent Mockito test initialization" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Replace `MockitoTestExecutionListener` with the equivalent Mockito test initialization + +**org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener** + +_Replace `@TestExecutionListeners(MockitoTestExecutionListener.class)` with the appropriate Mockito initialization for the test framework in use: `@ExtendWith(MockitoExtension.class)` for JUnit 5, `@RunWith(MockitoJUnitRunner.class)` for JUnit 4, or `MockitoAnnotations.openMocks(this)` for TestNG._ + +## Recipe source + +[GitHub: ReplaceMockitoTestExecutionListener.java](https://github.com/openrewrite/rewrite-testing-frameworks/blob/main/src/main/java/org/openrewrite/java/testing/mockito/ReplaceMockitoTestExecutionListener.java), +[Issue Tracker](https://github.com/openrewrite/rewrite-testing-frameworks/issues), +[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-testing-frameworks/) + +This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). + + +## Used by + +This recipe is used as part of the following composite recipes: + +* [Mockito 3.x migration from 1.x](/recipes/java/testing/mockito/mockito1to3migration.md) + + +## Usage + +This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-testing-frameworks` in your build file or by running a shell command (in which case no build changes are needed): + + + +1. Add the following to your `build.gradle` file: + +```groovy title="build.gradle" +plugins { + id("org.openrewrite.rewrite") version("latest.release") +} + +rewrite { + activeRecipe("org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener") + setExportDatatables(true) +} + +repositories { + mavenCentral() +} + +dependencies { + rewrite("org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}}") +} +``` + +2. Run `gradle rewriteRun` to run the recipe. + + + + +1. Create a file named `init.gradle` in the root of your project. + +```groovy title="init.gradle" +initscript { + repositories { + maven { url "https://plugins.gradle.org/m2" } + } + dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } +} +rootProject { + plugins.apply(org.openrewrite.gradle.RewritePlugin) + dependencies { + rewrite("org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}}") + } + rewrite { + activeRecipe("org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener") + setExportDatatables(true) + } + afterEvaluate { + if (repositories.isEmpty()) { + repositories { + mavenCentral() + } + } + } +} +``` + +2. Run the recipe. + +```shell title="shell" +gradle --init-script init.gradle rewriteRun +``` + + + + +1. Add the following to your `pom.xml` file: + +```xml title="pom.xml" + + + + + org.openrewrite.maven + rewrite-maven-plugin + {{VERSION_REWRITE_MAVEN_PLUGIN}} + + true + + org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener + + + + + org.openrewrite.recipe + rewrite-testing-frameworks + {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}} + + + + + + +``` + +2. Run `mvn rewrite:run` to run the recipe. + + + +You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. + +```shell title="shell" +mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener -Drewrite.exportDatatables=true +``` + + + +You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. + +```shell title="shell" +mod run . --recipe ReplaceMockitoTestExecutionListener +``` + +If the recipe is not available locally, then you can install it using: +```shell +mod config recipes jar install org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}} +``` + + + +## See how this recipe works across multiple open-source repositories + +import RecipeCallout from '@site/src/components/ModerneLink'; + + + +The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. + +Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. +## Data Tables + + + + +### Source files that had results +**org.openrewrite.table.SourcesFileResults** + +_Source files that were modified by the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | +| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | +| Recipe that made changes | The specific recipe that made a change. | +| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | +| Cycle | The recipe cycle in which the change was made. | + + + + + +### Source files that had search results +**org.openrewrite.table.SearchResults** + +_Search results that were found during the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path of search result before the run | The source path of the file with the search result markers present. | +| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Result | The trimmed printed tree of the LST element that the marker is attached to. | +| Description | The content of the description of the marker. | +| Recipe that added the search marker | The specific recipe that added the Search marker. | + + + + + +### Source files that errored on a recipe +**org.openrewrite.table.SourcesFileErrors** + +_The details of all errors produced by a recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path | The file that failed to parse. | +| Recipe that made changes | The specific recipe that made a change. | +| Stack trace | The stack trace of the failure. | + + + + + +### Recipe performance +**org.openrewrite.table.RecipeRunStats** + +_Statistics used in analyzing the performance of recipes._ + +| Column Name | Description | +| ----------- | ----------- | +| The recipe | The recipe whose stats are being measured both individually and cumulatively. | +| Source file count | The number of source files the recipe ran over. | +| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | +| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | +| Max scanning time (ns) | The max time scanning any one source file. | +| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | +| Max edit time (ns) | The max time editing any one source file. | + + + + diff --git a/docs/recipes/java/testing/mockito/replacepowermockdependencies.md b/docs/recipes/java/testing/mockito/replacepowermockdependencies.md new file mode 100644 index 0000000000..d5a8e52d91 --- /dev/null +++ b/docs/recipes/java/testing/mockito/replacepowermockdependencies.md @@ -0,0 +1,234 @@ +--- +sidebar_label: "Replace PowerMock dependencies with Mockito equivalents" +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# Replace PowerMock dependencies with Mockito equivalents + +**org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies** + +_Replaces PowerMock API dependencies with `mockito-inline` when `mockStatic()`, `whenNew()`, or `@PrepareForTest` usage is detected, or `mockito-core` otherwise. PowerMock features like static mocking, constructor mocking, and final class mocking require the inline mock maker which is bundled in `mockito-inline` for Mockito 3.x/4.x._ + +## Recipe source + +[GitHub: ReplacePowerMockDependencies.java](https://github.com/openrewrite/rewrite-testing-frameworks/blob/main/src/main/java/org/openrewrite/java/testing/mockito/ReplacePowerMockDependencies.java), +[Issue Tracker](https://github.com/openrewrite/rewrite-testing-frameworks/issues), +[Maven Central](https://central.sonatype.com/artifact/org.openrewrite.recipe/rewrite-testing-frameworks/) + +This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license). + + +## Used by + +This recipe is used as part of the following composite recipes: + +* [Replace PowerMock with raw Mockito](/recipes/java/testing/mockito/replacepowermockito.md) + + +## Usage + +This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite.recipe:rewrite-testing-frameworks` in your build file or by running a shell command (in which case no build changes are needed): + + + +1. Add the following to your `build.gradle` file: + +```groovy title="build.gradle" +plugins { + id("org.openrewrite.rewrite") version("latest.release") +} + +rewrite { + activeRecipe("org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies") + setExportDatatables(true) +} + +repositories { + mavenCentral() +} + +dependencies { + rewrite("org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}}") +} +``` + +2. Run `gradle rewriteRun` to run the recipe. + + + + +1. Create a file named `init.gradle` in the root of your project. + +```groovy title="init.gradle" +initscript { + repositories { + maven { url "https://plugins.gradle.org/m2" } + } + dependencies { classpath("org.openrewrite:plugin:{{VERSION_REWRITE_GRADLE_PLUGIN}}") } +} +rootProject { + plugins.apply(org.openrewrite.gradle.RewritePlugin) + dependencies { + rewrite("org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}}") + } + rewrite { + activeRecipe("org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies") + setExportDatatables(true) + } + afterEvaluate { + if (repositories.isEmpty()) { + repositories { + mavenCentral() + } + } + } +} +``` + +2. Run the recipe. + +```shell title="shell" +gradle --init-script init.gradle rewriteRun +``` + + + + +1. Add the following to your `pom.xml` file: + +```xml title="pom.xml" + + + + + org.openrewrite.maven + rewrite-maven-plugin + {{VERSION_REWRITE_MAVEN_PLUGIN}} + + true + + org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies + + + + + org.openrewrite.recipe + rewrite-testing-frameworks + {{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}} + + + + + + +``` + +2. Run `mvn rewrite:run` to run the recipe. + + + +You will need to have [Maven](https://maven.apache.org/download.cgi) installed on your machine before you can run the following command. + +```shell title="shell" +mvn -U org.openrewrite.maven:rewrite-maven-plugin:run -Drewrite.recipeArtifactCoordinates=org.openrewrite.recipe:rewrite-testing-frameworks:RELEASE -Drewrite.activeRecipes=org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies -Drewrite.exportDatatables=true +``` + + + +You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command. + +```shell title="shell" +mod run . --recipe ReplacePowerMockDependencies +``` + +If the recipe is not available locally, then you can install it using: +```shell +mod config recipes jar install org.openrewrite.recipe:rewrite-testing-frameworks:{{VERSION_ORG_OPENREWRITE_RECIPE_REWRITE_TESTING_FRAMEWORKS}} +``` + + + +## See how this recipe works across multiple open-source repositories + +import RecipeCallout from '@site/src/components/ModerneLink'; + + + +The community edition of the Moderne platform enables you to easily run recipes across thousands of open-source repositories. + +Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS. +## Data Tables + + + + +### Source files that had results +**org.openrewrite.table.SourcesFileResults** + +_Source files that were modified by the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. | +| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. | +| Recipe that made changes | The specific recipe that made a change. | +| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. | +| Cycle | The recipe cycle in which the change was made. | + + + + + +### Source files that had search results +**org.openrewrite.table.SearchResults** + +_Search results that were found during the recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path of search result before the run | The source path of the file with the search result markers present. | +| Source path of search result after run the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. | +| Result | The trimmed printed tree of the LST element that the marker is attached to. | +| Description | The content of the description of the marker. | +| Recipe that added the search marker | The specific recipe that added the Search marker. | + + + + + +### Source files that errored on a recipe +**org.openrewrite.table.SourcesFileErrors** + +_The details of all errors produced by a recipe run._ + +| Column Name | Description | +| ----------- | ----------- | +| Source path | The file that failed to parse. | +| Recipe that made changes | The specific recipe that made a change. | +| Stack trace | The stack trace of the failure. | + + + + + +### Recipe performance +**org.openrewrite.table.RecipeRunStats** + +_Statistics used in analyzing the performance of recipes._ + +| Column Name | Description | +| ----------- | ----------- | +| The recipe | The recipe whose stats are being measured both individually and cumulatively. | +| Source file count | The number of source files the recipe ran over. | +| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. | +| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. | +| Max scanning time (ns) | The max time scanning any one source file. | +| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. | +| Max edit time (ns) | The max time editing any one source file. | + + + + From eb4315fa79125c0515298c67d7d6b359fb0a01d2 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 9 Mar 2026 17:40:37 +0100 Subject: [PATCH 4/6] Update reference files diff --git c/docs/reference/all-recipes.md i/docs/reference/all-recipes.md index 31c82f3c78..95e30c7d6d 100644 --- c/docs/reference/all-recipes.md +++ i/docs/reference/all-recipes.md @@ -6,7 +6,7 @@ description: A comprehensive list of all recipes organized by module. _This doc contains all recipes grouped by their module._ -Total recipes: 4217 +Total recipes: 4202 ## io.moderne.recipe:rewrite-devcenter @@ -9190,7 +9190,7 @@ _18 recipes_ _License: Unknown_ -_1263 recipes_ +_1248 recipes_ * [ai.timefold.solver.migration.ChangeVersion](/recipes/ai/timefold/solver/migration/changeversion.md) * **Change the Timefold version** @@ -12450,51 +12450,6 @@ _1263 recipes_ * [org.openrewrite.java.testing.truth.MigrateTruthToAssertJ](/recipes/java/testing/truth/migratetruthtoassertj.md) * **Migrate Google Truth to AssertJ** * Migrate Google Truth assertions to AssertJ assertions. -* [org.openrewrite.javascript.change-import](/recipes/javascript/change-import.md) - * **Change import** - * Changes an import from one module/member to another, updating all type attributions. -* [org.openrewrite.javascript.cleanup.add-parse-int-radix](/recipes/javascript/cleanup/add-parse-int-radix.md) - * **Add radix to `parseInt`** - * Adds the radix parameter (base 10) to `parseInt()` calls that are missing it, preventing potential parsing issues. -* [org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](/recipes/javascript/cleanup/async-callback-in-sync-array-method.md) - * **Detect async callbacks in synchronous array methods** - * Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. -* [org.openrewrite.javascript.cleanup.order-imports](/recipes/javascript/cleanup/order-imports.md) - * **Order imports** - * Sort imports by category and module path. Categories: side-effect, namespace, default, named, type. Within each category, imports are sorted alphabetically by module path. Named specifiers within each import are also sorted alphabetically. -* [org.openrewrite.javascript.cleanup.prefer-optional-chain](/recipes/javascript/cleanup/prefer-optional-chain.md) - * **Prefer optional chaining** - * Converts ternary expressions like `foo ? foo.bar : undefined` to use optional chaining syntax `foo?.bar`. -* [org.openrewrite.javascript.cleanup.use-object-property-shorthand](/recipes/javascript/cleanup/use-object-property-shorthand.md) - * **Use object property shorthand** - * Simplifies object properties where the property name and value/variable name are the same (e.g., `\{ x: x \}` becomes `\{ x \}`). Applies to both destructuring patterns and object literals. -* [org.openrewrite.javascript.dependencies.add-dependency](/recipes/javascript/dependencies/add-dependency.md) - * **Add npm dependency** - * Adds a new dependency to `package.json` and updates the lock file by running the package manager. -* [org.openrewrite.javascript.dependencies.find-dependency](/recipes/javascript/dependencies/find-dependency.md) - * **Find Node.js dependency** - * Finds dependencies in a project's `package.json`. Can find both direct dependencies and dependencies that transitively include the target package. This recipe is commonly used as a precondition for other recipes. -* [org.openrewrite.javascript.dependencies.upgrade-dependency-version](/recipes/javascript/dependencies/upgrade-dependency-version.md) - * **Upgrade npm dependency version** - * Upgrades the version of a direct dependency in `package.json` and updates the lock file by running the package manager. -* [org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version](/recipes/javascript/dependencies/upgrade-transitive-dependency-version.md) - * **Upgrade transitive npm dependency version** - * Upgrades the version of a transitive dependency by adding override/resolution entries to `package.json` and updates the lock file by running the package manager. -* [org.openrewrite.javascript.format.auto-format](/recipes/javascript/format/auto-format.md) - * **Auto-format JavaScript/TypeScript code** - * Format JavaScript and TypeScript code using formatting rules auto-detected from the project's existing code style. -* [org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences](/recipes/javascript/migrate/es6/modernize-octal-escape-sequences.md) - * **Modernize octal escape sequences** - * Convert old-style octal escape sequences (e.g., `\0`, `\123`) to modern hex escape sequences (e.g., `\x00`, `\x53`) or Unicode escape sequences (e.g., `\u0000`, `\u0053`). -* [org.openrewrite.javascript.migrate.es6.modernize-octal-literals](/recipes/javascript/migrate/es6/modernize-octal-literals.md) - * **Modernize octal literals** - * Convert old-style octal literals (e.g., `0777`) to modern ES6 syntax (e.g., `0o777`). -* [org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys](/recipes/javascript/migrate/es6/remove-duplicate-object-keys.md) - * **Remove duplicate object keys** - * Remove duplicate keys in object literals, keeping only the last occurrence (last-wins semantics). -* [org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default](/recipes/javascript/migrate/typescript/export-assignment-to-export-default.md) - * **Convert `export =` to `export default`** - * Converts TypeScript `export =` syntax to ES module `export default` syntax for compatibility with ECMAScript modules. * [org.openrewrite.jenkins.CommonsLang3ToApiPlugin](/recipes/jenkins/commonslang3toapiplugin.md) * **Use commons-lang3 API Plugin** * Updates `pom.xml` to depend on `commons-lang3-api` and exclude `commons-lang3` where it is brought in transitively. diff --git c/docs/reference/moderne-recipes.md i/docs/reference/moderne-recipes.md index 6f86d71da3..db80569032 100644 --- c/docs/reference/moderne-recipes.md +++ i/docs/reference/moderne-recipes.md @@ -997,109 +997,406 @@ This doc includes every recipe that is exclusive to users of Moderne. For a full ## rewrite-migrate-python +* [org.openrewrite.python.migrate.DetectPercentFormatting](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/detectpercentformatting) + * **Detect `%` string formatting** + * Detect usage of %-style string formatting which could be migrated to f-strings (Python 3.6+). Manual review is recommended for conversion. +* [org.openrewrite.python.migrate.DetectStrFormat](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/detectstrformat) + * **Detect `str.format()` string formatting** + * Detect usage of str.format() method which could be migrated to f-strings (Python 3.6+). Manual review is recommended for conversion. +* [org.openrewrite.python.migrate.FindAifcModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findaifcmodule) + * **Find deprecated `aifc` module usage** + * The `aifc` module was deprecated in Python 3.11 and removed in Python 3.13. Use third-party audio libraries instead. +* [org.openrewrite.python.migrate.FindAsyncioCoroutineDecorator](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findasynciocoroutinedecorator) + * **Find deprecated `@asyncio.coroutine` decorator** + * Find usage of the deprecated `@asyncio.coroutine` decorator which was removed in Python 3.11. Convert to `async def` syntax with `await` instead of `yield from`. +* [org.openrewrite.python.migrate.FindAudioopModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findaudioopmodule) + * **Find deprecated `audioop` module usage** + * The `audioop` module was deprecated in Python 3.11 and removed in Python 3.13. Use pydub, numpy, or scipy for audio operations. +* [org.openrewrite.python.migrate.FindCgiModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findcgimodule) + * **Find deprecated `cgi` module usage** + * The `cgi` module was deprecated in Python 3.11 and removed in Python 3.13. Use `urllib.parse` for query string parsing, `html.escape()` for escaping, and web frameworks or `email.message` for form handling. +* [org.openrewrite.python.migrate.FindCgitbModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findcgitbmodule) + * **Find deprecated `cgitb` module usage** + * The `cgitb` module was deprecated in Python 3.11 and removed in Python 3.13. Use the standard `logging` and `traceback` modules for error handling. +* [org.openrewrite.python.migrate.FindChunkModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findchunkmodule) + * **Find deprecated `chunk` module usage** + * The `chunk` module was deprecated in Python 3.11 and removed in Python 3.13. Implement IFF chunk reading manually or use specialized libraries. +* [org.openrewrite.python.migrate.FindCryptModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findcryptmodule) + * **Find deprecated `crypt` module usage** + * The `crypt` module was deprecated in Python 3.11 and removed in Python 3.13. Use `bcrypt`, `argon2-cffi`, or `passlib` instead. +* [org.openrewrite.python.migrate.FindDistutilsUsage](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/finddistutilsusage) + * **Find deprecated distutils module usage** + * Find imports of the deprecated `distutils` module which was removed in Python 3.12. Migrate to `setuptools` or other modern build tools. +* [org.openrewrite.python.migrate.FindElementGetchildren](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findelementgetchildren) + * **Find deprecated `Element.getchildren()` usage** + * Find usage of `getchildren()` method on XML Element objects. Deprecated in Python 3.9. Use `list(element)` instead. +* [org.openrewrite.python.migrate.FindFunctoolsCmpToKey](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findfunctoolscmptokey) + * **Find `functools.cmp_to_key()` usage** + * Find usage of `functools.cmp_to_key()` which is a Python 2 compatibility function. Consider using a key function directly. * [org.openrewrite.python.migrate.FindFutureImports](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findfutureimports) * **Find `__future__` imports** * Find `__future__` imports and add a search marker. +* [org.openrewrite.python.migrate.FindImghdrModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findimghdrmodule) + * **Find deprecated `imghdr` module usage** + * The `imghdr` module was deprecated in Python 3.11 and removed in Python 3.13. Use `filetype`, `python-magic`, or `Pillow` instead. +* [org.openrewrite.python.migrate.FindImpUsage](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findimpusage) + * **Find deprecated imp module usage** + * Find imports of the deprecated `imp` module which was removed in Python 3.12. Migrate to `importlib`. +* [org.openrewrite.python.migrate.FindMailcapModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findmailcapmodule) + * **Find deprecated `mailcap` module usage** + * The `mailcap` module was deprecated in Python 3.11 and removed in Python 3.13. Use `mimetypes` module for MIME type handling. +* [org.openrewrite.python.migrate.FindMsilibModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findmsilibmodule) + * **Find deprecated `msilib` module usage** + * The `msilib` module was deprecated in Python 3.11 and removed in Python 3.13. Use platform-specific tools for MSI creation. +* [org.openrewrite.python.migrate.FindNisModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findnismodule) + * **Find deprecated `nis` module usage** + * The `nis` module was deprecated in Python 3.11 and removed in Python 3.13. There is no direct replacement. +* [org.openrewrite.python.migrate.FindNntplibModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findnntplibmodule) + * **Find deprecated `nntplib` module usage** + * The `nntplib` module was deprecated in Python 3.11 and removed in Python 3.13. NNTP is largely obsolete; consider alternatives if needed. +* [org.openrewrite.python.migrate.FindOsPopen](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findospopen) + * **Find deprecated `os.popen()` usage** + * `os.popen()` has been deprecated since Python 3.6. Use `subprocess.run()` or `subprocess.Popen()` instead for better control over process creation and output handling. +* [org.openrewrite.python.migrate.FindOsSpawn](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findosspawn) + * **Find deprecated `os.spawn*()` usage** + * The `os.spawn*()` family of functions are deprecated. Use `subprocess.run()` or `subprocess.Popen()` instead. +* [org.openrewrite.python.migrate.FindOssaudiodevModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findossaudiodevmodule) + * **Find deprecated `ossaudiodev` module usage** + * The `ossaudiodev` module was deprecated in Python 3.11 and removed in Python 3.13. There is no direct replacement. +* [org.openrewrite.python.migrate.FindPathlibLinkTo](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findpathliblinkto) + * **Find deprecated `Path.link_to()` usage** + * Find usage of `Path.link_to()` which was deprecated in Python 3.10 and removed in 3.12. Use `hardlink_to()` instead (note: argument order is reversed). +* [org.openrewrite.python.migrate.FindPipesModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findpipesmodule) + * **Find deprecated `pipes` module usage** + * The `pipes` module was deprecated in Python 3.11 and removed in Python 3.13. Use subprocess with shlex.quote() for shell escaping. +* [org.openrewrite.python.migrate.FindRemovedModules312](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findremovedmodules312) + * **Find modules removed in Python 3.12** + * Find imports of modules that were removed in Python 3.12, including asynchat, asyncore, and smtpd. +* [org.openrewrite.python.migrate.FindSndhdrModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findsndhdrmodule) + * **Find deprecated `sndhdr` module usage** + * The `sndhdr` module was deprecated in Python 3.11 and removed in Python 3.13. Use `filetype` or audio libraries like `pydub` instead. +* [org.openrewrite.python.migrate.FindSocketGetFQDN](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findsocketgetfqdn) + * **Find `socket.getfqdn()` usage** + * Find usage of `socket.getfqdn()` which can be slow and unreliable. Consider using `socket.gethostname()` instead. +* [org.openrewrite.python.migrate.FindSpwdModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findspwdmodule) + * **Find deprecated `spwd` module usage** + * The `spwd` module was deprecated in Python 3.11 and removed in Python 3.13. There is no direct replacement. +* [org.openrewrite.python.migrate.FindSslMatchHostname](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findsslmatchhostname) + * **Find deprecated `ssl.match_hostname()`** + * Find usage of the deprecated `ssl.match_hostname()` function which was removed in Python 3.12. Use `ssl.SSLContext.check_hostname` instead. +* [org.openrewrite.python.migrate.FindSunauModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findsunaumodule) + * **Find deprecated `sunau` module usage** + * The `sunau` module was deprecated in Python 3.11 and removed in Python 3.13. Use `soundfile` or `pydub` instead. +* [org.openrewrite.python.migrate.FindTelnetlibModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findtelnetlibmodule) + * **Find deprecated `telnetlib` module usage** + * The `telnetlib` module was deprecated in Python 3.11 and removed in Python 3.13. Consider using `telnetlib3` from PyPI, direct socket usage, or SSH-based alternatives like paramiko. +* [org.openrewrite.python.migrate.FindTempfileMktemp](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findtempfilemktemp) + * **Find deprecated `tempfile.mktemp()` usage** + * Find usage of `tempfile.mktemp()` which is deprecated due to security concerns (race condition). Use `mkstemp()` or `NamedTemporaryFile()` instead. +* [org.openrewrite.python.migrate.FindUrllibParseSplitFunctions](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findurllibparsesplitfunctions) + * **Find deprecated urllib.parse split functions** + * Find usage of deprecated urllib.parse split functions (splithost, splitport, etc.) removed in Python 3.14. Use urlparse() instead. +* [org.openrewrite.python.migrate.FindUrllibParseToBytes](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findurllibparsetobytes) + * **Find deprecated `urllib.parse.to_bytes()` usage** + * Find usage of `urllib.parse.to_bytes()` which was deprecated in Python 3.8 and removed in 3.14. Use str.encode() directly. +* [org.openrewrite.python.migrate.FindUuModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/finduumodule) + * **Find deprecated `uu` module usage** + * The `uu` module was deprecated in Python 3.11 and removed in Python 3.13. Use `base64` module instead for encoding binary data. +* [org.openrewrite.python.migrate.FindXdrlibModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findxdrlibmodule) + * **Find deprecated `xdrlib` module usage** + * The `xdrlib` module was deprecated in Python 3.11 and removed in Python 3.13. Use `struct` module for binary packing/unpacking. +* [org.openrewrite.python.migrate.MigrateAsyncioCoroutine](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/migrateasynciocoroutine) + * **Migrate `@asyncio.coroutine` to `async def`** + * Migrate functions using the deprecated `@asyncio.coroutine` decorator to use `async def` syntax. Also transforms `yield from` to `await`. The decorator was removed in Python 3.11. * [org.openrewrite.python.migrate.MigrateToPyprojectToml](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/migratetopyprojecttoml) * **Migrate to `pyproject.toml`** * Migrate Python projects from `requirements.txt` and/or `setup.cfg` to `pyproject.toml` with `hatchling` build backend. +* [org.openrewrite.python.migrate.ReplaceArrayFromstring](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacearrayfromstring) + * **Replace `array.fromstring()` with `array.frombytes()`** + * Replace `fromstring()` with `frombytes()` on array objects. The fromstring() method was deprecated in Python 3.2 and removed in 3.14. +* [org.openrewrite.python.migrate.ReplaceArrayTostring](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacearraytostring) + * **Replace `array.tostring()` with `array.tobytes()`** + * Replace `tostring()` with `tobytes()` on array objects. The tostring() method was deprecated in Python 3.2 and removed in 3.14. +* [org.openrewrite.python.migrate.ReplaceAstBytes](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceastbytes) + * **Replace `ast.Bytes` with `ast.Constant`** + * The `ast.Bytes` node type was deprecated in Python 3.8 and removed in Python 3.14. Replace with `ast.Constant` and check `isinstance(node.value, bytes)`. +* [org.openrewrite.python.migrate.ReplaceAstEllipsis](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceastellipsis) + * **Replace `ast.Ellipsis` with `ast.Constant`** + * The `ast.Ellipsis` node type was deprecated in Python 3.8 and removed in Python 3.14. Replace with `ast.Constant` and check `node.value is ...`. +* [org.openrewrite.python.migrate.ReplaceAstNameConstant](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceastnameconstant) + * **Replace `ast.NameConstant` with `ast.Constant`** + * The `ast.NameConstant` node type was deprecated in Python 3.8 and removed in Python 3.14. Replace with `ast.Constant` and check `node.value in (True, False, None)`. +* [org.openrewrite.python.migrate.ReplaceAstNum](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceastnum) + * **Replace `ast.Num` with `ast.Constant`** + * The `ast.Num` node type was deprecated in Python 3.8 and removed in Python 3.14. Replace with `ast.Constant` and check `isinstance(node.value, (int, float, complex))`. +* [org.openrewrite.python.migrate.ReplaceAstStr](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceaststr) + * **Replace `ast.Str` with `ast.Constant`** + * The `ast.Str` node type was deprecated in Python 3.8 and removed in Python 3.14. Replace with `ast.Constant` and check `isinstance(node.value, str)`. +* [org.openrewrite.python.migrate.ReplaceBase64Decodestring](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacebase64decodestring) + * **Replace `base64.decodestring()` with `base64.decodebytes()`** + * Replace `base64.decodestring()` with `base64.decodebytes()`. The decodestring() method was deprecated in Python 3.1 and removed in 3.9. +* [org.openrewrite.python.migrate.ReplaceBase64Encodestring](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacebase64encodestring) + * **Replace `base64.encodestring()` with `base64.encodebytes()`** + * Replace `base64.encodestring()` with `base64.encodebytes()`. The encodestring() method was deprecated in Python 3.1 and removed in 3.9. +* [org.openrewrite.python.migrate.ReplaceCalendarConstants](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacecalendarconstants) + * **Replace deprecated calendar constants with uppercase** + * Replace deprecated mixed-case calendar constants like `calendar.January` with their uppercase equivalents like `calendar.JANUARY`. The mixed-case constants were deprecated in Python 3.12. +* [org.openrewrite.python.migrate.ReplaceCgiEscape](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacecgiescape) + * **Replace `cgi.escape()` with `html.escape()`** + * Replace `cgi.escape()` with `html.escape()`. cgi.escape() was deprecated in Python 3.2 and removed in Python 3.8. +* [org.openrewrite.python.migrate.ReplaceCollectionsAbcImports](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacecollectionsabcimports) + * **Replace `collections` ABC imports with `collections.abc`** + * Migrate deprecated abstract base class imports from `collections` to `collections.abc`. These imports were deprecated in Python 3.3 and removed in Python 3.10. +* [org.openrewrite.python.migrate.ReplaceConditionNotifyAll](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceconditionnotifyall) + * **Replace `Condition.notifyAll()` with `Condition.notify_all()`** + * Replace `notifyAll()` method calls with `notify_all()`. The camelCase version was deprecated in Python 3.10 and removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceConfigparserReadfp](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceconfigparserreadfp) + * **Replace `ConfigParser.readfp()` with `read_file()`** + * The `ConfigParser.readfp()` method was deprecated in Python 3.2 and removed in Python 3.13. Replace with `read_file()`. +* [org.openrewrite.python.migrate.ReplaceConfigparserSafeConfigParser](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceconfigparsersafeconfigparser) + * **Replace `configparser.SafeConfigParser` with `ConfigParser`** + * The `configparser.SafeConfigParser` class was deprecated in Python 3.2 and removed in Python 3.12. Replace with `configparser.ConfigParser`. +* [org.openrewrite.python.migrate.ReplaceDatetimeUtcFromTimestamp](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacedatetimeutcfromtimestamp) + * **Replace `datetime.utcfromtimestamp()` with `datetime.fromtimestamp(ts, UTC)`** + * The `datetime.utcfromtimestamp()` method is deprecated in Python 3.12. Replace it with `datetime.fromtimestamp(ts, datetime.UTC)` for timezone-aware datetime objects. +* [org.openrewrite.python.migrate.ReplaceDatetimeUtcNow](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacedatetimeutcnow) + * **Replace `datetime.utcnow()` with `datetime.now(UTC)`** + * The `datetime.utcnow()` method is deprecated in Python 3.12. Replace it with `datetime.now(datetime.UTC)` for timezone-aware datetime objects. +* [org.openrewrite.python.migrate.ReplaceDistutilsVersion](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacedistutilsversion) + * **Replace deprecated distutils.version usage** + * Detect usage of deprecated `distutils.version.LooseVersion` and `distutils.version.StrictVersion`. These should be migrated to `packaging.version.Version`. Note: Manual migration is required as `packaging.version.Version` is not a drop-in replacement. +* [org.openrewrite.python.migrate.ReplaceElementGetiterator](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceelementgetiterator) + * **Replace `Element.getiterator()` with `Element.iter()`** + * Replace `getiterator()` with `iter()` on XML Element objects. The getiterator() method was deprecated in Python 3.9. +* [org.openrewrite.python.migrate.ReplaceEventIsSet](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceeventisset) + * **Replace `Event.isSet()` with `Event.is_set()`** + * Replace `isSet()` method calls with `is_set()`. The camelCase version was deprecated in Python 3.10 and removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceGettextDeprecations](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacegettextdeprecations) + * **Replace deprecated gettext l*gettext() functions** + * Replace deprecated gettext functions like `lgettext()` with their modern equivalents like `gettext()`. The l*gettext() functions were removed in Python 3.11. +* [org.openrewrite.python.migrate.ReplaceImpImport](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceimpimport) + * **Replace `import imp` with `import importlib`** + * Replace `import imp` with `import importlib` for code that only uses imp.reload(). Also replaces `from imp import reload`. +* [org.openrewrite.python.migrate.ReplaceImpReload](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceimpreload) + * **Replace `imp.reload()` with `importlib.reload()`** + * Replace `imp.reload()` with `importlib.reload()`. This is a direct 1:1 replacement with identical behavior. +* [org.openrewrite.python.migrate.ReplaceInspectGetargspec](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceinspectgetargspec) + * **Replace `inspect.getargspec()` with `inspect.getfullargspec()`** + * The `inspect.getargspec()` function was deprecated in Python 3.0 and removed in Python 3.11. Replace with `inspect.getfullargspec()`. Note that code accessing the `keywords` field must be updated to use `varkw`. +* [org.openrewrite.python.migrate.ReplaceLocaleResetlocale](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacelocaleresetlocale) + * **Replace `locale.resetlocale()` with `locale.setlocale(LC_ALL, '')`** + * The `locale.resetlocale()` function was deprecated in Python 3.11 and removed in Python 3.13. Replace with `locale.setlocale(locale.LC_ALL, '')`. +* [org.openrewrite.python.migrate.ReplaceLoggingWarn](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceloggingwarn) + * **Replace `logging.warn()` with `logging.warning()`** + * Replace `warn()` calls with `warning()`. The warn() method was deprecated in Python 3.3. +* [org.openrewrite.python.migrate.ReplacePkgutilFindLoader](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacepkgutilfindloader) + * **Replace `pkgutil.find_loader()` with `importlib.util.find_spec()`** + * The `pkgutil.find_loader()` function was deprecated in Python 3.12. Replace with `importlib.util.find_spec()`. Note: returns ModuleSpec, use .loader for loader. +* [org.openrewrite.python.migrate.ReplacePkgutilGetLoader](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacepkgutilgetloader) + * **Replace `pkgutil.get_loader()` with `importlib.util.find_spec()`** + * The `pkgutil.get_loader()` function was deprecated in Python 3.12. Replace with `importlib.util.find_spec()`. Note: returns ModuleSpec, use .loader for loader. +* [org.openrewrite.python.migrate.ReplaceStrFormatWithFString](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacestrformatwithfstring) + * **Replace `str.format()` with f-string** + * Replace `"...".format(...)` calls with f-strings (Python 3.6+). Only converts cases where the format string is a literal and the conversion is safe. +* [org.openrewrite.python.migrate.ReplaceThreadGetName](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacethreadgetname) + * **Replace `Thread.getName()` with `Thread.name`** + * Replace `getName()` method calls with the `name` property. Deprecated in Python 3.10, removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceThreadIsDaemon](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacethreadisdaemon) + * **Replace `Thread.isDaemon()` with `Thread.daemon`** + * Replace `isDaemon()` method calls with the `daemon` property. Deprecated in Python 3.10, removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceThreadSetDaemon](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacethreadsetdaemon) + * **Replace `Thread.setDaemon()` with `Thread.daemon = ...`** + * Replace `setDaemon()` method calls with `daemon` property assignment. Deprecated in Python 3.10, removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceThreadSetName](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacethreadsetname) + * **Replace `Thread.setName()` with `Thread.name = ...`** + * Replace `setName()` method calls with `name` property assignment. Deprecated in Python 3.10, removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceThreadingActiveCount](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacethreadingactivecount) + * **Replace `threading.activeCount()` with `threading.active_count()`** + * Replace `threading.activeCount()` with `threading.active_count()`. The camelCase version was deprecated in Python 3.10 and removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceThreadingCurrentThread](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacethreadingcurrentthread) + * **Replace `threading.currentThread()` with `threading.current_thread()`** + * Replace `threading.currentThread()` with `threading.current_thread()`. The camelCase version was deprecated in Python 3.10 and removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceTypingAbstractSetWithCollectionsAbcSet](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingabstractsetwithcollectionsabcset) + * **Replace `typing.AbstractSet` with `collections.abc.Set`** + * Replace `typing.AbstractSet` with `collections.abc.Set`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingAsyncContextManagerWithContextlib](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingasynccontextmanagerwithcontextlib) + * **Replace `typing.AsyncContextManager` with `contextlib.AbstractAsyncContextManager`** + * Replace `typing.AsyncContextManager` with `contextlib.AbstractAsyncContextManager`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingAsyncGeneratorWithCollectionsAbcAsyncGenerator](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingasyncgeneratorwithcollectionsabcasyncgenerator) + * **Replace `typing.AsyncGenerator` with `collections.abc.AsyncGenerator`** + * Replace `typing.AsyncGenerator` with `collections.abc.AsyncGenerator`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingAsyncIterableWithCollectionsAbcAsyncIterable](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingasynciterablewithcollectionsabcasynciterable) + * **Replace `typing.AsyncIterable` with `collections.abc.AsyncIterable`** + * Replace `typing.AsyncIterable` with `collections.abc.AsyncIterable`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingAsyncIteratorWithCollectionsAbcAsyncIterator](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingasynciteratorwithcollectionsabcasynciterator) + * **Replace `typing.AsyncIterator` with `collections.abc.AsyncIterator`** + * Replace `typing.AsyncIterator` with `collections.abc.AsyncIterator`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingAwaitableWithCollectionsAbcAwaitable](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingawaitablewithcollectionsabcawaitable) + * **Replace `typing.Awaitable` with `collections.abc.Awaitable`** + * Replace `typing.Awaitable` with `collections.abc.Awaitable`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingCallableWithCollectionsAbcCallable](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingcallablewithcollectionsabccallable) + * **Replace `typing.Callable` with `collections.abc.Callable`** + * PEP 585 deprecated `typing.Callable` in Python 3.9. Replace with `collections.abc.Callable` for type annotations. +* [org.openrewrite.python.migrate.ReplaceTypingChainMapWithCollectionsChainMap](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingchainmapwithcollectionschainmap) + * **Replace `typing.ChainMap` with `collections.ChainMap`** + * Replace `typing.ChainMap` with `collections.ChainMap`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingCollectionWithCollectionsAbcCollection](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingcollectionwithcollectionsabccollection) + * **Replace `typing.Collection` with `collections.abc.Collection`** + * Replace `typing.Collection` with `collections.abc.Collection`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingContainerWithCollectionsAbcContainer](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingcontainerwithcollectionsabccontainer) + * **Replace `typing.Container` with `collections.abc.Container`** + * Replace `typing.Container` with `collections.abc.Container`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingContextManagerWithContextlib](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingcontextmanagerwithcontextlib) + * **Replace `typing.ContextManager` with `contextlib.AbstractContextManager`** + * Replace `typing.ContextManager` with `contextlib.AbstractContextManager`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingCoroutineWithCollectionsAbcCoroutine](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingcoroutinewithcollectionsabccoroutine) + * **Replace `typing.Coroutine` with `collections.abc.Coroutine`** + * Replace `typing.Coroutine` with `collections.abc.Coroutine`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingCounterWithCollectionsCounter](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingcounterwithcollectionscounter) + * **Replace `typing.Counter` with `collections.Counter`** + * Replace `typing.Counter` with `collections.Counter`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingDefaultDictWithCollectionsDefaultdict](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingdefaultdictwithcollectionsdefaultdict) + * **Replace `typing.DefaultDict` with `collections.defaultdict`** + * Replace `typing.DefaultDict` with `collections.defaultdict`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingDequeWithCollectionsDeque](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingdequewithcollectionsdeque) + * **Replace `typing.Deque` with `collections.deque`** + * Replace `typing.Deque` with `collections.deque`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingDictWithBuiltin](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingdictwithbuiltin) + * **Replace `typing.Dict` with `dict`** + * Replace `typing.Dict` with the built-in `dict` type. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingDictWithDict](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingdictwithdict) + * **Replace `typing.Dict` with `dict`** + * PEP 585 deprecated `typing.Dict` in Python 3.9. Replace with the built-in `dict` type for generic annotations. +* [org.openrewrite.python.migrate.ReplaceTypingFrozenSetWithBuiltin](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingfrozensetwithbuiltin) + * **Replace `typing.FrozenSet` with `frozenset`** + * Replace `typing.FrozenSet` with the built-in `frozenset` type. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingGeneratorWithCollectionsAbcGenerator](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypinggeneratorwithcollectionsabcgenerator) + * **Replace `typing.Generator` with `collections.abc.Generator`** + * Replace `typing.Generator` with `collections.abc.Generator`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingItemsViewWithCollectionsAbcItemsView](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingitemsviewwithcollectionsabcitemsview) + * **Replace `typing.ItemsView` with `collections.abc.ItemsView`** + * Replace `typing.ItemsView` with `collections.abc.ItemsView`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingIterableWithCollectionsAbcIterable](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingiterablewithcollectionsabciterable) + * **Replace `typing.Iterable` with `collections.abc.Iterable`** + * Replace `typing.Iterable` with `collections.abc.Iterable`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingIteratorWithCollectionsAbcIterator](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingiteratorwithcollectionsabciterator) + * **Replace `typing.Iterator` with `collections.abc.Iterator`** + * Replace `typing.Iterator` with `collections.abc.Iterator`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingKeysViewWithCollectionsAbcKeysView](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingkeysviewwithcollectionsabckeysview) + * **Replace `typing.KeysView` with `collections.abc.KeysView`** + * Replace `typing.KeysView` with `collections.abc.KeysView`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingListWithBuiltin](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypinglistwithbuiltin) + * **Replace `typing.List` with `list`** + * Replace `typing.List` with the built-in `list` type. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingListWithList](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypinglistwithlist) + * **Replace `typing.List` with `list`** + * PEP 585 deprecated `typing.List` in Python 3.9. Replace with the built-in `list` type for generic annotations. +* [org.openrewrite.python.migrate.ReplaceTypingMappingViewWithCollectionsAbcMappingView](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingmappingviewwithcollectionsabcmappingview) + * **Replace `typing.MappingView` with `collections.abc.MappingView`** + * Replace `typing.MappingView` with `collections.abc.MappingView`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingMappingWithCollectionsAbcMapping](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingmappingwithcollectionsabcmapping) + * **Replace `typing.Mapping` with `collections.abc.Mapping`** + * Replace `typing.Mapping` with `collections.abc.Mapping`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingMatchWithReMatch](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingmatchwithrematch) + * **Replace `typing.Match` with `re.Match`** + * Replace `typing.Match` with `re.Match`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingMutableMappingWithCollectionsAbcMutableMapping](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingmutablemappingwithcollectionsabcmutablemapping) + * **Replace `typing.MutableMapping` with `collections.abc.MutableMapping`** + * Replace `typing.MutableMapping` with `collections.abc.MutableMapping`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingMutableSequenceWithCollectionsAbcMutableSequence](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingmutablesequencewithcollectionsabcmutablesequence) + * **Replace `typing.MutableSequence` with `collections.abc.MutableSequence`** + * Replace `typing.MutableSequence` with `collections.abc.MutableSequence`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingMutableSetWithCollectionsAbcMutableSet](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingmutablesetwithcollectionsabcmutableset) + * **Replace `typing.MutableSet` with `collections.abc.MutableSet`** + * Replace `typing.MutableSet` with `collections.abc.MutableSet`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingOptionalWithUnion](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingoptionalwithunion) + * **Replace `typing.Optional[X]` with `X | None`** + * PEP 604 introduced the `|` operator for union types in Python 3.10. Replace `Optional[X]` with the more concise `X | None` syntax. +* [org.openrewrite.python.migrate.ReplaceTypingOrderedDictWithCollectionsOrderedDict](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingordereddictwithcollectionsordereddict) + * **Replace `typing.OrderedDict` with `collections.OrderedDict`** + * Replace `typing.OrderedDict` with `collections.OrderedDict`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingPatternWithRePattern](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingpatternwithrepattern) + * **Replace `typing.Pattern` with `re.Pattern`** + * Replace `typing.Pattern` with `re.Pattern`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingReversibleWithCollectionsAbcReversible](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingreversiblewithcollectionsabcreversible) + * **Replace `typing.Reversible` with `collections.abc.Reversible`** + * Replace `typing.Reversible` with `collections.abc.Reversible`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingSequenceWithCollectionsAbcSequence](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingsequencewithcollectionsabcsequence) + * **Replace `typing.Sequence` with `collections.abc.Sequence`** + * Replace `typing.Sequence` with `collections.abc.Sequence`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingSetWithBuiltin](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingsetwithbuiltin) + * **Replace `typing.Set` with `set`** + * Replace `typing.Set` with the built-in `set` type. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingSetWithSet](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingsetwithset) + * **Replace `typing.Set` with `set`** + * PEP 585 deprecated `typing.Set` in Python 3.9. Replace with the built-in `set` type for generic annotations. +* [org.openrewrite.python.migrate.ReplaceTypingText](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingtext) + * **Replace `typing.Text` with `str`** + * `typing.Text` is deprecated as of Python 3.11. It was an alias for `str` for Python 2/3 compatibility. Replace with `str`. +* [org.openrewrite.python.migrate.ReplaceTypingTupleWithBuiltin](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingtuplewithbuiltin) + * **Replace `typing.Tuple` with `tuple`** + * Replace `typing.Tuple` with the built-in `tuple` type. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingTupleWithTuple](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingtuplewithtuple) + * **Replace `typing.Tuple` with `tuple`** + * PEP 585 deprecated `typing.Tuple` in Python 3.9. Replace with the built-in `tuple` type for generic annotations. +* [org.openrewrite.python.migrate.ReplaceTypingTypeWithBuiltin](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingtypewithbuiltin) + * **Replace `typing.Type` with `type`** + * Replace `typing.Type` with the built-in `type` type. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingUnionWithPipe](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingunionwithpipe) + * **Replace `typing.Union[X, Y]` with `X | Y`** + * PEP 604 introduced the `|` operator for union types in Python 3.10. Replace `Union[X, Y, ...]` with the more concise `X | Y | ...` syntax. +* [org.openrewrite.python.migrate.ReplaceTypingValuesViewWithCollectionsAbcValuesView](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingvaluesviewwithcollectionsabcvaluesview) + * **Replace `typing.ValuesView` with `collections.abc.ValuesView`** + * Replace `typing.ValuesView` with `collections.abc.ValuesView`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceUnittestDeprecatedAliases](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceunittestdeprecatedaliases) + * **Replace deprecated unittest method aliases** + * Replace deprecated unittest.TestCase method aliases like `assertEquals` with their modern equivalents like `assertEqual`. These aliases were removed in Python 3.11/3.12. +* [org.openrewrite.python.migrate.UpgradeToPython310](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/upgradetopython310) + * **Upgrade to Python 3.10** + * Migrate deprecated APIs and adopt new syntax for Python 3.10 compatibility. This includes adopting PEP 604 union type syntax (`X | Y`) and other modernizations between Python 3.9 and 3.10. +* [org.openrewrite.python.migrate.UpgradeToPython311](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/upgradetopython311) + * **Upgrade to Python 3.11** + * Migrate deprecated and removed APIs for Python 3.11 compatibility. This includes handling removed modules, deprecated functions, and API changes between Python 3.10 and 3.11. +* [org.openrewrite.python.migrate.UpgradeToPython312](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/upgradetopython312) + * **Upgrade to Python 3.12** + * Migrate deprecated and removed APIs for Python 3.12 compatibility. This includes detecting usage of the removed `imp` module and other legacy modules that were removed in Python 3.12. +* [org.openrewrite.python.migrate.UpgradeToPython313](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/upgradetopython313) + * **Upgrade to Python 3.13** + * Migrate deprecated and removed APIs for Python 3.13 compatibility. This includes detecting usage of modules removed in PEP 594 ('dead batteries') and other API changes between Python 3.12 and 3.13. +* [org.openrewrite.python.migrate.UpgradeToPython314](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/upgradetopython314) + * **Upgrade to Python 3.14** + * Migrate deprecated and removed APIs for Python 3.14 compatibility. This includes replacing deprecated AST node types with `ast.Constant` and other API changes between Python 3.13 and 3.14. +* [org.openrewrite.python.migrate.UpgradeToPython38](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/upgradetopython38) + * **Upgrade to Python 3.8** + * Migrate deprecated APIs and detect legacy patterns for Python 3.8 compatibility. +* [org.openrewrite.python.migrate.UpgradeToPython39](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/upgradetopython39) + * **Upgrade to Python 3.9** + * Migrate deprecated APIs for Python 3.9 compatibility. This includes PEP 585 built-in generics, removed base64 functions, and deprecated XML Element methods. +* [org.openrewrite.python.migrate.langchain.FindDeprecatedLangchainAgents](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/langchain/finddeprecatedlangchainagents) + * **Find deprecated LangChain agent patterns** + * Find usage of deprecated LangChain agent patterns including `initialize_agent`, `AgentExecutor`, and `LLMChain`. These were deprecated in LangChain v0.2 and removed in v1.0. +* [org.openrewrite.python.migrate.langchain.FindLangchainCreateReactAgent](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/langchain/findlangchaincreatereactagent) + * **Find `create_react_agent` usage (replace with `create_agent`)** + * Find `from langgraph.prebuilt import create_react_agent` which should be replaced with `from langchain.agents import create_agent` in LangChain v1.0. +* [org.openrewrite.python.migrate.langchain.ReplaceLangchainClassicImports](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/langchain/replacelangchainclassicimports) + * **Replace `langchain` legacy imports with `langchain_classic`** + * Migrate legacy chain, retriever, and indexing imports from `langchain` to `langchain_classic`. These were moved in LangChain v1.0. +* [org.openrewrite.python.migrate.langchain.ReplaceLangchainCommunityImports](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/langchain/replacelangchaincommunityimports) + * **Replace `langchain` imports with `langchain_community`** + * Migrate third-party integration imports from `langchain` to `langchain_community`. These integrations were moved in LangChain v0.2. +* [org.openrewrite.python.migrate.langchain.ReplaceLangchainProviderImports](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/langchain/replacelangchainproviderimports) + * **Replace `langchain_community` imports with provider packages** + * Migrate provider-specific imports from `langchain_community` to dedicated provider packages like `langchain_openai`, `langchain_anthropic`, etc. +* [org.openrewrite.python.migrate.langchain.UpgradeToLangChain02](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/langchain/upgradetolangchain02) + * **Upgrade to LangChain 0.2** + * Migrate to LangChain 0.2 by updating imports from `langchain` to `langchain_community` and provider-specific packages. +* [org.openrewrite.python.migrate.langchain.UpgradeToLangChain1](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/langchain/upgradetolangchain1) + * **Upgrade to LangChain 1.0** + * Migrate to LangChain 1.0 by applying all v0.2 migrations and then moving legacy functionality to `langchain_classic`. ## rewrite-nodejs -* [org.openrewrite.node.dependency-vulnerability-check](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/dependency-vulnerability-check) - * **Find and fix vulnerable npm dependencies** - * This software composition analysis (SCA) tool detects and upgrades dependencies with publicly disclosed vulnerabilities. This recipe both generates a report of vulnerable dependencies and upgrades to newer versions with fixes. This recipe by default only upgrades to the latest **patch** version. If a minor or major upgrade is required to reach the fixed version, this can be controlled using the `maximumUpgradeDelta` option. Vulnerability information comes from the GitHub Security Advisory Database. -* [org.openrewrite.node.migrate.buffer.replace-deprecated-slice](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/buffer/replace-deprecated-slice) - * **Replace deprecated `Buffer.slice()` with `Buffer.subarray()`** - * Replace deprecated `buffer.slice()` calls with `buffer.subarray()` for compatibility with Uint8Array.prototype.slice(). -* [org.openrewrite.node.migrate.buffer.replace-slow-buffer](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/buffer/replace-slow-buffer) - * **Replace deprecated `SlowBuffer` with `Buffer.allocUnsafeSlow()`** - * Replace deprecated `new SlowBuffer(size)` calls with `Buffer.allocUnsafeSlow(size)`. SlowBuffer was used to create un-pooled Buffer instances, but has been removed in favor of the explicit Buffer.allocUnsafeSlow() method. -* [org.openrewrite.node.migrate.crypto.find-create-cipher](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/crypto/find-create-cipher) - * **Find deprecated `crypto.createCipher()` and `crypto.createDecipher()` usage** - * `crypto.createCipher()` and `crypto.createDecipher()` were deprecated in Node.js 10 (DEP0106) and removed in Node.js 22. Use `crypto.createCipheriv()` and `crypto.createDecipheriv()` instead. -* [org.openrewrite.node.migrate.crypto.replace-crypto-fips](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/crypto/replace-crypto-fips) - * **Replace deprecated `crypto.fips` with `crypto.getFips()` and `crypto.setFips()`** - * Replace deprecated `crypto.fips` property access with `crypto.getFips()` for reads and `crypto.setFips(value)` for writes. -* [org.openrewrite.node.migrate.crypto.replace-hash-constructor](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/crypto/replace-hash-constructor) - * **Replace deprecated `new crypto.Hash()` and `new crypto.Hmac()` with factory methods** - * Replace deprecated `new crypto.Hash(algorithm)` constructor calls with `crypto.createHash(algorithm)` and `new crypto.Hmac(algorithm, key)` with `crypto.createHmac(algorithm, key)` factory methods. -* [org.openrewrite.node.migrate.find-process-assert](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/find-process-assert) - * **Find deprecated `process.assert()` usage** - * `process.assert()` was deprecated in Node.js 10 (DEP0100) and removed in Node.js 23. Use the `assert` module instead. -* [org.openrewrite.node.migrate.find-punycode-usage](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/find-punycode-usage) - * **Find deprecated `punycode` module usage** - * The `punycode` built-in module was deprecated in Node.js 21 (DEP0040). Use the userland `punycode` package from npm or `url.domainToASCII`/`url.domainToUnicode` instead. -* [org.openrewrite.node.migrate.fs.replace-dirent-path](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/fs/replace-dirent-path) - * **Replace `dirent.path` with `dirent.parentPath`** - * Replaces deprecated `dirent.path` property access with `dirent.parentPath` on `fs.Dirent` instances to address DEP0178 deprecation. -* [org.openrewrite.node.migrate.fs.replace-fs-access-constants](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/fs/replace-fs-access-constants) - * **Replace deprecated `fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK` with `fs.constants.*`** - * Replace deprecated file access constants (`fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK`) with their equivalents from `fs.constants`. These constants were removed in Node.js v24+ and should be accessed through the constants namespace. -* [org.openrewrite.node.migrate.fs.replace-fs-truncate-fd](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/fs/replace-fs-truncate-fd) - * **Replace `fs.truncate()` with file descriptor to `fs.ftruncate()`** - * Replace deprecated `fs.truncate(fd, ...)` and `fs.truncateSync(fd, ...)` calls with `fs.ftruncate(fd, ...)` and `fs.ftruncateSync(fd, ...)` when the first argument is a file descriptor (number). -* [org.openrewrite.node.migrate.fs.replace-stats-constructor](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/fs/replace-stats-constructor) - * **Replace deprecated `fs.Stats` constructor with object literal** - * Replace deprecated `new fs.Stats()` constructor calls with an object literal containing Stats properties initialized to undefined. -* [org.openrewrite.node.migrate.http.replace-outgoing-message-headers](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/http/replace-outgoing-message-headers) - * **Replace `OutgoingMessage._headers` and `._headerNames` with public methods** - * Replace deprecated `OutgoingMessage.prototype._headers` with `getHeaders()`, `setHeader()`, `removeHeader()` and `OutgoingMessage.prototype._headerNames` with `getHeaderNames()` to address DEP0066 deprecation. -* [org.openrewrite.node.migrate.increase-node-engine-version](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/increase-node-engine-version) - * **Increase Node.js engine version** - * Increases the upper bound of the `engines.node` version range in package.json to allow the specified Node.js version. -* [org.openrewrite.node.migrate.increase-node-engine-version-in-github-actions](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/increase-node-engine-version-in-github-actions) - * **Increase Node.js version in GitHub Actions** - * Increases `node-version` in `actions/setup-node` steps in GitHub Actions workflows. Only modifies plain major version values (e.g. `20`) and x-ranges (e.g. `20.x`). Never decreases the version. -* [org.openrewrite.node.migrate.net.remove-set-simultaneous-accepts](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/net/remove-set-simultaneous-accepts) - * **Remove deprecated `net._setSimultaneousAccepts()`** - * Remove calls to deprecated `net._setSimultaneousAccepts()` which was an undocumented internal function that is no longer necessary. -* [org.openrewrite.node.migrate.process.coerce-process-exit-code](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/process/coerce-process-exit-code) - * **Coerce `process.exit()` and `process.exitCode` to integer** - * Wraps non-integer values passed to `process.exit()` or assigned to `process.exitCode` with `Math.trunc()` to avoid the DEP0164 deprecation warning about implicit coercion to integer. -* [org.openrewrite.node.migrate.process.remove-usage-of-features-tls-underscore_constants](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/process/remove-usage-of-features-tls-underscore_constants) - * **Remove usage of deprecated `process.features.tls_*` properties** - * Remove references to deprecated `process.features.tls_*` properties, replace with `process.features.tls`. -* [org.openrewrite.node.migrate.stream.replace-internal-modules](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/stream/replace-internal-modules) - * **Replace deprecated `node:_stream_*` with `node:stream`** - * Replace deprecated internal stream module imports like `require('node:_stream_readable')` with the public `node:stream` module. -* [org.openrewrite.node.migrate.timers.find-timers-active](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/timers/find-timers-active) - * **Find deprecated `timers.active()` and `timers._unrefActive()` usage** - * `timers.active()` (DEP0126) and `timers._unrefActive()` (DEP0127) were deprecated and removed in Node.js 24. Use `timeout.refresh()` instead. -* [org.openrewrite.node.migrate.tls.find-tls-secure-pair](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/tls/find-tls-secure-pair) - * **Find deprecated `tls.SecurePair` and `tls.createSecurePair()` usage** - * `tls.SecurePair` (DEP0043) and `tls.createSecurePair()` (DEP0064) were deprecated and removed in Node.js 24. Use `tls.TLSSocket` instead. -* [org.openrewrite.node.migrate.tls.replace-internal-modules](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/tls/replace-internal-modules) - * **Replace deprecated `node:_tls_common` and `node:_tls_wrap` with `node:tls`** - * Replace deprecated internal TLS module imports `require('node:_tls_common')` and `require('node:_tls_wrap')` with the public `node:tls` module. -* [org.openrewrite.node.migrate.upgrade-node-22](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/upgrade-node-22) - * **Upgrade to Node.js 22** - * Migrate deprecated APIs for Node.js 22 compatibility. Addresses Node 22 runtime deprecations and deprecations from earlier versions. -* [org.openrewrite.node.migrate.upgrade-node-24](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/upgrade-node-24) - * **Upgrade to Node.js 24** - * Migrate deprecated APIs for Node.js 24 compatibility. Includes all migrations from Node.js 22, plus Node 23 and Node 24 deprecations. -* [org.openrewrite.node.migrate.util.remove-promisify-on-promise](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/remove-promisify-on-promise) - * **Remove unnecessary `util.promisify()` on Promise-returning functions** - * Removes `util.promisify()` calls on functions that already return a Promise. Since Node.js v17.0.0, calling promisify on a function that returns a Promise emits a runtime deprecation warning (DEP0174). -* [org.openrewrite.node.migrate.util.replace-is-webassembly-compiled-module](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/replace-is-webassembly-compiled-module) - * **Replace deprecated `util.types.isWebAssemblyCompiledModule()`** - * Replace `util.types.isWebAssemblyCompiledModule(value)` with `value instanceof WebAssembly.Module`. -* [org.openrewrite.node.migrate.util.replace-util-extend](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/replace-util-extend) - * **Replace deprecated `util._extend()` with `Object.assign()`** - * Replace deprecated `util._extend(target, source)` calls with `Object.assign(target, source)` which preserves the mutation behavior. -* [org.openrewrite.node.migrate.util.replace-util-log](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/replace-util-log) - * **Replace deprecated `util.log()` with `console.log()`** - * Replace deprecated `util.log()` calls with `console.log()`. Note: `util.log()` included timestamps, but `console.log()` does not. -* [org.openrewrite.node.migrate.util.use-native-type-checking-methods](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/use-native-type-checking-methods) - * **Replace deprecated `util.isX()` methods with native JavaScript** - * The `util` module's type-checking methods have been removed in Node 22. -* [org.openrewrite.node.migrate.zlib.replace-bytes-read](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/zlib/replace-bytes-read) - * **Replace deprecated `zlib.bytesRead` with `zlib.bytesWritten`** - * Replace deprecated `bytesRead` property on zlib streams with `bytesWritten`. -* [org.openrewrite.node.security.remove-redundant-overrides](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/security/remove-redundant-overrides) - * **Remove redundant dependency overrides** - * Removes overrides/resolutions from package.json that are redundant because the dependency tree already resolves to the overridden version or higher. * [org.openrewrite.nodejs.DependencyVulnerabilityCheck](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/nodejs/dependencyvulnerabilitycheck) * **Find and fix vulnerable npm dependencies** * This software composition analysis (SCA) tool detects and upgrades dependencies with publicly disclosed vulnerabilities. This recipe both generates a report of vulnerable dependencies and upgrades to newer versions with fixes. This recipe **only** upgrades to the latest **patch** version. If a minor or major upgrade is required to reach the fixed version, this recipe will not make any changes. Vulnerability information comes from the [GitHub Security Advisory Database](https://docs.github.com/en/code-security/security-advisories/global-security-advisories/about-the-github-advisory-database), which aggregates vulnerability data from several public databases, including the [National Vulnerability Database](https://nvd.nist.gov/) maintained by the United States government. Dependencies following [Semantic Versioning](https://semver.org/) will see their _patch_ version updated where applicable. diff --git c/docs/reference/recipes-by-tag.md i/docs/reference/recipes-by-tag.md index ac01448667..0cd9aa8733 100644 --- c/docs/reference/recipes-by-tag.md +++ i/docs/reference/recipes-by-tag.md @@ -6,7 +6,7 @@ description: An autogenerated list of all recipe tags and the recipes within eac _This doc contains all recipe tags and the recipes that are tagged with them._ -Total tags: 254 +Total tags: 249 ## 5to6 @@ -257,14 +257,6 @@ _11 recipes_ * **Migrate Google Truth to AssertJ** * Migrate Google Truth assertions to AssertJ assertions. -## async - -_1 recipe_ - -* [org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](/recipes/javascript/cleanup/async-callback-in-sync-array-method.md) - * **Detect async callbacks in synchronous array methods** - * Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. - ## authentication _2 recipes_ @@ -566,14 +558,6 @@ _1 recipe_ * **Migrate Brave API to OpenTelemetry API** * Migrate Java code using Brave (Zipkin) tracing API to OpenTelemetry API. This recipe handles the migration of Brave Tracer, Span, and related classes to OpenTelemetry equivalents. -## bug - -_1 recipe_ - -* [org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](/recipes/javascript/cleanup/async-callback-in-sync-array-method.md) - * **Detect async callbacks in synchronous array methods** - * Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. - ## build _2 recipes_ @@ -656,14 +640,6 @@ _3 recipes_ * **Replace Spring Kafka with Quarkus Kafka Client** * Migrates `spring-kafka` to `quarkus-kafka-client` when no reactor dependencies are present. -## cleanup - -_1 recipe_ - -* [org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](/recipes/javascript/cleanup/async-callback-in-sync-array-method.md) - * **Detect async callbacks in synchronous array methods** - * Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. - ## cloud _17 recipes_ @@ -3365,14 +3341,6 @@ _1 recipe_ * **Migrate to JavaEE8** * These recipes help with the Migration to Java EE 8, flagging and updating deprecated methods. -## javascript - -_1 recipe_ - -* [org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](/recipes/javascript/cleanup/async-callback-in-sync-array-method.md) - * **Detect async callbacks in synchronous array methods** - * Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. - ## javax _37 recipes_ @@ -7634,14 +7602,6 @@ _1 recipe_ * **Migrate Google Truth to AssertJ** * Migrate Google Truth assertions to AssertJ assertions. -## typescript - -_1 recipe_ - -* [org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](/recipes/javascript/cleanup/async-callback-in-sync-array-method.md) - * **Detect async callbacks in synchronous array methods** - * Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. - ## unaffected _1 recipe_ diff --git c/docs/reference/standalone-recipes.md i/docs/reference/standalone-recipes.md index f02b0fbbee..6fce0b0933 100644 --- c/docs/reference/standalone-recipes.md +++ i/docs/reference/standalone-recipes.md @@ -6,7 +6,7 @@ description: An autogenerated list of recipes that are not included in any compo _This doc contains recipes that are not included as part of any larger composite recipe. These recipes can be run independently and are not bundled with other recipes._ -Total standalone recipes: 1005 +Total standalone recipes: 990 ## org.openrewrite.meta:rewrite-analysis @@ -3002,51 +3002,6 @@ Total standalone recipes: 1005 * [org.openrewrite.java.testing.testcontainers.TestContainersBestPractices](/recipes/java/testing/testcontainers/testcontainersbestpractices.md) * **Testcontainers best practices** * Apply best practices to Testcontainers usage. -* [org.openrewrite.javascript.change-import](/recipes/javascript/change-import.md) - * **Change import** - * Changes an import from one module/member to another, updating all type attributions. -* [org.openrewrite.javascript.cleanup.add-parse-int-radix](/recipes/javascript/cleanup/add-parse-int-radix.md) - * **Add radix to `parseInt`** - * Adds the radix parameter (base 10) to `parseInt()` calls that are missing it, preventing potential parsing issues. -* [org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](/recipes/javascript/cleanup/async-callback-in-sync-array-method.md) - * **Detect async callbacks in synchronous array methods** - * Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. -* [org.openrewrite.javascript.cleanup.order-imports](/recipes/javascript/cleanup/order-imports.md) - * **Order imports** - * Sort imports by category and module path. Categories: side-effect, namespace, default, named, type. Within each category, imports are sorted alphabetically by module path. Named specifiers within each import are also sorted alphabetically. -* [org.openrewrite.javascript.cleanup.prefer-optional-chain](/recipes/javascript/cleanup/prefer-optional-chain.md) - * **Prefer optional chaining** - * Converts ternary expressions like `foo ? foo.bar : undefined` to use optional chaining syntax `foo?.bar`. -* [org.openrewrite.javascript.cleanup.use-object-property-shorthand](/recipes/javascript/cleanup/use-object-property-shorthand.md) - * **Use object property shorthand** - * Simplifies object properties where the property name and value/variable name are the same (e.g., `\{ x: x \}` becomes `\{ x \}`). Applies to both destructuring patterns and object literals. -* [org.openrewrite.javascript.dependencies.add-dependency](/recipes/javascript/dependencies/add-dependency.md) - * **Add npm dependency** - * Adds a new dependency to `package.json` and updates the lock file by running the package manager. -* [org.openrewrite.javascript.dependencies.find-dependency](/recipes/javascript/dependencies/find-dependency.md) - * **Find Node.js dependency** - * Finds dependencies in a project's `package.json`. Can find both direct dependencies and dependencies that transitively include the target package. This recipe is commonly used as a precondition for other recipes. -* [org.openrewrite.javascript.dependencies.upgrade-dependency-version](/recipes/javascript/dependencies/upgrade-dependency-version.md) - * **Upgrade npm dependency version** - * Upgrades the version of a direct dependency in `package.json` and updates the lock file by running the package manager. -* [org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version](/recipes/javascript/dependencies/upgrade-transitive-dependency-version.md) - * **Upgrade transitive npm dependency version** - * Upgrades the version of a transitive dependency by adding override/resolution entries to `package.json` and updates the lock file by running the package manager. -* [org.openrewrite.javascript.format.auto-format](/recipes/javascript/format/auto-format.md) - * **Auto-format JavaScript/TypeScript code** - * Format JavaScript and TypeScript code using formatting rules auto-detected from the project's existing code style. -* [org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences](/recipes/javascript/migrate/es6/modernize-octal-escape-sequences.md) - * **Modernize octal escape sequences** - * Convert old-style octal escape sequences (e.g., `\0`, `\123`) to modern hex escape sequences (e.g., `\x00`, `\x53`) or Unicode escape sequences (e.g., `\u0000`, `\u0053`). -* [org.openrewrite.javascript.migrate.es6.modernize-octal-literals](/recipes/javascript/migrate/es6/modernize-octal-literals.md) - * **Modernize octal literals** - * Convert old-style octal literals (e.g., `0777`) to modern ES6 syntax (e.g., `0o777`). -* [org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys](/recipes/javascript/migrate/es6/remove-duplicate-object-keys.md) - * **Remove duplicate object keys** - * Remove duplicate keys in object literals, keeping only the last occurrence (last-wins semantics). -* [org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default](/recipes/javascript/migrate/typescript/export-assignment-to-export-default.md) - * **Convert `export =` to `export default`** - * Converts TypeScript `export =` syntax to ES module `export default` syntax for compatibility with ECMAScript modules. * [org.openrewrite.jenkins.CommonsLang3ToApiPlugin](/recipes/jenkins/commonslang3toapiplugin.md) * **Use commons-lang3 API Plugin** * Updates `pom.xml` to depend on `commons-lang3-api` and exclude `commons-lang3` where it is brought in transitively. --- docs/reference/all-recipes.md | 49 +-- docs/reference/moderne-recipes.md | 483 +++++++++++++++++++++------ docs/reference/recipes-by-tag.md | 42 +-- docs/reference/standalone-recipes.md | 47 +-- 4 files changed, 394 insertions(+), 227 deletions(-) diff --git a/docs/reference/all-recipes.md b/docs/reference/all-recipes.md index 31c82f3c78..95e30c7d6d 100644 --- a/docs/reference/all-recipes.md +++ b/docs/reference/all-recipes.md @@ -6,7 +6,7 @@ description: A comprehensive list of all recipes organized by module. _This doc contains all recipes grouped by their module._ -Total recipes: 4217 +Total recipes: 4202 ## io.moderne.recipe:rewrite-devcenter @@ -9190,7 +9190,7 @@ _18 recipes_ _License: Unknown_ -_1263 recipes_ +_1248 recipes_ * [ai.timefold.solver.migration.ChangeVersion](/recipes/ai/timefold/solver/migration/changeversion.md) * **Change the Timefold version** @@ -12450,51 +12450,6 @@ _1263 recipes_ * [org.openrewrite.java.testing.truth.MigrateTruthToAssertJ](/recipes/java/testing/truth/migratetruthtoassertj.md) * **Migrate Google Truth to AssertJ** * Migrate Google Truth assertions to AssertJ assertions. -* [org.openrewrite.javascript.change-import](/recipes/javascript/change-import.md) - * **Change import** - * Changes an import from one module/member to another, updating all type attributions. -* [org.openrewrite.javascript.cleanup.add-parse-int-radix](/recipes/javascript/cleanup/add-parse-int-radix.md) - * **Add radix to `parseInt`** - * Adds the radix parameter (base 10) to `parseInt()` calls that are missing it, preventing potential parsing issues. -* [org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](/recipes/javascript/cleanup/async-callback-in-sync-array-method.md) - * **Detect async callbacks in synchronous array methods** - * Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. -* [org.openrewrite.javascript.cleanup.order-imports](/recipes/javascript/cleanup/order-imports.md) - * **Order imports** - * Sort imports by category and module path. Categories: side-effect, namespace, default, named, type. Within each category, imports are sorted alphabetically by module path. Named specifiers within each import are also sorted alphabetically. -* [org.openrewrite.javascript.cleanup.prefer-optional-chain](/recipes/javascript/cleanup/prefer-optional-chain.md) - * **Prefer optional chaining** - * Converts ternary expressions like `foo ? foo.bar : undefined` to use optional chaining syntax `foo?.bar`. -* [org.openrewrite.javascript.cleanup.use-object-property-shorthand](/recipes/javascript/cleanup/use-object-property-shorthand.md) - * **Use object property shorthand** - * Simplifies object properties where the property name and value/variable name are the same (e.g., `\{ x: x \}` becomes `\{ x \}`). Applies to both destructuring patterns and object literals. -* [org.openrewrite.javascript.dependencies.add-dependency](/recipes/javascript/dependencies/add-dependency.md) - * **Add npm dependency** - * Adds a new dependency to `package.json` and updates the lock file by running the package manager. -* [org.openrewrite.javascript.dependencies.find-dependency](/recipes/javascript/dependencies/find-dependency.md) - * **Find Node.js dependency** - * Finds dependencies in a project's `package.json`. Can find both direct dependencies and dependencies that transitively include the target package. This recipe is commonly used as a precondition for other recipes. -* [org.openrewrite.javascript.dependencies.upgrade-dependency-version](/recipes/javascript/dependencies/upgrade-dependency-version.md) - * **Upgrade npm dependency version** - * Upgrades the version of a direct dependency in `package.json` and updates the lock file by running the package manager. -* [org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version](/recipes/javascript/dependencies/upgrade-transitive-dependency-version.md) - * **Upgrade transitive npm dependency version** - * Upgrades the version of a transitive dependency by adding override/resolution entries to `package.json` and updates the lock file by running the package manager. -* [org.openrewrite.javascript.format.auto-format](/recipes/javascript/format/auto-format.md) - * **Auto-format JavaScript/TypeScript code** - * Format JavaScript and TypeScript code using formatting rules auto-detected from the project's existing code style. -* [org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences](/recipes/javascript/migrate/es6/modernize-octal-escape-sequences.md) - * **Modernize octal escape sequences** - * Convert old-style octal escape sequences (e.g., `\0`, `\123`) to modern hex escape sequences (e.g., `\x00`, `\x53`) or Unicode escape sequences (e.g., `\u0000`, `\u0053`). -* [org.openrewrite.javascript.migrate.es6.modernize-octal-literals](/recipes/javascript/migrate/es6/modernize-octal-literals.md) - * **Modernize octal literals** - * Convert old-style octal literals (e.g., `0777`) to modern ES6 syntax (e.g., `0o777`). -* [org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys](/recipes/javascript/migrate/es6/remove-duplicate-object-keys.md) - * **Remove duplicate object keys** - * Remove duplicate keys in object literals, keeping only the last occurrence (last-wins semantics). -* [org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default](/recipes/javascript/migrate/typescript/export-assignment-to-export-default.md) - * **Convert `export =` to `export default`** - * Converts TypeScript `export =` syntax to ES module `export default` syntax for compatibility with ECMAScript modules. * [org.openrewrite.jenkins.CommonsLang3ToApiPlugin](/recipes/jenkins/commonslang3toapiplugin.md) * **Use commons-lang3 API Plugin** * Updates `pom.xml` to depend on `commons-lang3-api` and exclude `commons-lang3` where it is brought in transitively. diff --git a/docs/reference/moderne-recipes.md b/docs/reference/moderne-recipes.md index 6f86d71da3..db80569032 100644 --- a/docs/reference/moderne-recipes.md +++ b/docs/reference/moderne-recipes.md @@ -997,109 +997,406 @@ This doc includes every recipe that is exclusive to users of Moderne. For a full ## rewrite-migrate-python +* [org.openrewrite.python.migrate.DetectPercentFormatting](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/detectpercentformatting) + * **Detect `%` string formatting** + * Detect usage of %-style string formatting which could be migrated to f-strings (Python 3.6+). Manual review is recommended for conversion. +* [org.openrewrite.python.migrate.DetectStrFormat](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/detectstrformat) + * **Detect `str.format()` string formatting** + * Detect usage of str.format() method which could be migrated to f-strings (Python 3.6+). Manual review is recommended for conversion. +* [org.openrewrite.python.migrate.FindAifcModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findaifcmodule) + * **Find deprecated `aifc` module usage** + * The `aifc` module was deprecated in Python 3.11 and removed in Python 3.13. Use third-party audio libraries instead. +* [org.openrewrite.python.migrate.FindAsyncioCoroutineDecorator](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findasynciocoroutinedecorator) + * **Find deprecated `@asyncio.coroutine` decorator** + * Find usage of the deprecated `@asyncio.coroutine` decorator which was removed in Python 3.11. Convert to `async def` syntax with `await` instead of `yield from`. +* [org.openrewrite.python.migrate.FindAudioopModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findaudioopmodule) + * **Find deprecated `audioop` module usage** + * The `audioop` module was deprecated in Python 3.11 and removed in Python 3.13. Use pydub, numpy, or scipy for audio operations. +* [org.openrewrite.python.migrate.FindCgiModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findcgimodule) + * **Find deprecated `cgi` module usage** + * The `cgi` module was deprecated in Python 3.11 and removed in Python 3.13. Use `urllib.parse` for query string parsing, `html.escape()` for escaping, and web frameworks or `email.message` for form handling. +* [org.openrewrite.python.migrate.FindCgitbModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findcgitbmodule) + * **Find deprecated `cgitb` module usage** + * The `cgitb` module was deprecated in Python 3.11 and removed in Python 3.13. Use the standard `logging` and `traceback` modules for error handling. +* [org.openrewrite.python.migrate.FindChunkModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findchunkmodule) + * **Find deprecated `chunk` module usage** + * The `chunk` module was deprecated in Python 3.11 and removed in Python 3.13. Implement IFF chunk reading manually or use specialized libraries. +* [org.openrewrite.python.migrate.FindCryptModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findcryptmodule) + * **Find deprecated `crypt` module usage** + * The `crypt` module was deprecated in Python 3.11 and removed in Python 3.13. Use `bcrypt`, `argon2-cffi`, or `passlib` instead. +* [org.openrewrite.python.migrate.FindDistutilsUsage](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/finddistutilsusage) + * **Find deprecated distutils module usage** + * Find imports of the deprecated `distutils` module which was removed in Python 3.12. Migrate to `setuptools` or other modern build tools. +* [org.openrewrite.python.migrate.FindElementGetchildren](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findelementgetchildren) + * **Find deprecated `Element.getchildren()` usage** + * Find usage of `getchildren()` method on XML Element objects. Deprecated in Python 3.9. Use `list(element)` instead. +* [org.openrewrite.python.migrate.FindFunctoolsCmpToKey](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findfunctoolscmptokey) + * **Find `functools.cmp_to_key()` usage** + * Find usage of `functools.cmp_to_key()` which is a Python 2 compatibility function. Consider using a key function directly. * [org.openrewrite.python.migrate.FindFutureImports](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findfutureimports) * **Find `__future__` imports** * Find `__future__` imports and add a search marker. +* [org.openrewrite.python.migrate.FindImghdrModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findimghdrmodule) + * **Find deprecated `imghdr` module usage** + * The `imghdr` module was deprecated in Python 3.11 and removed in Python 3.13. Use `filetype`, `python-magic`, or `Pillow` instead. +* [org.openrewrite.python.migrate.FindImpUsage](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findimpusage) + * **Find deprecated imp module usage** + * Find imports of the deprecated `imp` module which was removed in Python 3.12. Migrate to `importlib`. +* [org.openrewrite.python.migrate.FindMailcapModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findmailcapmodule) + * **Find deprecated `mailcap` module usage** + * The `mailcap` module was deprecated in Python 3.11 and removed in Python 3.13. Use `mimetypes` module for MIME type handling. +* [org.openrewrite.python.migrate.FindMsilibModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findmsilibmodule) + * **Find deprecated `msilib` module usage** + * The `msilib` module was deprecated in Python 3.11 and removed in Python 3.13. Use platform-specific tools for MSI creation. +* [org.openrewrite.python.migrate.FindNisModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findnismodule) + * **Find deprecated `nis` module usage** + * The `nis` module was deprecated in Python 3.11 and removed in Python 3.13. There is no direct replacement. +* [org.openrewrite.python.migrate.FindNntplibModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findnntplibmodule) + * **Find deprecated `nntplib` module usage** + * The `nntplib` module was deprecated in Python 3.11 and removed in Python 3.13. NNTP is largely obsolete; consider alternatives if needed. +* [org.openrewrite.python.migrate.FindOsPopen](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findospopen) + * **Find deprecated `os.popen()` usage** + * `os.popen()` has been deprecated since Python 3.6. Use `subprocess.run()` or `subprocess.Popen()` instead for better control over process creation and output handling. +* [org.openrewrite.python.migrate.FindOsSpawn](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findosspawn) + * **Find deprecated `os.spawn*()` usage** + * The `os.spawn*()` family of functions are deprecated. Use `subprocess.run()` or `subprocess.Popen()` instead. +* [org.openrewrite.python.migrate.FindOssaudiodevModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findossaudiodevmodule) + * **Find deprecated `ossaudiodev` module usage** + * The `ossaudiodev` module was deprecated in Python 3.11 and removed in Python 3.13. There is no direct replacement. +* [org.openrewrite.python.migrate.FindPathlibLinkTo](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findpathliblinkto) + * **Find deprecated `Path.link_to()` usage** + * Find usage of `Path.link_to()` which was deprecated in Python 3.10 and removed in 3.12. Use `hardlink_to()` instead (note: argument order is reversed). +* [org.openrewrite.python.migrate.FindPipesModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findpipesmodule) + * **Find deprecated `pipes` module usage** + * The `pipes` module was deprecated in Python 3.11 and removed in Python 3.13. Use subprocess with shlex.quote() for shell escaping. +* [org.openrewrite.python.migrate.FindRemovedModules312](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findremovedmodules312) + * **Find modules removed in Python 3.12** + * Find imports of modules that were removed in Python 3.12, including asynchat, asyncore, and smtpd. +* [org.openrewrite.python.migrate.FindSndhdrModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findsndhdrmodule) + * **Find deprecated `sndhdr` module usage** + * The `sndhdr` module was deprecated in Python 3.11 and removed in Python 3.13. Use `filetype` or audio libraries like `pydub` instead. +* [org.openrewrite.python.migrate.FindSocketGetFQDN](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findsocketgetfqdn) + * **Find `socket.getfqdn()` usage** + * Find usage of `socket.getfqdn()` which can be slow and unreliable. Consider using `socket.gethostname()` instead. +* [org.openrewrite.python.migrate.FindSpwdModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findspwdmodule) + * **Find deprecated `spwd` module usage** + * The `spwd` module was deprecated in Python 3.11 and removed in Python 3.13. There is no direct replacement. +* [org.openrewrite.python.migrate.FindSslMatchHostname](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findsslmatchhostname) + * **Find deprecated `ssl.match_hostname()`** + * Find usage of the deprecated `ssl.match_hostname()` function which was removed in Python 3.12. Use `ssl.SSLContext.check_hostname` instead. +* [org.openrewrite.python.migrate.FindSunauModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findsunaumodule) + * **Find deprecated `sunau` module usage** + * The `sunau` module was deprecated in Python 3.11 and removed in Python 3.13. Use `soundfile` or `pydub` instead. +* [org.openrewrite.python.migrate.FindTelnetlibModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findtelnetlibmodule) + * **Find deprecated `telnetlib` module usage** + * The `telnetlib` module was deprecated in Python 3.11 and removed in Python 3.13. Consider using `telnetlib3` from PyPI, direct socket usage, or SSH-based alternatives like paramiko. +* [org.openrewrite.python.migrate.FindTempfileMktemp](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findtempfilemktemp) + * **Find deprecated `tempfile.mktemp()` usage** + * Find usage of `tempfile.mktemp()` which is deprecated due to security concerns (race condition). Use `mkstemp()` or `NamedTemporaryFile()` instead. +* [org.openrewrite.python.migrate.FindUrllibParseSplitFunctions](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findurllibparsesplitfunctions) + * **Find deprecated urllib.parse split functions** + * Find usage of deprecated urllib.parse split functions (splithost, splitport, etc.) removed in Python 3.14. Use urlparse() instead. +* [org.openrewrite.python.migrate.FindUrllibParseToBytes](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findurllibparsetobytes) + * **Find deprecated `urllib.parse.to_bytes()` usage** + * Find usage of `urllib.parse.to_bytes()` which was deprecated in Python 3.8 and removed in 3.14. Use str.encode() directly. +* [org.openrewrite.python.migrate.FindUuModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/finduumodule) + * **Find deprecated `uu` module usage** + * The `uu` module was deprecated in Python 3.11 and removed in Python 3.13. Use `base64` module instead for encoding binary data. +* [org.openrewrite.python.migrate.FindXdrlibModule](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/findxdrlibmodule) + * **Find deprecated `xdrlib` module usage** + * The `xdrlib` module was deprecated in Python 3.11 and removed in Python 3.13. Use `struct` module for binary packing/unpacking. +* [org.openrewrite.python.migrate.MigrateAsyncioCoroutine](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/migrateasynciocoroutine) + * **Migrate `@asyncio.coroutine` to `async def`** + * Migrate functions using the deprecated `@asyncio.coroutine` decorator to use `async def` syntax. Also transforms `yield from` to `await`. The decorator was removed in Python 3.11. * [org.openrewrite.python.migrate.MigrateToPyprojectToml](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/migratetopyprojecttoml) * **Migrate to `pyproject.toml`** * Migrate Python projects from `requirements.txt` and/or `setup.cfg` to `pyproject.toml` with `hatchling` build backend. +* [org.openrewrite.python.migrate.ReplaceArrayFromstring](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacearrayfromstring) + * **Replace `array.fromstring()` with `array.frombytes()`** + * Replace `fromstring()` with `frombytes()` on array objects. The fromstring() method was deprecated in Python 3.2 and removed in 3.14. +* [org.openrewrite.python.migrate.ReplaceArrayTostring](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacearraytostring) + * **Replace `array.tostring()` with `array.tobytes()`** + * Replace `tostring()` with `tobytes()` on array objects. The tostring() method was deprecated in Python 3.2 and removed in 3.14. +* [org.openrewrite.python.migrate.ReplaceAstBytes](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceastbytes) + * **Replace `ast.Bytes` with `ast.Constant`** + * The `ast.Bytes` node type was deprecated in Python 3.8 and removed in Python 3.14. Replace with `ast.Constant` and check `isinstance(node.value, bytes)`. +* [org.openrewrite.python.migrate.ReplaceAstEllipsis](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceastellipsis) + * **Replace `ast.Ellipsis` with `ast.Constant`** + * The `ast.Ellipsis` node type was deprecated in Python 3.8 and removed in Python 3.14. Replace with `ast.Constant` and check `node.value is ...`. +* [org.openrewrite.python.migrate.ReplaceAstNameConstant](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceastnameconstant) + * **Replace `ast.NameConstant` with `ast.Constant`** + * The `ast.NameConstant` node type was deprecated in Python 3.8 and removed in Python 3.14. Replace with `ast.Constant` and check `node.value in (True, False, None)`. +* [org.openrewrite.python.migrate.ReplaceAstNum](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceastnum) + * **Replace `ast.Num` with `ast.Constant`** + * The `ast.Num` node type was deprecated in Python 3.8 and removed in Python 3.14. Replace with `ast.Constant` and check `isinstance(node.value, (int, float, complex))`. +* [org.openrewrite.python.migrate.ReplaceAstStr](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceaststr) + * **Replace `ast.Str` with `ast.Constant`** + * The `ast.Str` node type was deprecated in Python 3.8 and removed in Python 3.14. Replace with `ast.Constant` and check `isinstance(node.value, str)`. +* [org.openrewrite.python.migrate.ReplaceBase64Decodestring](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacebase64decodestring) + * **Replace `base64.decodestring()` with `base64.decodebytes()`** + * Replace `base64.decodestring()` with `base64.decodebytes()`. The decodestring() method was deprecated in Python 3.1 and removed in 3.9. +* [org.openrewrite.python.migrate.ReplaceBase64Encodestring](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacebase64encodestring) + * **Replace `base64.encodestring()` with `base64.encodebytes()`** + * Replace `base64.encodestring()` with `base64.encodebytes()`. The encodestring() method was deprecated in Python 3.1 and removed in 3.9. +* [org.openrewrite.python.migrate.ReplaceCalendarConstants](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacecalendarconstants) + * **Replace deprecated calendar constants with uppercase** + * Replace deprecated mixed-case calendar constants like `calendar.January` with their uppercase equivalents like `calendar.JANUARY`. The mixed-case constants were deprecated in Python 3.12. +* [org.openrewrite.python.migrate.ReplaceCgiEscape](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacecgiescape) + * **Replace `cgi.escape()` with `html.escape()`** + * Replace `cgi.escape()` with `html.escape()`. cgi.escape() was deprecated in Python 3.2 and removed in Python 3.8. +* [org.openrewrite.python.migrate.ReplaceCollectionsAbcImports](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacecollectionsabcimports) + * **Replace `collections` ABC imports with `collections.abc`** + * Migrate deprecated abstract base class imports from `collections` to `collections.abc`. These imports were deprecated in Python 3.3 and removed in Python 3.10. +* [org.openrewrite.python.migrate.ReplaceConditionNotifyAll](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceconditionnotifyall) + * **Replace `Condition.notifyAll()` with `Condition.notify_all()`** + * Replace `notifyAll()` method calls with `notify_all()`. The camelCase version was deprecated in Python 3.10 and removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceConfigparserReadfp](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceconfigparserreadfp) + * **Replace `ConfigParser.readfp()` with `read_file()`** + * The `ConfigParser.readfp()` method was deprecated in Python 3.2 and removed in Python 3.13. Replace with `read_file()`. +* [org.openrewrite.python.migrate.ReplaceConfigparserSafeConfigParser](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceconfigparsersafeconfigparser) + * **Replace `configparser.SafeConfigParser` with `ConfigParser`** + * The `configparser.SafeConfigParser` class was deprecated in Python 3.2 and removed in Python 3.12. Replace with `configparser.ConfigParser`. +* [org.openrewrite.python.migrate.ReplaceDatetimeUtcFromTimestamp](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacedatetimeutcfromtimestamp) + * **Replace `datetime.utcfromtimestamp()` with `datetime.fromtimestamp(ts, UTC)`** + * The `datetime.utcfromtimestamp()` method is deprecated in Python 3.12. Replace it with `datetime.fromtimestamp(ts, datetime.UTC)` for timezone-aware datetime objects. +* [org.openrewrite.python.migrate.ReplaceDatetimeUtcNow](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacedatetimeutcnow) + * **Replace `datetime.utcnow()` with `datetime.now(UTC)`** + * The `datetime.utcnow()` method is deprecated in Python 3.12. Replace it with `datetime.now(datetime.UTC)` for timezone-aware datetime objects. +* [org.openrewrite.python.migrate.ReplaceDistutilsVersion](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacedistutilsversion) + * **Replace deprecated distutils.version usage** + * Detect usage of deprecated `distutils.version.LooseVersion` and `distutils.version.StrictVersion`. These should be migrated to `packaging.version.Version`. Note: Manual migration is required as `packaging.version.Version` is not a drop-in replacement. +* [org.openrewrite.python.migrate.ReplaceElementGetiterator](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceelementgetiterator) + * **Replace `Element.getiterator()` with `Element.iter()`** + * Replace `getiterator()` with `iter()` on XML Element objects. The getiterator() method was deprecated in Python 3.9. +* [org.openrewrite.python.migrate.ReplaceEventIsSet](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceeventisset) + * **Replace `Event.isSet()` with `Event.is_set()`** + * Replace `isSet()` method calls with `is_set()`. The camelCase version was deprecated in Python 3.10 and removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceGettextDeprecations](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacegettextdeprecations) + * **Replace deprecated gettext l*gettext() functions** + * Replace deprecated gettext functions like `lgettext()` with their modern equivalents like `gettext()`. The l*gettext() functions were removed in Python 3.11. +* [org.openrewrite.python.migrate.ReplaceImpImport](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceimpimport) + * **Replace `import imp` with `import importlib`** + * Replace `import imp` with `import importlib` for code that only uses imp.reload(). Also replaces `from imp import reload`. +* [org.openrewrite.python.migrate.ReplaceImpReload](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceimpreload) + * **Replace `imp.reload()` with `importlib.reload()`** + * Replace `imp.reload()` with `importlib.reload()`. This is a direct 1:1 replacement with identical behavior. +* [org.openrewrite.python.migrate.ReplaceInspectGetargspec](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceinspectgetargspec) + * **Replace `inspect.getargspec()` with `inspect.getfullargspec()`** + * The `inspect.getargspec()` function was deprecated in Python 3.0 and removed in Python 3.11. Replace with `inspect.getfullargspec()`. Note that code accessing the `keywords` field must be updated to use `varkw`. +* [org.openrewrite.python.migrate.ReplaceLocaleResetlocale](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacelocaleresetlocale) + * **Replace `locale.resetlocale()` with `locale.setlocale(LC_ALL, '')`** + * The `locale.resetlocale()` function was deprecated in Python 3.11 and removed in Python 3.13. Replace with `locale.setlocale(locale.LC_ALL, '')`. +* [org.openrewrite.python.migrate.ReplaceLoggingWarn](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceloggingwarn) + * **Replace `logging.warn()` with `logging.warning()`** + * Replace `warn()` calls with `warning()`. The warn() method was deprecated in Python 3.3. +* [org.openrewrite.python.migrate.ReplacePkgutilFindLoader](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacepkgutilfindloader) + * **Replace `pkgutil.find_loader()` with `importlib.util.find_spec()`** + * The `pkgutil.find_loader()` function was deprecated in Python 3.12. Replace with `importlib.util.find_spec()`. Note: returns ModuleSpec, use .loader for loader. +* [org.openrewrite.python.migrate.ReplacePkgutilGetLoader](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacepkgutilgetloader) + * **Replace `pkgutil.get_loader()` with `importlib.util.find_spec()`** + * The `pkgutil.get_loader()` function was deprecated in Python 3.12. Replace with `importlib.util.find_spec()`. Note: returns ModuleSpec, use .loader for loader. +* [org.openrewrite.python.migrate.ReplaceStrFormatWithFString](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacestrformatwithfstring) + * **Replace `str.format()` with f-string** + * Replace `"...".format(...)` calls with f-strings (Python 3.6+). Only converts cases where the format string is a literal and the conversion is safe. +* [org.openrewrite.python.migrate.ReplaceThreadGetName](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacethreadgetname) + * **Replace `Thread.getName()` with `Thread.name`** + * Replace `getName()` method calls with the `name` property. Deprecated in Python 3.10, removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceThreadIsDaemon](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacethreadisdaemon) + * **Replace `Thread.isDaemon()` with `Thread.daemon`** + * Replace `isDaemon()` method calls with the `daemon` property. Deprecated in Python 3.10, removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceThreadSetDaemon](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacethreadsetdaemon) + * **Replace `Thread.setDaemon()` with `Thread.daemon = ...`** + * Replace `setDaemon()` method calls with `daemon` property assignment. Deprecated in Python 3.10, removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceThreadSetName](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacethreadsetname) + * **Replace `Thread.setName()` with `Thread.name = ...`** + * Replace `setName()` method calls with `name` property assignment. Deprecated in Python 3.10, removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceThreadingActiveCount](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacethreadingactivecount) + * **Replace `threading.activeCount()` with `threading.active_count()`** + * Replace `threading.activeCount()` with `threading.active_count()`. The camelCase version was deprecated in Python 3.10 and removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceThreadingCurrentThread](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacethreadingcurrentthread) + * **Replace `threading.currentThread()` with `threading.current_thread()`** + * Replace `threading.currentThread()` with `threading.current_thread()`. The camelCase version was deprecated in Python 3.10 and removed in 3.12. +* [org.openrewrite.python.migrate.ReplaceTypingAbstractSetWithCollectionsAbcSet](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingabstractsetwithcollectionsabcset) + * **Replace `typing.AbstractSet` with `collections.abc.Set`** + * Replace `typing.AbstractSet` with `collections.abc.Set`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingAsyncContextManagerWithContextlib](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingasynccontextmanagerwithcontextlib) + * **Replace `typing.AsyncContextManager` with `contextlib.AbstractAsyncContextManager`** + * Replace `typing.AsyncContextManager` with `contextlib.AbstractAsyncContextManager`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingAsyncGeneratorWithCollectionsAbcAsyncGenerator](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingasyncgeneratorwithcollectionsabcasyncgenerator) + * **Replace `typing.AsyncGenerator` with `collections.abc.AsyncGenerator`** + * Replace `typing.AsyncGenerator` with `collections.abc.AsyncGenerator`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingAsyncIterableWithCollectionsAbcAsyncIterable](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingasynciterablewithcollectionsabcasynciterable) + * **Replace `typing.AsyncIterable` with `collections.abc.AsyncIterable`** + * Replace `typing.AsyncIterable` with `collections.abc.AsyncIterable`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingAsyncIteratorWithCollectionsAbcAsyncIterator](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingasynciteratorwithcollectionsabcasynciterator) + * **Replace `typing.AsyncIterator` with `collections.abc.AsyncIterator`** + * Replace `typing.AsyncIterator` with `collections.abc.AsyncIterator`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingAwaitableWithCollectionsAbcAwaitable](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingawaitablewithcollectionsabcawaitable) + * **Replace `typing.Awaitable` with `collections.abc.Awaitable`** + * Replace `typing.Awaitable` with `collections.abc.Awaitable`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingCallableWithCollectionsAbcCallable](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingcallablewithcollectionsabccallable) + * **Replace `typing.Callable` with `collections.abc.Callable`** + * PEP 585 deprecated `typing.Callable` in Python 3.9. Replace with `collections.abc.Callable` for type annotations. +* [org.openrewrite.python.migrate.ReplaceTypingChainMapWithCollectionsChainMap](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingchainmapwithcollectionschainmap) + * **Replace `typing.ChainMap` with `collections.ChainMap`** + * Replace `typing.ChainMap` with `collections.ChainMap`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingCollectionWithCollectionsAbcCollection](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingcollectionwithcollectionsabccollection) + * **Replace `typing.Collection` with `collections.abc.Collection`** + * Replace `typing.Collection` with `collections.abc.Collection`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingContainerWithCollectionsAbcContainer](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingcontainerwithcollectionsabccontainer) + * **Replace `typing.Container` with `collections.abc.Container`** + * Replace `typing.Container` with `collections.abc.Container`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingContextManagerWithContextlib](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingcontextmanagerwithcontextlib) + * **Replace `typing.ContextManager` with `contextlib.AbstractContextManager`** + * Replace `typing.ContextManager` with `contextlib.AbstractContextManager`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingCoroutineWithCollectionsAbcCoroutine](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingcoroutinewithcollectionsabccoroutine) + * **Replace `typing.Coroutine` with `collections.abc.Coroutine`** + * Replace `typing.Coroutine` with `collections.abc.Coroutine`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingCounterWithCollectionsCounter](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingcounterwithcollectionscounter) + * **Replace `typing.Counter` with `collections.Counter`** + * Replace `typing.Counter` with `collections.Counter`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingDefaultDictWithCollectionsDefaultdict](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingdefaultdictwithcollectionsdefaultdict) + * **Replace `typing.DefaultDict` with `collections.defaultdict`** + * Replace `typing.DefaultDict` with `collections.defaultdict`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingDequeWithCollectionsDeque](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingdequewithcollectionsdeque) + * **Replace `typing.Deque` with `collections.deque`** + * Replace `typing.Deque` with `collections.deque`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingDictWithBuiltin](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingdictwithbuiltin) + * **Replace `typing.Dict` with `dict`** + * Replace `typing.Dict` with the built-in `dict` type. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingDictWithDict](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingdictwithdict) + * **Replace `typing.Dict` with `dict`** + * PEP 585 deprecated `typing.Dict` in Python 3.9. Replace with the built-in `dict` type for generic annotations. +* [org.openrewrite.python.migrate.ReplaceTypingFrozenSetWithBuiltin](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingfrozensetwithbuiltin) + * **Replace `typing.FrozenSet` with `frozenset`** + * Replace `typing.FrozenSet` with the built-in `frozenset` type. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingGeneratorWithCollectionsAbcGenerator](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypinggeneratorwithcollectionsabcgenerator) + * **Replace `typing.Generator` with `collections.abc.Generator`** + * Replace `typing.Generator` with `collections.abc.Generator`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingItemsViewWithCollectionsAbcItemsView](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingitemsviewwithcollectionsabcitemsview) + * **Replace `typing.ItemsView` with `collections.abc.ItemsView`** + * Replace `typing.ItemsView` with `collections.abc.ItemsView`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingIterableWithCollectionsAbcIterable](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingiterablewithcollectionsabciterable) + * **Replace `typing.Iterable` with `collections.abc.Iterable`** + * Replace `typing.Iterable` with `collections.abc.Iterable`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingIteratorWithCollectionsAbcIterator](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingiteratorwithcollectionsabciterator) + * **Replace `typing.Iterator` with `collections.abc.Iterator`** + * Replace `typing.Iterator` with `collections.abc.Iterator`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingKeysViewWithCollectionsAbcKeysView](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingkeysviewwithcollectionsabckeysview) + * **Replace `typing.KeysView` with `collections.abc.KeysView`** + * Replace `typing.KeysView` with `collections.abc.KeysView`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingListWithBuiltin](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypinglistwithbuiltin) + * **Replace `typing.List` with `list`** + * Replace `typing.List` with the built-in `list` type. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingListWithList](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypinglistwithlist) + * **Replace `typing.List` with `list`** + * PEP 585 deprecated `typing.List` in Python 3.9. Replace with the built-in `list` type for generic annotations. +* [org.openrewrite.python.migrate.ReplaceTypingMappingViewWithCollectionsAbcMappingView](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingmappingviewwithcollectionsabcmappingview) + * **Replace `typing.MappingView` with `collections.abc.MappingView`** + * Replace `typing.MappingView` with `collections.abc.MappingView`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingMappingWithCollectionsAbcMapping](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingmappingwithcollectionsabcmapping) + * **Replace `typing.Mapping` with `collections.abc.Mapping`** + * Replace `typing.Mapping` with `collections.abc.Mapping`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingMatchWithReMatch](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingmatchwithrematch) + * **Replace `typing.Match` with `re.Match`** + * Replace `typing.Match` with `re.Match`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingMutableMappingWithCollectionsAbcMutableMapping](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingmutablemappingwithcollectionsabcmutablemapping) + * **Replace `typing.MutableMapping` with `collections.abc.MutableMapping`** + * Replace `typing.MutableMapping` with `collections.abc.MutableMapping`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingMutableSequenceWithCollectionsAbcMutableSequence](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingmutablesequencewithcollectionsabcmutablesequence) + * **Replace `typing.MutableSequence` with `collections.abc.MutableSequence`** + * Replace `typing.MutableSequence` with `collections.abc.MutableSequence`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingMutableSetWithCollectionsAbcMutableSet](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingmutablesetwithcollectionsabcmutableset) + * **Replace `typing.MutableSet` with `collections.abc.MutableSet`** + * Replace `typing.MutableSet` with `collections.abc.MutableSet`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingOptionalWithUnion](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingoptionalwithunion) + * **Replace `typing.Optional[X]` with `X | None`** + * PEP 604 introduced the `|` operator for union types in Python 3.10. Replace `Optional[X]` with the more concise `X | None` syntax. +* [org.openrewrite.python.migrate.ReplaceTypingOrderedDictWithCollectionsOrderedDict](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingordereddictwithcollectionsordereddict) + * **Replace `typing.OrderedDict` with `collections.OrderedDict`** + * Replace `typing.OrderedDict` with `collections.OrderedDict`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingPatternWithRePattern](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingpatternwithrepattern) + * **Replace `typing.Pattern` with `re.Pattern`** + * Replace `typing.Pattern` with `re.Pattern`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingReversibleWithCollectionsAbcReversible](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingreversiblewithcollectionsabcreversible) + * **Replace `typing.Reversible` with `collections.abc.Reversible`** + * Replace `typing.Reversible` with `collections.abc.Reversible`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingSequenceWithCollectionsAbcSequence](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingsequencewithcollectionsabcsequence) + * **Replace `typing.Sequence` with `collections.abc.Sequence`** + * Replace `typing.Sequence` with `collections.abc.Sequence`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingSetWithBuiltin](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingsetwithbuiltin) + * **Replace `typing.Set` with `set`** + * Replace `typing.Set` with the built-in `set` type. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingSetWithSet](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingsetwithset) + * **Replace `typing.Set` with `set`** + * PEP 585 deprecated `typing.Set` in Python 3.9. Replace with the built-in `set` type for generic annotations. +* [org.openrewrite.python.migrate.ReplaceTypingText](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingtext) + * **Replace `typing.Text` with `str`** + * `typing.Text` is deprecated as of Python 3.11. It was an alias for `str` for Python 2/3 compatibility. Replace with `str`. +* [org.openrewrite.python.migrate.ReplaceTypingTupleWithBuiltin](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingtuplewithbuiltin) + * **Replace `typing.Tuple` with `tuple`** + * Replace `typing.Tuple` with the built-in `tuple` type. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingTupleWithTuple](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingtuplewithtuple) + * **Replace `typing.Tuple` with `tuple`** + * PEP 585 deprecated `typing.Tuple` in Python 3.9. Replace with the built-in `tuple` type for generic annotations. +* [org.openrewrite.python.migrate.ReplaceTypingTypeWithBuiltin](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingtypewithbuiltin) + * **Replace `typing.Type` with `type`** + * Replace `typing.Type` with the built-in `type` type. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceTypingUnionWithPipe](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingunionwithpipe) + * **Replace `typing.Union[X, Y]` with `X | Y`** + * PEP 604 introduced the `|` operator for union types in Python 3.10. Replace `Union[X, Y, ...]` with the more concise `X | Y | ...` syntax. +* [org.openrewrite.python.migrate.ReplaceTypingValuesViewWithCollectionsAbcValuesView](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replacetypingvaluesviewwithcollectionsabcvaluesview) + * **Replace `typing.ValuesView` with `collections.abc.ValuesView`** + * Replace `typing.ValuesView` with `collections.abc.ValuesView`. Available in Python 3.9+ (PEP 585). +* [org.openrewrite.python.migrate.ReplaceUnittestDeprecatedAliases](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/replaceunittestdeprecatedaliases) + * **Replace deprecated unittest method aliases** + * Replace deprecated unittest.TestCase method aliases like `assertEquals` with their modern equivalents like `assertEqual`. These aliases were removed in Python 3.11/3.12. +* [org.openrewrite.python.migrate.UpgradeToPython310](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/upgradetopython310) + * **Upgrade to Python 3.10** + * Migrate deprecated APIs and adopt new syntax for Python 3.10 compatibility. This includes adopting PEP 604 union type syntax (`X | Y`) and other modernizations between Python 3.9 and 3.10. +* [org.openrewrite.python.migrate.UpgradeToPython311](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/upgradetopython311) + * **Upgrade to Python 3.11** + * Migrate deprecated and removed APIs for Python 3.11 compatibility. This includes handling removed modules, deprecated functions, and API changes between Python 3.10 and 3.11. +* [org.openrewrite.python.migrate.UpgradeToPython312](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/upgradetopython312) + * **Upgrade to Python 3.12** + * Migrate deprecated and removed APIs for Python 3.12 compatibility. This includes detecting usage of the removed `imp` module and other legacy modules that were removed in Python 3.12. +* [org.openrewrite.python.migrate.UpgradeToPython313](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/upgradetopython313) + * **Upgrade to Python 3.13** + * Migrate deprecated and removed APIs for Python 3.13 compatibility. This includes detecting usage of modules removed in PEP 594 ('dead batteries') and other API changes between Python 3.12 and 3.13. +* [org.openrewrite.python.migrate.UpgradeToPython314](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/upgradetopython314) + * **Upgrade to Python 3.14** + * Migrate deprecated and removed APIs for Python 3.14 compatibility. This includes replacing deprecated AST node types with `ast.Constant` and other API changes between Python 3.13 and 3.14. +* [org.openrewrite.python.migrate.UpgradeToPython38](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/upgradetopython38) + * **Upgrade to Python 3.8** + * Migrate deprecated APIs and detect legacy patterns for Python 3.8 compatibility. +* [org.openrewrite.python.migrate.UpgradeToPython39](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/upgradetopython39) + * **Upgrade to Python 3.9** + * Migrate deprecated APIs for Python 3.9 compatibility. This includes PEP 585 built-in generics, removed base64 functions, and deprecated XML Element methods. +* [org.openrewrite.python.migrate.langchain.FindDeprecatedLangchainAgents](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/langchain/finddeprecatedlangchainagents) + * **Find deprecated LangChain agent patterns** + * Find usage of deprecated LangChain agent patterns including `initialize_agent`, `AgentExecutor`, and `LLMChain`. These were deprecated in LangChain v0.2 and removed in v1.0. +* [org.openrewrite.python.migrate.langchain.FindLangchainCreateReactAgent](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/langchain/findlangchaincreatereactagent) + * **Find `create_react_agent` usage (replace with `create_agent`)** + * Find `from langgraph.prebuilt import create_react_agent` which should be replaced with `from langchain.agents import create_agent` in LangChain v1.0. +* [org.openrewrite.python.migrate.langchain.ReplaceLangchainClassicImports](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/langchain/replacelangchainclassicimports) + * **Replace `langchain` legacy imports with `langchain_classic`** + * Migrate legacy chain, retriever, and indexing imports from `langchain` to `langchain_classic`. These were moved in LangChain v1.0. +* [org.openrewrite.python.migrate.langchain.ReplaceLangchainCommunityImports](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/langchain/replacelangchaincommunityimports) + * **Replace `langchain` imports with `langchain_community`** + * Migrate third-party integration imports from `langchain` to `langchain_community`. These integrations were moved in LangChain v0.2. +* [org.openrewrite.python.migrate.langchain.ReplaceLangchainProviderImports](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/langchain/replacelangchainproviderimports) + * **Replace `langchain_community` imports with provider packages** + * Migrate provider-specific imports from `langchain_community` to dedicated provider packages like `langchain_openai`, `langchain_anthropic`, etc. +* [org.openrewrite.python.migrate.langchain.UpgradeToLangChain02](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/langchain/upgradetolangchain02) + * **Upgrade to LangChain 0.2** + * Migrate to LangChain 0.2 by updating imports from `langchain` to `langchain_community` and provider-specific packages. +* [org.openrewrite.python.migrate.langchain.UpgradeToLangChain1](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/python/migrate/langchain/upgradetolangchain1) + * **Upgrade to LangChain 1.0** + * Migrate to LangChain 1.0 by applying all v0.2 migrations and then moving legacy functionality to `langchain_classic`. ## rewrite-nodejs -* [org.openrewrite.node.dependency-vulnerability-check](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/dependency-vulnerability-check) - * **Find and fix vulnerable npm dependencies** - * This software composition analysis (SCA) tool detects and upgrades dependencies with publicly disclosed vulnerabilities. This recipe both generates a report of vulnerable dependencies and upgrades to newer versions with fixes. This recipe by default only upgrades to the latest **patch** version. If a minor or major upgrade is required to reach the fixed version, this can be controlled using the `maximumUpgradeDelta` option. Vulnerability information comes from the GitHub Security Advisory Database. -* [org.openrewrite.node.migrate.buffer.replace-deprecated-slice](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/buffer/replace-deprecated-slice) - * **Replace deprecated `Buffer.slice()` with `Buffer.subarray()`** - * Replace deprecated `buffer.slice()` calls with `buffer.subarray()` for compatibility with Uint8Array.prototype.slice(). -* [org.openrewrite.node.migrate.buffer.replace-slow-buffer](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/buffer/replace-slow-buffer) - * **Replace deprecated `SlowBuffer` with `Buffer.allocUnsafeSlow()`** - * Replace deprecated `new SlowBuffer(size)` calls with `Buffer.allocUnsafeSlow(size)`. SlowBuffer was used to create un-pooled Buffer instances, but has been removed in favor of the explicit Buffer.allocUnsafeSlow() method. -* [org.openrewrite.node.migrate.crypto.find-create-cipher](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/crypto/find-create-cipher) - * **Find deprecated `crypto.createCipher()` and `crypto.createDecipher()` usage** - * `crypto.createCipher()` and `crypto.createDecipher()` were deprecated in Node.js 10 (DEP0106) and removed in Node.js 22. Use `crypto.createCipheriv()` and `crypto.createDecipheriv()` instead. -* [org.openrewrite.node.migrate.crypto.replace-crypto-fips](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/crypto/replace-crypto-fips) - * **Replace deprecated `crypto.fips` with `crypto.getFips()` and `crypto.setFips()`** - * Replace deprecated `crypto.fips` property access with `crypto.getFips()` for reads and `crypto.setFips(value)` for writes. -* [org.openrewrite.node.migrate.crypto.replace-hash-constructor](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/crypto/replace-hash-constructor) - * **Replace deprecated `new crypto.Hash()` and `new crypto.Hmac()` with factory methods** - * Replace deprecated `new crypto.Hash(algorithm)` constructor calls with `crypto.createHash(algorithm)` and `new crypto.Hmac(algorithm, key)` with `crypto.createHmac(algorithm, key)` factory methods. -* [org.openrewrite.node.migrate.find-process-assert](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/find-process-assert) - * **Find deprecated `process.assert()` usage** - * `process.assert()` was deprecated in Node.js 10 (DEP0100) and removed in Node.js 23. Use the `assert` module instead. -* [org.openrewrite.node.migrate.find-punycode-usage](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/find-punycode-usage) - * **Find deprecated `punycode` module usage** - * The `punycode` built-in module was deprecated in Node.js 21 (DEP0040). Use the userland `punycode` package from npm or `url.domainToASCII`/`url.domainToUnicode` instead. -* [org.openrewrite.node.migrate.fs.replace-dirent-path](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/fs/replace-dirent-path) - * **Replace `dirent.path` with `dirent.parentPath`** - * Replaces deprecated `dirent.path` property access with `dirent.parentPath` on `fs.Dirent` instances to address DEP0178 deprecation. -* [org.openrewrite.node.migrate.fs.replace-fs-access-constants](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/fs/replace-fs-access-constants) - * **Replace deprecated `fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK` with `fs.constants.*`** - * Replace deprecated file access constants (`fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK`) with their equivalents from `fs.constants`. These constants were removed in Node.js v24+ and should be accessed through the constants namespace. -* [org.openrewrite.node.migrate.fs.replace-fs-truncate-fd](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/fs/replace-fs-truncate-fd) - * **Replace `fs.truncate()` with file descriptor to `fs.ftruncate()`** - * Replace deprecated `fs.truncate(fd, ...)` and `fs.truncateSync(fd, ...)` calls with `fs.ftruncate(fd, ...)` and `fs.ftruncateSync(fd, ...)` when the first argument is a file descriptor (number). -* [org.openrewrite.node.migrate.fs.replace-stats-constructor](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/fs/replace-stats-constructor) - * **Replace deprecated `fs.Stats` constructor with object literal** - * Replace deprecated `new fs.Stats()` constructor calls with an object literal containing Stats properties initialized to undefined. -* [org.openrewrite.node.migrate.http.replace-outgoing-message-headers](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/http/replace-outgoing-message-headers) - * **Replace `OutgoingMessage._headers` and `._headerNames` with public methods** - * Replace deprecated `OutgoingMessage.prototype._headers` with `getHeaders()`, `setHeader()`, `removeHeader()` and `OutgoingMessage.prototype._headerNames` with `getHeaderNames()` to address DEP0066 deprecation. -* [org.openrewrite.node.migrate.increase-node-engine-version](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/increase-node-engine-version) - * **Increase Node.js engine version** - * Increases the upper bound of the `engines.node` version range in package.json to allow the specified Node.js version. -* [org.openrewrite.node.migrate.increase-node-engine-version-in-github-actions](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/increase-node-engine-version-in-github-actions) - * **Increase Node.js version in GitHub Actions** - * Increases `node-version` in `actions/setup-node` steps in GitHub Actions workflows. Only modifies plain major version values (e.g. `20`) and x-ranges (e.g. `20.x`). Never decreases the version. -* [org.openrewrite.node.migrate.net.remove-set-simultaneous-accepts](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/net/remove-set-simultaneous-accepts) - * **Remove deprecated `net._setSimultaneousAccepts()`** - * Remove calls to deprecated `net._setSimultaneousAccepts()` which was an undocumented internal function that is no longer necessary. -* [org.openrewrite.node.migrate.process.coerce-process-exit-code](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/process/coerce-process-exit-code) - * **Coerce `process.exit()` and `process.exitCode` to integer** - * Wraps non-integer values passed to `process.exit()` or assigned to `process.exitCode` with `Math.trunc()` to avoid the DEP0164 deprecation warning about implicit coercion to integer. -* [org.openrewrite.node.migrate.process.remove-usage-of-features-tls-underscore_constants](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/process/remove-usage-of-features-tls-underscore_constants) - * **Remove usage of deprecated `process.features.tls_*` properties** - * Remove references to deprecated `process.features.tls_*` properties, replace with `process.features.tls`. -* [org.openrewrite.node.migrate.stream.replace-internal-modules](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/stream/replace-internal-modules) - * **Replace deprecated `node:_stream_*` with `node:stream`** - * Replace deprecated internal stream module imports like `require('node:_stream_readable')` with the public `node:stream` module. -* [org.openrewrite.node.migrate.timers.find-timers-active](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/timers/find-timers-active) - * **Find deprecated `timers.active()` and `timers._unrefActive()` usage** - * `timers.active()` (DEP0126) and `timers._unrefActive()` (DEP0127) were deprecated and removed in Node.js 24. Use `timeout.refresh()` instead. -* [org.openrewrite.node.migrate.tls.find-tls-secure-pair](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/tls/find-tls-secure-pair) - * **Find deprecated `tls.SecurePair` and `tls.createSecurePair()` usage** - * `tls.SecurePair` (DEP0043) and `tls.createSecurePair()` (DEP0064) were deprecated and removed in Node.js 24. Use `tls.TLSSocket` instead. -* [org.openrewrite.node.migrate.tls.replace-internal-modules](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/tls/replace-internal-modules) - * **Replace deprecated `node:_tls_common` and `node:_tls_wrap` with `node:tls`** - * Replace deprecated internal TLS module imports `require('node:_tls_common')` and `require('node:_tls_wrap')` with the public `node:tls` module. -* [org.openrewrite.node.migrate.upgrade-node-22](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/upgrade-node-22) - * **Upgrade to Node.js 22** - * Migrate deprecated APIs for Node.js 22 compatibility. Addresses Node 22 runtime deprecations and deprecations from earlier versions. -* [org.openrewrite.node.migrate.upgrade-node-24](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/upgrade-node-24) - * **Upgrade to Node.js 24** - * Migrate deprecated APIs for Node.js 24 compatibility. Includes all migrations from Node.js 22, plus Node 23 and Node 24 deprecations. -* [org.openrewrite.node.migrate.util.remove-promisify-on-promise](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/remove-promisify-on-promise) - * **Remove unnecessary `util.promisify()` on Promise-returning functions** - * Removes `util.promisify()` calls on functions that already return a Promise. Since Node.js v17.0.0, calling promisify on a function that returns a Promise emits a runtime deprecation warning (DEP0174). -* [org.openrewrite.node.migrate.util.replace-is-webassembly-compiled-module](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/replace-is-webassembly-compiled-module) - * **Replace deprecated `util.types.isWebAssemblyCompiledModule()`** - * Replace `util.types.isWebAssemblyCompiledModule(value)` with `value instanceof WebAssembly.Module`. -* [org.openrewrite.node.migrate.util.replace-util-extend](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/replace-util-extend) - * **Replace deprecated `util._extend()` with `Object.assign()`** - * Replace deprecated `util._extend(target, source)` calls with `Object.assign(target, source)` which preserves the mutation behavior. -* [org.openrewrite.node.migrate.util.replace-util-log](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/replace-util-log) - * **Replace deprecated `util.log()` with `console.log()`** - * Replace deprecated `util.log()` calls with `console.log()`. Note: `util.log()` included timestamps, but `console.log()` does not. -* [org.openrewrite.node.migrate.util.use-native-type-checking-methods](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/use-native-type-checking-methods) - * **Replace deprecated `util.isX()` methods with native JavaScript** - * The `util` module's type-checking methods have been removed in Node 22. -* [org.openrewrite.node.migrate.zlib.replace-bytes-read](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/zlib/replace-bytes-read) - * **Replace deprecated `zlib.bytesRead` with `zlib.bytesWritten`** - * Replace deprecated `bytesRead` property on zlib streams with `bytesWritten`. -* [org.openrewrite.node.security.remove-redundant-overrides](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/security/remove-redundant-overrides) - * **Remove redundant dependency overrides** - * Removes overrides/resolutions from package.json that are redundant because the dependency tree already resolves to the overridden version or higher. * [org.openrewrite.nodejs.DependencyVulnerabilityCheck](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/nodejs/dependencyvulnerabilitycheck) * **Find and fix vulnerable npm dependencies** * This software composition analysis (SCA) tool detects and upgrades dependencies with publicly disclosed vulnerabilities. This recipe both generates a report of vulnerable dependencies and upgrades to newer versions with fixes. This recipe **only** upgrades to the latest **patch** version. If a minor or major upgrade is required to reach the fixed version, this recipe will not make any changes. Vulnerability information comes from the [GitHub Security Advisory Database](https://docs.github.com/en/code-security/security-advisories/global-security-advisories/about-the-github-advisory-database), which aggregates vulnerability data from several public databases, including the [National Vulnerability Database](https://nvd.nist.gov/) maintained by the United States government. Dependencies following [Semantic Versioning](https://semver.org/) will see their _patch_ version updated where applicable. diff --git a/docs/reference/recipes-by-tag.md b/docs/reference/recipes-by-tag.md index ac01448667..0cd9aa8733 100644 --- a/docs/reference/recipes-by-tag.md +++ b/docs/reference/recipes-by-tag.md @@ -6,7 +6,7 @@ description: An autogenerated list of all recipe tags and the recipes within eac _This doc contains all recipe tags and the recipes that are tagged with them._ -Total tags: 254 +Total tags: 249 ## 5to6 @@ -257,14 +257,6 @@ _11 recipes_ * **Migrate Google Truth to AssertJ** * Migrate Google Truth assertions to AssertJ assertions. -## async - -_1 recipe_ - -* [org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](/recipes/javascript/cleanup/async-callback-in-sync-array-method.md) - * **Detect async callbacks in synchronous array methods** - * Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. - ## authentication _2 recipes_ @@ -566,14 +558,6 @@ _1 recipe_ * **Migrate Brave API to OpenTelemetry API** * Migrate Java code using Brave (Zipkin) tracing API to OpenTelemetry API. This recipe handles the migration of Brave Tracer, Span, and related classes to OpenTelemetry equivalents. -## bug - -_1 recipe_ - -* [org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](/recipes/javascript/cleanup/async-callback-in-sync-array-method.md) - * **Detect async callbacks in synchronous array methods** - * Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. - ## build _2 recipes_ @@ -656,14 +640,6 @@ _3 recipes_ * **Replace Spring Kafka with Quarkus Kafka Client** * Migrates `spring-kafka` to `quarkus-kafka-client` when no reactor dependencies are present. -## cleanup - -_1 recipe_ - -* [org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](/recipes/javascript/cleanup/async-callback-in-sync-array-method.md) - * **Detect async callbacks in synchronous array methods** - * Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. - ## cloud _17 recipes_ @@ -3365,14 +3341,6 @@ _1 recipe_ * **Migrate to JavaEE8** * These recipes help with the Migration to Java EE 8, flagging and updating deprecated methods. -## javascript - -_1 recipe_ - -* [org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](/recipes/javascript/cleanup/async-callback-in-sync-array-method.md) - * **Detect async callbacks in synchronous array methods** - * Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. - ## javax _37 recipes_ @@ -7634,14 +7602,6 @@ _1 recipe_ * **Migrate Google Truth to AssertJ** * Migrate Google Truth assertions to AssertJ assertions. -## typescript - -_1 recipe_ - -* [org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](/recipes/javascript/cleanup/async-callback-in-sync-array-method.md) - * **Detect async callbacks in synchronous array methods** - * Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. - ## unaffected _1 recipe_ diff --git a/docs/reference/standalone-recipes.md b/docs/reference/standalone-recipes.md index f02b0fbbee..6fce0b0933 100644 --- a/docs/reference/standalone-recipes.md +++ b/docs/reference/standalone-recipes.md @@ -6,7 +6,7 @@ description: An autogenerated list of recipes that are not included in any compo _This doc contains recipes that are not included as part of any larger composite recipe. These recipes can be run independently and are not bundled with other recipes._ -Total standalone recipes: 1005 +Total standalone recipes: 990 ## org.openrewrite.meta:rewrite-analysis @@ -3002,51 +3002,6 @@ Total standalone recipes: 1005 * [org.openrewrite.java.testing.testcontainers.TestContainersBestPractices](/recipes/java/testing/testcontainers/testcontainersbestpractices.md) * **Testcontainers best practices** * Apply best practices to Testcontainers usage. -* [org.openrewrite.javascript.change-import](/recipes/javascript/change-import.md) - * **Change import** - * Changes an import from one module/member to another, updating all type attributions. -* [org.openrewrite.javascript.cleanup.add-parse-int-radix](/recipes/javascript/cleanup/add-parse-int-radix.md) - * **Add radix to `parseInt`** - * Adds the radix parameter (base 10) to `parseInt()` calls that are missing it, preventing potential parsing issues. -* [org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method](/recipes/javascript/cleanup/async-callback-in-sync-array-method.md) - * **Detect async callbacks in synchronous array methods** - * Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. -* [org.openrewrite.javascript.cleanup.order-imports](/recipes/javascript/cleanup/order-imports.md) - * **Order imports** - * Sort imports by category and module path. Categories: side-effect, namespace, default, named, type. Within each category, imports are sorted alphabetically by module path. Named specifiers within each import are also sorted alphabetically. -* [org.openrewrite.javascript.cleanup.prefer-optional-chain](/recipes/javascript/cleanup/prefer-optional-chain.md) - * **Prefer optional chaining** - * Converts ternary expressions like `foo ? foo.bar : undefined` to use optional chaining syntax `foo?.bar`. -* [org.openrewrite.javascript.cleanup.use-object-property-shorthand](/recipes/javascript/cleanup/use-object-property-shorthand.md) - * **Use object property shorthand** - * Simplifies object properties where the property name and value/variable name are the same (e.g., `\{ x: x \}` becomes `\{ x \}`). Applies to both destructuring patterns and object literals. -* [org.openrewrite.javascript.dependencies.add-dependency](/recipes/javascript/dependencies/add-dependency.md) - * **Add npm dependency** - * Adds a new dependency to `package.json` and updates the lock file by running the package manager. -* [org.openrewrite.javascript.dependencies.find-dependency](/recipes/javascript/dependencies/find-dependency.md) - * **Find Node.js dependency** - * Finds dependencies in a project's `package.json`. Can find both direct dependencies and dependencies that transitively include the target package. This recipe is commonly used as a precondition for other recipes. -* [org.openrewrite.javascript.dependencies.upgrade-dependency-version](/recipes/javascript/dependencies/upgrade-dependency-version.md) - * **Upgrade npm dependency version** - * Upgrades the version of a direct dependency in `package.json` and updates the lock file by running the package manager. -* [org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version](/recipes/javascript/dependencies/upgrade-transitive-dependency-version.md) - * **Upgrade transitive npm dependency version** - * Upgrades the version of a transitive dependency by adding override/resolution entries to `package.json` and updates the lock file by running the package manager. -* [org.openrewrite.javascript.format.auto-format](/recipes/javascript/format/auto-format.md) - * **Auto-format JavaScript/TypeScript code** - * Format JavaScript and TypeScript code using formatting rules auto-detected from the project's existing code style. -* [org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences](/recipes/javascript/migrate/es6/modernize-octal-escape-sequences.md) - * **Modernize octal escape sequences** - * Convert old-style octal escape sequences (e.g., `\0`, `\123`) to modern hex escape sequences (e.g., `\x00`, `\x53`) or Unicode escape sequences (e.g., `\u0000`, `\u0053`). -* [org.openrewrite.javascript.migrate.es6.modernize-octal-literals](/recipes/javascript/migrate/es6/modernize-octal-literals.md) - * **Modernize octal literals** - * Convert old-style octal literals (e.g., `0777`) to modern ES6 syntax (e.g., `0o777`). -* [org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys](/recipes/javascript/migrate/es6/remove-duplicate-object-keys.md) - * **Remove duplicate object keys** - * Remove duplicate keys in object literals, keeping only the last occurrence (last-wins semantics). -* [org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default](/recipes/javascript/migrate/typescript/export-assignment-to-export-default.md) - * **Convert `export =` to `export default`** - * Converts TypeScript `export =` syntax to ES module `export default` syntax for compatibility with ECMAScript modules. * [org.openrewrite.jenkins.CommonsLang3ToApiPlugin](/recipes/jenkins/commonslang3toapiplugin.md) * **Use commons-lang3 API Plugin** * Updates `pom.xml` to depend on `commons-lang3-api` and exclude `commons-lang3` where it is brought in transitively. From a4c210cbd1da3ca6e69c667692779564a5a22c82 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 9 Mar 2026 17:46:15 +0100 Subject: [PATCH 5/6] Update changelog to remove deprecated entries Removed deprecated recipes and artifacts from the changelog. --- docs/changelog/8-75-2-Release.md | 46 -------------------------------- 1 file changed, 46 deletions(-) diff --git a/docs/changelog/8-75-2-Release.md b/docs/changelog/8-75-2-Release.md index e687c8e57a..2ce02caa69 100644 --- a/docs/changelog/8-75-2-Release.md +++ b/docs/changelog/8-75-2-Release.md @@ -15,10 +15,6 @@ This changelog only shows what recipes have been added, removed, or changed. Ope * Stable CLI version `v3.57.12` * Staging CLI version: `v3.57.14` -## Removed Artifacts - -* rewrite-csharp - ## New Recipes * [org.openrewrite.gitlab.AddArtifactsExpireIn](https://docs.openrewrite.org/recipes/gitlab/addartifactsexpirein): Set `artifacts:expire_in` in `.gitlab-ci.yml` to prevent storage bloat from indefinitely stored artifacts. @@ -38,45 +34,3 @@ This changelog only shows what recipes have been added, removed, or changed. Ope * [org.openrewrite.java.testing.mockito.ReplaceMockitoTestExecutionListener](https://docs.openrewrite.org/recipes/java/testing/mockito/replacemockitotestexecutionlistener): Replace `@TestExecutionListeners(MockitoTestExecutionListener.class)` with the appropriate Mockito initialization for the test framework in use: `@ExtendWith(MockitoExtension.class)` for JUnit 5, `@RunWith(MockitoJUnitRunner.class)` for JUnit 4, or `MockitoAnnotations.openMocks(this)` for TestNG. * [org.openrewrite.java.testing.mockito.ReplacePowerMockDependencies](https://docs.openrewrite.org/recipes/java/testing/mockito/replacepowermockdependencies): Replaces PowerMock API dependencies with `mockito-inline` when `mockStatic()`, `whenNew()`, or `@PrepareForTest` usage is detected, or `mockito-core` otherwise. PowerMock features like static mocking, constructor mocking, and final class mocking require the inline mock maker which is bundled in `mockito-inline` for Mockito 3.x/4.x. -## Removed Recipes - -* **org.openrewrite.javascript.change-import**: Changes an import from one module/member to another, updating all type attributions. -* **org.openrewrite.javascript.cleanup.add-parse-int-radix**: Adds the radix parameter (base 10) to `parseInt()` calls that are missing it, preventing potential parsing issues. -* **org.openrewrite.javascript.cleanup.async-callback-in-sync-array-method**: Detects async callbacks passed to array methods like .some(), .every(), .filter() which don't await promises. This is a common bug where Promise objects are always truthy. -* **org.openrewrite.javascript.cleanup.order-imports**: Sort imports by category and module path. Categories: side-effect, namespace, default, named, type. Within each category, imports are sorted alphabetically by module path. Named specifiers within each import are also sorted alphabetically. -* **org.openrewrite.javascript.cleanup.prefer-optional-chain**: Converts ternary expressions like `foo ? foo.bar : undefined` to use optional chaining syntax `foo?.bar`. -* **org.openrewrite.javascript.cleanup.use-object-property-shorthand**: Simplifies object properties where the property name and value/variable name are the same (e.g., `{ x: x }` becomes `{ x }`). Applies to both destructuring patterns and object literals. -* **org.openrewrite.javascript.dependencies.add-dependency**: Adds a new dependency to `package.json` and updates the lock file by running the package manager. -* **org.openrewrite.javascript.dependencies.find-dependency**: Finds dependencies in a project's `package.json`. Can find both direct dependencies and dependencies that transitively include the target package. This recipe is commonly used as a precondition for other recipes. -* **org.openrewrite.javascript.dependencies.upgrade-dependency-version**: Upgrades the version of a direct dependency in `package.json` and updates the lock file by running the package manager. -* **org.openrewrite.javascript.dependencies.upgrade-transitive-dependency-version**: Upgrades the version of a transitive dependency by adding override/resolution entries to `package.json` and updates the lock file by running the package manager. -* **org.openrewrite.javascript.format.auto-format**: Format JavaScript and TypeScript code using formatting rules auto-detected from the project's existing code style. -* **org.openrewrite.javascript.migrate.es6.modernize-octal-escape-sequences**: Convert old-style octal escape sequences (e.g., `\0`, `\123`) to modern hex escape sequences (e.g., `\x00`, `\x53`) or Unicode escape sequences (e.g., `\u0000`, `\u0053`). -* **org.openrewrite.javascript.migrate.es6.modernize-octal-literals**: Convert old-style octal literals (e.g., `0777`) to modern ES6 syntax (e.g., `0o777`). -* **org.openrewrite.javascript.migrate.es6.remove-duplicate-object-keys**: Remove duplicate keys in object literals, keeping only the last occurrence (last-wins semantics). -* **org.openrewrite.javascript.migrate.typescript.export-assignment-to-export-default**: Converts TypeScript `export =` syntax to ES module `export default` syntax for compatibility with ECMAScript modules. -* **org.openrewrite.node.dependency-vulnerability-check**: This software composition analysis (SCA) tool detects and upgrades dependencies with publicly disclosed vulnerabilities. This recipe both generates a report of vulnerable dependencies and upgrades to newer versions with fixes. This recipe by default only upgrades to the latest **patch** version. If a minor or major upgrade is required to reach the fixed version, this can be controlled using the `maximumUpgradeDelta` option. Vulnerability information comes from the GitHub Security Advisory Database. -* **org.openrewrite.node.migrate.buffer.replace-deprecated-slice**: Replace deprecated `buffer.slice()` calls with `buffer.subarray()` for compatibility with Uint8Array.prototype.slice(). -* **org.openrewrite.node.migrate.buffer.replace-slow-buffer**: Replace deprecated `new SlowBuffer(size)` calls with `Buffer.allocUnsafeSlow(size)`. SlowBuffer was used to create un-pooled Buffer instances, but has been removed in favor of the explicit Buffer.allocUnsafeSlow() method. -* **org.openrewrite.node.migrate.crypto.replace-crypto-fips**: Replace deprecated `crypto.fips` property access with `crypto.getFips()` for reads and `crypto.setFips(value)` for writes. -* **org.openrewrite.node.migrate.crypto.replace-hash-constructor**: Replace deprecated `new crypto.Hash(algorithm)` constructor calls with `crypto.createHash(algorithm)` and `new crypto.Hmac(algorithm, key)` with `crypto.createHmac(algorithm, key)` factory methods. -* **org.openrewrite.node.migrate.fs.replace-dirent-path**: Replaces deprecated `dirent.path` property access with `dirent.parentPath` on `fs.Dirent` instances to address DEP0178 deprecation. -* **org.openrewrite.node.migrate.fs.replace-fs-access-constants**: Replace deprecated file access constants (`fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK`) with their equivalents from `fs.constants`. These constants were removed in Node.js v24+ and should be accessed through the constants namespace. -* **org.openrewrite.node.migrate.fs.replace-fs-truncate-fd**: Replace deprecated `fs.truncate(fd, ...)` and `fs.truncateSync(fd, ...)` calls with `fs.ftruncate(fd, ...)` and `fs.ftruncateSync(fd, ...)` when the first argument is a file descriptor (number). -* **org.openrewrite.node.migrate.fs.replace-stats-constructor**: Replace deprecated `new fs.Stats()` constructor calls with an object literal containing Stats properties initialized to undefined. -* **org.openrewrite.node.migrate.http.replace-outgoing-message-headers**: Replace deprecated `OutgoingMessage.prototype._headers` with `getHeaders()`, `setHeader()`, `removeHeader()` and `OutgoingMessage.prototype._headerNames` with `getHeaderNames()` to address DEP0066 deprecation. -* **org.openrewrite.node.migrate.net.remove-set-simultaneous-accepts**: Remove calls to deprecated `net._setSimultaneousAccepts()` which was an undocumented internal function that is no longer necessary. -* **org.openrewrite.node.migrate.process.coerce-process-exit-code**: Wraps non-integer values passed to `process.exit()` or assigned to `process.exitCode` with `Math.trunc()` to avoid the DEP0164 deprecation warning about implicit coercion to integer. -* **org.openrewrite.node.migrate.process.remove-usage-of-features-tls-underscore_constants**: Remove references to deprecated `process.features.tls_*` properties, replace with `process.features.tls`. -* **org.openrewrite.node.migrate.stream.replace-internal-modules**: Replace deprecated internal stream module imports like `require('node:_stream_readable')` with the public `node:stream` module. -* **org.openrewrite.node.migrate.tls.replace-internal-modules**: Replace deprecated internal TLS module imports `require('node:_tls_common')` and `require('node:_tls_wrap')` with the public `node:tls` module. -* **org.openrewrite.node.migrate.upgrade-node-22**: Migrate deprecated APIs for Node.js 22 compatibility. Addresses Node 22 runtime deprecations and deprecations from earlier versions. -* **org.openrewrite.node.migrate.upgrade-node-24**: Migrate deprecated APIs for Node.js 24 compatibility. Includes all migrations from Node.js 22, plus Node 23 and Node 24 deprecations. -* **org.openrewrite.node.migrate.util.remove-promisify-on-promise**: Removes `util.promisify()` calls on functions that already return a Promise. Since Node.js v17.0.0, calling promisify on a function that returns a Promise emits a runtime deprecation warning (DEP0174). -* **org.openrewrite.node.migrate.util.replace-is-webassembly-compiled-module**: Replace `util.types.isWebAssemblyCompiledModule(value)` with `value instanceof WebAssembly.Module`. -* **org.openrewrite.node.migrate.util.replace-util-extend**: Replace deprecated `util._extend(target, source)` calls with `Object.assign(target, source)` which preserves the mutation behavior. -* **org.openrewrite.node.migrate.util.replace-util-log**: Replace deprecated `util.log()` calls with `console.log()`. Note: `util.log()` included timestamps, but `console.log()` does not. -* **org.openrewrite.node.migrate.util.use-native-type-checking-methods**: The `util` module's type-checking methods have been removed in Node 22. -* **org.openrewrite.node.migrate.zlib.replace-bytes-read**: Replace deprecated `bytesRead` property on zlib streams with `bytesWritten`. -* **org.openrewrite.node.security.remove-redundant-overrides**: Removes overrides/resolutions from package.json that are redundant because the dependency tree already resolves to the overridden version or higher. - From 59600b3acecadb4f42ad4e5196f05c82e2971cb5 Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Mon, 9 Mar 2026 17:59:05 +0100 Subject: [PATCH 6/6] Restore Node.js migration and security recipes Added multiple recipes for Node.js migration and security checks, including updates for deprecated methods and properties. --- docs/reference/moderne-recipes.md | 93 +++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/docs/reference/moderne-recipes.md b/docs/reference/moderne-recipes.md index db80569032..d846c29b03 100644 --- a/docs/reference/moderne-recipes.md +++ b/docs/reference/moderne-recipes.md @@ -1397,6 +1397,99 @@ This doc includes every recipe that is exclusive to users of Moderne. For a full ## rewrite-nodejs +* [org.openrewrite.node.dependency-vulnerability-check](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/dependency-vulnerability-check) + * **Find and fix vulnerable npm dependencies** + * This software composition analysis (SCA) tool detects and upgrades dependencies with publicly disclosed vulnerabilities. This recipe both generates a report of vulnerable dependencies and upgrades to newer versions with fixes. This recipe by default only upgrades to the latest **patch** version. If a minor or major upgrade is required to reach the fixed version, this can be controlled using the `maximumUpgradeDelta` option. Vulnerability information comes from the GitHub Security Advisory Database. +* [org.openrewrite.node.migrate.buffer.replace-deprecated-slice](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/buffer/replace-deprecated-slice) + * **Replace deprecated `Buffer.slice()` with `Buffer.subarray()`** + * Replace deprecated `buffer.slice()` calls with `buffer.subarray()` for compatibility with Uint8Array.prototype.slice(). +* [org.openrewrite.node.migrate.buffer.replace-slow-buffer](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/buffer/replace-slow-buffer) + * **Replace deprecated `SlowBuffer` with `Buffer.allocUnsafeSlow()`** + * Replace deprecated `new SlowBuffer(size)` calls with `Buffer.allocUnsafeSlow(size)`. SlowBuffer was used to create un-pooled Buffer instances, but has been removed in favor of the explicit Buffer.allocUnsafeSlow() method. +* [org.openrewrite.node.migrate.crypto.find-create-cipher](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/crypto/find-create-cipher) + * **Find deprecated `crypto.createCipher()` and `crypto.createDecipher()` usage** + * `crypto.createCipher()` and `crypto.createDecipher()` were deprecated in Node.js 10 (DEP0106) and removed in Node.js 22. Use `crypto.createCipheriv()` and `crypto.createDecipheriv()` instead. +* [org.openrewrite.node.migrate.crypto.replace-crypto-fips](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/crypto/replace-crypto-fips) + * **Replace deprecated `crypto.fips` with `crypto.getFips()` and `crypto.setFips()`** + * Replace deprecated `crypto.fips` property access with `crypto.getFips()` for reads and `crypto.setFips(value)` for writes. +* [org.openrewrite.node.migrate.crypto.replace-hash-constructor](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/crypto/replace-hash-constructor) + * **Replace deprecated `new crypto.Hash()` and `new crypto.Hmac()` with factory methods** + * Replace deprecated `new crypto.Hash(algorithm)` constructor calls with `crypto.createHash(algorithm)` and `new crypto.Hmac(algorithm, key)` with `crypto.createHmac(algorithm, key)` factory methods. +* [org.openrewrite.node.migrate.find-process-assert](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/find-process-assert) + * **Find deprecated `process.assert()` usage** + * `process.assert()` was deprecated in Node.js 10 (DEP0100) and removed in Node.js 23. Use the `assert` module instead. +* [org.openrewrite.node.migrate.find-punycode-usage](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/find-punycode-usage) + * **Find deprecated `punycode` module usage** + * The `punycode` built-in module was deprecated in Node.js 21 (DEP0040). Use the userland `punycode` package from npm or `url.domainToASCII`/`url.domainToUnicode` instead. +* [org.openrewrite.node.migrate.fs.replace-dirent-path](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/fs/replace-dirent-path) + * **Replace `dirent.path` with `dirent.parentPath`** + * Replaces deprecated `dirent.path` property access with `dirent.parentPath` on `fs.Dirent` instances to address DEP0178 deprecation. +* [org.openrewrite.node.migrate.fs.replace-fs-access-constants](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/fs/replace-fs-access-constants) + * **Replace deprecated `fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK` with `fs.constants.*`** + * Replace deprecated file access constants (`fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK`) with their equivalents from `fs.constants`. These constants were removed in Node.js v24+ and should be accessed through the constants namespace. +* [org.openrewrite.node.migrate.fs.replace-fs-truncate-fd](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/fs/replace-fs-truncate-fd) + * **Replace `fs.truncate()` with file descriptor to `fs.ftruncate()`** + * Replace deprecated `fs.truncate(fd, ...)` and `fs.truncateSync(fd, ...)` calls with `fs.ftruncate(fd, ...)` and `fs.ftruncateSync(fd, ...)` when the first argument is a file descriptor (number). +* [org.openrewrite.node.migrate.fs.replace-stats-constructor](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/fs/replace-stats-constructor) + * **Replace deprecated `fs.Stats` constructor with object literal** + * Replace deprecated `new fs.Stats()` constructor calls with an object literal containing Stats properties initialized to undefined. +* [org.openrewrite.node.migrate.http.replace-outgoing-message-headers](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/http/replace-outgoing-message-headers) + * **Replace `OutgoingMessage._headers` and `._headerNames` with public methods** + * Replace deprecated `OutgoingMessage.prototype._headers` with `getHeaders()`, `setHeader()`, `removeHeader()` and `OutgoingMessage.prototype._headerNames` with `getHeaderNames()` to address DEP0066 deprecation. +* [org.openrewrite.node.migrate.increase-node-engine-version](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/increase-node-engine-version) + * **Increase Node.js engine version** + * Increases the upper bound of the `engines.node` version range in package.json to allow the specified Node.js version. +* [org.openrewrite.node.migrate.increase-node-engine-version-in-github-actions](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/increase-node-engine-version-in-github-actions) + * **Increase Node.js version in GitHub Actions** + * Increases `node-version` in `actions/setup-node` steps in GitHub Actions workflows. Only modifies plain major version values (e.g. `20`) and x-ranges (e.g. `20.x`). Never decreases the version. +* [org.openrewrite.node.migrate.net.remove-set-simultaneous-accepts](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/net/remove-set-simultaneous-accepts) + * **Remove deprecated `net._setSimultaneousAccepts()`** + * Remove calls to deprecated `net._setSimultaneousAccepts()` which was an undocumented internal function that is no longer necessary. +* [org.openrewrite.node.migrate.process.coerce-process-exit-code](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/process/coerce-process-exit-code) + * **Coerce `process.exit()` and `process.exitCode` to integer** + * Wraps non-integer values passed to `process.exit()` or assigned to `process.exitCode` with `Math.trunc()` to avoid the DEP0164 deprecation warning about implicit coercion to integer. +* [org.openrewrite.node.migrate.process.remove-usage-of-features-tls-underscore_constants](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/process/remove-usage-of-features-tls-underscore_constants) + * **Remove usage of deprecated `process.features.tls_*` properties** + * Remove references to deprecated `process.features.tls_*` properties, replace with `process.features.tls`. +* [org.openrewrite.node.migrate.stream.replace-internal-modules](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/stream/replace-internal-modules) + * **Replace deprecated `node:_stream_*` with `node:stream`** + * Replace deprecated internal stream module imports like `require('node:_stream_readable')` with the public `node:stream` module. +* [org.openrewrite.node.migrate.timers.find-timers-active](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/timers/find-timers-active) + * **Find deprecated `timers.active()` and `timers._unrefActive()` usage** + * `timers.active()` (DEP0126) and `timers._unrefActive()` (DEP0127) were deprecated and removed in Node.js 24. Use `timeout.refresh()` instead. +* [org.openrewrite.node.migrate.tls.find-tls-secure-pair](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/tls/find-tls-secure-pair) + * **Find deprecated `tls.SecurePair` and `tls.createSecurePair()` usage** + * `tls.SecurePair` (DEP0043) and `tls.createSecurePair()` (DEP0064) were deprecated and removed in Node.js 24. Use `tls.TLSSocket` instead. +* [org.openrewrite.node.migrate.tls.replace-internal-modules](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/tls/replace-internal-modules) + * **Replace deprecated `node:_tls_common` and `node:_tls_wrap` with `node:tls`** + * Replace deprecated internal TLS module imports `require('node:_tls_common')` and `require('node:_tls_wrap')` with the public `node:tls` module. +* [org.openrewrite.node.migrate.upgrade-node-22](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/upgrade-node-22) + * **Upgrade to Node.js 22** + * Migrate deprecated APIs for Node.js 22 compatibility. Addresses Node 22 runtime deprecations and deprecations from earlier versions. +* [org.openrewrite.node.migrate.upgrade-node-24](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/upgrade-node-24) + * **Upgrade to Node.js 24** + * Migrate deprecated APIs for Node.js 24 compatibility. Includes all migrations from Node.js 22, plus Node 23 and Node 24 deprecations. +* [org.openrewrite.node.migrate.util.remove-promisify-on-promise](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/remove-promisify-on-promise) + * **Remove unnecessary `util.promisify()` on Promise-returning functions** + * Removes `util.promisify()` calls on functions that already return a Promise. Since Node.js v17.0.0, calling promisify on a function that returns a Promise emits a runtime deprecation warning (DEP0174). +* [org.openrewrite.node.migrate.util.replace-is-webassembly-compiled-module](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/replace-is-webassembly-compiled-module) + * **Replace deprecated `util.types.isWebAssemblyCompiledModule()`** + * Replace `util.types.isWebAssemblyCompiledModule(value)` with `value instanceof WebAssembly.Module`. +* [org.openrewrite.node.migrate.util.replace-util-extend](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/replace-util-extend) + * **Replace deprecated `util._extend()` with `Object.assign()`** + * Replace deprecated `util._extend(target, source)` calls with `Object.assign(target, source)` which preserves the mutation behavior. +* [org.openrewrite.node.migrate.util.replace-util-log](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/replace-util-log) + * **Replace deprecated `util.log()` with `console.log()`** + * Replace deprecated `util.log()` calls with `console.log()`. Note: `util.log()` included timestamps, but `console.log()` does not. +* [org.openrewrite.node.migrate.util.use-native-type-checking-methods](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/util/use-native-type-checking-methods) + * **Replace deprecated `util.isX()` methods with native JavaScript** + * The `util` module's type-checking methods have been removed in Node 22. +* [org.openrewrite.node.migrate.zlib.replace-bytes-read](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/migrate/zlib/replace-bytes-read) + * **Replace deprecated `zlib.bytesRead` with `zlib.bytesWritten`** + * Replace deprecated `bytesRead` property on zlib streams with `bytesWritten`. +* [org.openrewrite.node.security.remove-redundant-overrides](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/node/security/remove-redundant-overrides) + * **Remove redundant dependency overrides** + * Removes overrides/resolutions from package.json that are redundant because the dependency tree already resolves to the overridden version or higher. * [org.openrewrite.nodejs.DependencyVulnerabilityCheck](https://docs.moderne.io/user-documentation/recipes/recipe-catalog/nodejs/dependencyvulnerabilitycheck) * **Find and fix vulnerable npm dependencies** * This software composition analysis (SCA) tool detects and upgrades dependencies with publicly disclosed vulnerabilities. This recipe both generates a report of vulnerable dependencies and upgrades to newer versions with fixes. This recipe **only** upgrades to the latest **patch** version. If a minor or major upgrade is required to reach the fixed version, this recipe will not make any changes. Vulnerability information comes from the [GitHub Security Advisory Database](https://docs.github.com/en/code-security/security-advisories/global-security-advisories/about-the-github-advisory-database), which aggregates vulnerability data from several public databases, including the [National Vulnerability Database](https://nvd.nist.gov/) maintained by the United States government. Dependencies following [Semantic Versioning](https://semver.org/) will see their _patch_ version updated where applicable.