Standalone Recipes
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: 1784
other
- A story should not have a redundant name property - A story should not have a redundant name property See rule details for storybook/no-redundant-story-name
- Add ASLv2 license header - Adds the Apache Software License Version 2.0 to Java source files which are missing a license header.
- Add WebLogic 15.1.1 PetClinic extras - Run migration extras for migrated Spring Framework PetClinic example run on WebLogic 15.1.1.
- Add explicit JAXB API dependencies and remove runtimes - This recipe will add explicit API dependencies without runtime dependencies for Jakarta EE 8 when a Java 8 application is using JAXB. Any existing API dependencies will be upgraded to the latest version of Jakarta EE 8. The artifacts are moved to Jakarta EE 8 version 2.x which allows for the continued use of the
javax.xml.bind
namespace. All JAXB runtime implementation dependencies are removed. - Add manual workflow trigger - You can manually trigger workflow runs. To trigger specific workflows in a repository, use the
workflow_dispatch
event. - Adds
DefaultTheme
module augmentation to typescript projects. - See Material UI codemod projects for more details. - Adopt
setLongThreadID
injava.util.logging.LogRecord
- Avoid using the deprecated methods injava.util.logging.LogRecord
- Adopt switch pattern matching (JEP 441) - ->- JEP 441 describes how some switch statements can be improved with pattern matching. This recipe applies some of those improvements where applicable.
- Apply Gradle best practices - Apply a set of Gradle best practices to the build files, for more efficient and ideomatic builds.
- ArchUnit 0.x upgrade - Upgrade ArchUnit from 0.x to 1.x.
- AssertJ best practices - Migrates JUnit asserts to AssertJ and applies best practices to assertions.
- Best practices for AWS - Securely operate on Amazon Web Services.
- Best practices for Azure - Securely operate on Microsoft Azure.
- Best practices for GCP - Securely operate on Google Cloud Platform.
- Change Maven and Gradle Java version property values to 17 - Change maven.compiler.source and maven.compiler.target values to 17.
- Change
net.wasdev.maven.parent:java8-parent
to:parent
- This recipe changes the artifactId of the<parent>
tag in thepom.xml
fromjava8-parent
toparent
. - Check for github-actions updates daily - Set dependabot to check for github-actions updates daily.
- Check for github-actions updates weekly - Set dependabot to check for github-actions updates weekly.
- Clean up various issues with the code. - Clean up the code.
- Code cleanup - Automatically cleanup code, e.g. remove unnecessary parentheses, simplify expressions.
- Combination of all deprecations - See Material UI codemod projects for more details.
- Common static analysis issues - Resolve common static analysis issues (also known as SAST issues).
- Convert Health Check Implementations - Transforms Dropwizard HealthCheck classes to Spring Boot HealthIndicator.
- Converts ExpansionPanel to use ExpansionPanel component - See Material UI codemod projects for more details.
- Converts GridList to use Grid component - See Material UI codemod projects for more details.
- Converts JSS styles to styled-components - See Material UI codemod projects for more details.
- Converts JSS to TypeScript in React components - See Material UI codemod projects for more details.
- Converts
rootRef
toref
- See Material UI codemod projects for more details. - Converts
sx
prop tosx
style prop - See Material UI codemod projects for more details. - Converts all
@mui/material
submodule imports to the root module - See Material UI codemod projects for more details. - Converts base imports to use React hooks - See Material UI codemod projects for more details.
- Converts components to use the v4 adapter module - See Material UI codemod projects for more details.
- Create Jenkinsfile - Creates a simple base Jenkinsfile in Groovy for a Declarative Pipeline - located in the root of the project.
- Deprecated hierarchy separator in title property - Deprecated hierarchy separator in title property See rule details for storybook/hierarchy-separator
- DevCenter - This is a default DevCenter configuration that can be used as a starting point for your own DevCenter configuration. It includes a combination of upgrades, migrations, and security fixes. You can customize this configuration to suit your needs. For more information on how to customize your DevCenter configuration, see the DevCenter documentation.
- Disallow Jasmine globals - Disallow Jasmine globals See rule details for jest/no-jasmine-globals
- Disallow
new Array()
. - Disallownew Array()
. See rule details - Disallow
parseInt()
andNumber.parseInt()
in favor of binary, octal, and hexadecimal literals - DisallowparseInt()
andNumber.parseInt()
in favor of binary, octal, and hexadecimal literals See rule details - Disallow alias methods - Disallow alias methods See rule details for jest/no-alias-methods
- Disallow arrow functions where they could be confused with comparisons - Disallow arrow functions where they could be confused with comparisons See rule details
- Disallow awaiting non-promise values. - Disallow awaiting non-promise values. See rule details
- Disallow classes that only have static members. - Disallow classes that only have static members. See rule details
- Disallow comparing
undefined
usingtypeof
. - Disallow comparingundefined
usingtypeof
. See rule details - Disallow else blocks after return statements in if statements - Disallow else blocks after return statements in if statements See rule details
- Disallow equal signs explicitly at the beginning of regular expressions - Disallow equal signs explicitly at the beginning of regular expressions See rule details
- Disallow extra closing tags for components without children - Disallow extra closing tags for components without children See rule details for react/self-closing-comp
- Disallow extra closing tags for components without children - Disallow extra closing tags for components without children See rule details
- Disallow if statements as the only statement in else blocks - Disallow if statements as the only statement in else blocks See rule details
- Disallow initializing variables to undefined - Disallow initializing variables to undefined See rule details
- Disallow leading or trailing decimal points in numeric literals - Disallow leading or trailing decimal points in numeric literals See rule details
- Disallow member access from
await
expression. - Disallow member access fromawait
expression. See rule details - Disallow missing parentheses around multiline JSX - Disallow missing parentheses around multiline JSX See rule details for react/jsx-wrap-multilines
- Disallow missing parentheses around multiline JSX - Disallow missing parentheses around multiline JSX See rule details
- Disallow multiple empty lines - Disallow multiple empty lines See rule details
- Disallow multiple spaces - Disallow multiple spaces See rule details
- Disallow multiple spaces between inline JSX props - Disallow multiple spaces between inline JSX props See rule details for react/jsx-props-no-multi-spaces
- Disallow multiple spaces between inline JSX props - Disallow multiple spaces between inline JSX props See rule details
- Disallow negated conditions. - Disallow negated conditions. See rule details
- Disallow nested ternary expressions. - Disallow nested ternary expressions. See rule details
- Disallow number literals with zero fractions or dangling dots. - Disallow number literals with zero fractions or dangling dots. See rule details
- Disallow or enforce spaces inside of blocks after opening block and before closing block - Disallow or enforce spaces inside of blocks after opening block and before closing block See rule details
- Disallow or enforce spaces inside of blocks after opening block and before closing block in
<template>
- Disallow or enforce spaces inside of blocks after opening block and before closing block in<template>
See rule details for vue/block-spacing - Disallow problematic leaked values from being rendered - Disallow problematic leaked values from being rendered See rule details for react/jsx-no-leaked-render
- Disallow redundant return statements - Disallow redundant return statements See rule details
- Disallow renaming import, export, and destructured assignments to the same name - Disallow renaming import, export, and destructured assignments to the same name See rule details
- Disallow returning/yielding
Promise.resolve()
/reject()
inasync
functions or promise callbacks. - Disallow returning/yieldingPromise.resolve()
/reject()
inasync
functions or promise callbacks. See rule details - Disallow shorthand type conversions - Disallow shorthand type conversions See rule details
- Disallow target="_blank" attribute without rel="noreferrer" - _Disallow target="blank" attribute without rel="noreferrer" See rule details for react/jsx-no-target-blank
- Disallow ternary operators when simpler alternatives exist - Disallow ternary operators when simpler alternatives exist See rule details
- Disallow the use of
Math.pow
in favor of the ** operator - Disallow the use ofMath.pow
in favor of the ** operator See rule details - Disallow the use of the
null
literal. - Disallow the use of thenull
literal. See rule details - Disallow trailing whitespace at the end of lines - Disallow trailing whitespace at the end of lines See rule details
- Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes - Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes See rule details for react/jsx-curly-brace-presence
- Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes - Disallow unnecessary JSX expressions when literals alone are sufficient or enforce JSX expressions on literals in JSX children or attributes See rule details
- Disallow unnecessary calls to
.bind()
- Disallow unnecessary calls to.bind()
See rule details - Disallow unnecessary computed property keys in objects and classes - Disallow unnecessary computed property keys in objects and classes See rule details
- Disallow unnecessary fragments - Disallow unnecessary fragments See rule details for react/jsx-no-useless-fragment
- Disallow unnecessary labels - Disallow unnecessary labels See rule details
- Disallow unnecessary mustache interpolations - Disallow unnecessary mustache interpolations See rule details for vue/no-useless-mustaches
- Disallow unnecessary parentheses - Disallow unnecessary parentheses See rule details
- Disallow unnecessary parentheses in
<template>
- Disallow unnecessary parentheses in<template>
See rule details for vue/no-extra-parens - Disallow unnecessary semicolons - Disallow unnecessary semicolons See rule details
- Disallow unnecessary spread. - Disallow unnecessary spread. See rule details
- Disallow unnecessary v-bind directives - Disallow unnecessary v-bind directives See rule details for vue/no-useless-v-bind
- Disallow unreadable array destructuring. - Disallow unreadable array destructuring. See rule details
- Disallow unsupported Vue.js syntax on the specified version - Disallow unsupported Vue.js syntax on the specified version See rule details for vue/no-unsupported-features
- Disallow usage of this in template - Disallow usage of this in template See rule details for vue/this-in-template
- Disallow usage of unknown DOM property - Disallow usage of unknown DOM property See rule details for react/no-unknown-property
- Disallow use of
Object.prototype.hasOwnProperty.call()
and prefer use ofObject.hasOwn(
) - Disallow use ofObject.prototype.hasOwnProperty.call()
and prefer use ofObject.hasOwn(
) See rule details - Disallow use of deprecated functions from before version 27 - Disallow use of deprecated functions from before version 27 See rule details for jest/no-deprecated-functions
- Disallow useless
undefined
. - Disallow uselessundefined
. See rule details - Disallow useless array
length
check. - Disallow useless arraylength
check. See rule details - Disallow useless fallback when spreading in object literals. - Disallow useless fallback when spreading in object literals. See rule details
- Disallow using
Object.assign
with an object literal as the first argument and prefer the use of object spread instead - Disallow usingObject.assign
with an object literal as the first argument and prefer the use of object spread instead See rule details - Disallow using jest.mock() factories without an explicit type parameter - Disallow using jest.mock() factories without an explicit type parameter See rule details for jest/no-untyped-mock-factory
- Disallow using the
this
argument in array methods. - Disallow using thethis
argument in array methods. See rule details - Disallow whitespace before properties - Disallow whitespace before properties See rule details
- Do not define a title in meta - Do not define a title in meta See rule details for storybook/no-title-property-in-meta
- Do not use a
for
loop that can be replaced with afor-of
loop. - Do not use afor
loop that can be replaced with afor-of
loop. See rule details - Do not use leading/trailing space between
console.log
parameters. - Do not use leading/trailing space betweenconsole.log
parameters. See rule details - Do not use testing-library directly on stories - Do not use testing-library directly on stories See rule details for storybook/use-storybook-testing-library
- Enforce JSX indentation - Enforce JSX indentation See rule details for react/jsx-indent
- Enforce JSX indentation - Enforce JSX indentation See rule details
- Enforce PascalCase for user-defined JSX components - Enforce PascalCase for user-defined JSX components See rule details
- Enforce Promise or callback style in nextTick - Enforce Promise or callback style in nextTick See rule details for vue/next-tick-style
- Enforce a convention in module import order - Enforce a convention in module import order See rule details for import/order
- Enforce a newline after import statements - Enforce a newline after import statements See rule details for import/newline-after-import
- Enforce a particular style for multiline comments - Enforce a particular style for multiline comments See rule details
- Enforce a specific function type for function components - Enforce a specific function type for function components See rule details for react/function-component-definition
- Enforce a specific parameter name in catch clauses. - Enforce a specific parameter name in catch clauses. See rule details
- Enforce better string content. - Enforce better string content. See rule details
- Enforce boolean attributes notation in JSX - Enforce boolean attributes notation in JSX See rule details for react/jsx-boolean-value
- Enforce closing bracket location in JSX - Enforce closing bracket location in JSX See rule details for react/jsx-closing-bracket-location
- Enforce closing bracket location in JSX - Enforce closing bracket location in JSX See rule details
- Enforce closing tag location for multiline JSX - Enforce closing tag location for multiline JSX See rule details for react/jsx-closing-tag-location
- Enforce closing tag location for multiline JSX - Enforce closing tag location for multiline JSX See rule details
- Enforce combining multiple
Array#push()
into one call. - Enforce combining multipleArray#push()
into one call. See rule details - Enforce consistent brace style for all control statements - Enforce consistent brace style for all control statements See rule details
- Enforce consistent brace style for blocks - Enforce consistent brace style for blocks See rule details
- Enforce consistent brace style for blocks in
<template>
- Enforce consistent brace style for blocks in<template>
See rule details for vue/brace-style - Enforce consistent brace style for case clauses. - Enforce consistent brace style for case clauses. See rule details
- Enforce consistent case for text encoding identifiers. - Enforce consistent case for text encoding identifiers. See rule details
- Enforce consistent comma style - Enforce consistent comma style See rule details
- Enforce consistent comma style in
<template>
- Enforce consistent comma style in<template>
See rule details for vue/comma-style - Enforce consistent indentation - Enforce consistent indentation See rule details
- Enforce consistent indentation in HTML comments - Enforce consistent indentation in HTML comments See rule details for vue/html-comment-indent
- Enforce consistent indentation in
<script>
- Enforce consistent indentation in<script>
See rule details for vue/script-indent - Enforce consistent line breaks after opening and before closing braces - Enforce consistent line breaks after opening and before closing braces See rule details
- Enforce consistent line breaks after opening and before closing braces in
<template>
- Enforce consistent line breaks after opening and before closing braces in<template>
See rule details for vue/object-curly-newline - Enforce consistent line breaks inside function parentheses - Enforce consistent line breaks inside function parentheses See rule details
- Enforce consistent linebreak style - Enforce consistent linebreak style See rule details
- Enforce consistent linebreak style for operators - Enforce consistent linebreak style for operators See rule details
- Enforce consistent linebreak style for operators in
<template>
- Enforce consistent linebreak style for operators in<template>
See rule details for vue/operator-linebreak - Enforce consistent linebreaks in curly braces in JSX attributes and expressions - Enforce consistent linebreaks in curly braces in JSX attributes and expressions See rule details for react/jsx-curly-newline
- Enforce consistent linebreaks in curly braces in JSX attributes and expressions - Enforce consistent linebreaks in curly braces in JSX attributes and expressions See rule details
- Enforce consistent newlines before and after dots - Enforce consistent newlines before and after dots See rule details
- Enforce consistent newlines before and after dots in
<template>
- Enforce consistent newlines before and after dots in<template>
See rule details for vue/dot-location - Enforce consistent relative URL style. - Enforce consistent relative URL style. See rule details
- Enforce consistent spacing after the `//` or `/*` in a comment - Enforce consistent spacing after the `//` or `/*` in a comment See rule details
- Enforce consistent spacing around `*` operators in generator functions - Enforce consistent spacing around `*` operators in generator functions See rule details
- Enforce consistent spacing before `function` definition opening parenthesis - Enforce consistent spacing before `function` definition opening parenthesis See rule details
- Enforce consistent spacing before and after commas - Enforce consistent spacing before and after commas See rule details
- Enforce consistent spacing before and after commas in
<template>
- Enforce consistent spacing before and after commas in<template>
See rule details for vue/comma-spacing - Enforce consistent spacing before and after keywords - Enforce consistent spacing before and after keywords See rule details
- Enforce consistent spacing before and after keywords in
<template>
- Enforce consistent spacing before and after keywords in<template>
See rule details for vue/keyword-spacing - Enforce consistent spacing before and after semicolons - Enforce consistent spacing before and after semicolons See rule details
- Enforce consistent spacing before and after the arrow in arrow functions - Enforce consistent spacing before and after the arrow in arrow functions See rule details
- Enforce consistent spacing before and after the arrow in arrow functions in
<template>
- Enforce consistent spacing before and after the arrow in arrow functions in<template>
See rule details for vue/arrow-spacing - Enforce consistent spacing before blocks - Enforce consistent spacing before blocks See rule details
- Enforce consistent spacing before or after unary operators - Enforce consistent spacing before or after unary operators See rule details
- Enforce consistent spacing before or after unary operators in
<template>
- Enforce consistent spacing before or after unary operators in<template>
See rule details for vue/space-unary-ops - Enforce consistent spacing between keys and values in object literal properties - Enforce consistent spacing between keys and values in object literal properties See rule details
- Enforce consistent spacing between keys and values in object literal properties in
<template>
- Enforce consistent spacing between keys and values in object literal properties in<template>
See rule details for vue/key-spacing - Enforce consistent spacing inside array brackets - Enforce consistent spacing inside array brackets See rule details
- Enforce consistent spacing inside array brackets in
<template>
- Enforce consistent spacing inside array brackets in<template>
See rule details for vue/array-bracket-spacing - Enforce consistent spacing inside braces - Enforce consistent spacing inside braces See rule details
- Enforce consistent spacing inside braces in
<template>
- Enforce consistent spacing inside braces in<template>
See rule details for vue/object-curly-spacing - Enforce consistent spacing inside computed property brackets - Enforce consistent spacing inside computed property brackets See rule details
- Enforce consistent spacing inside parentheses - Enforce consistent spacing inside parentheses See rule details
- Enforce consistent spacing inside parentheses in
<template>
- Enforce consistent spacing inside parentheses in<template>
See rule details for vue/space-in-parens - Enforce consistent usage of destructuring assignment of props, state, and context - Enforce consistent usage of destructuring assignment of props, state, and context See rule details for react/destructuring-assignment
- Enforce correct
Error
subclassing. - Enforce correctError
subclassing. See rule details - Enforce dot notation whenever possible - Enforce dot notation whenever possible See rule details
- Enforce dot notation whenever possible in
<template>
- Enforce dot notation whenever possible in<template>
See rule details for vue/dot-notation - Enforce explicitly comparing the length or size property of a value. - Enforce explicitly comparing the length or size property of a value. See rule details
- Enforce line breaks after each array element - Enforce line breaks after each array element See rule details
- Enforce line breaks after each array element in
<template>
- Enforce line breaks after each array element in<template>
See rule details for vue/array-element-newline - Enforce line breaks after opening and before closing block-level tags - Enforce line breaks after opening and before closing block-level tags See rule details for vue/block-tag-newline
- Enforce line breaks between arguments of a function call - Enforce line breaks between arguments of a function call See rule details
- Enforce linebreaks after opening and before closing array brackets - Enforce linebreaks after opening and before closing array brackets See rule details
- Enforce linebreaks after opening and before closing array brackets in
<template>
- Enforce linebreaks after opening and before closing array brackets in<template>
See rule details for vue/array-bracket-newline - Enforce location of semicolons - Enforce location of semicolons See rule details
- Enforce lowercase test names - Enforce lowercase test names See rule details for jest/prefer-lowercase-title
- Enforce maximum of props on a single line in JSX - Enforce maximum of props on a single line in JSX See rule details for react/jsx-max-props-per-line
- Enforce maximum of props on a single line in JSX - Enforce maximum of props on a single line in JSX See rule details
- Enforce new lines between multi-line properties in Vue components - Enforce new lines between multi-line properties in Vue components See rule details for vue/new-line-between-multi-line-property
- Enforce newlines between operands of ternary expressions - Enforce newlines between operands of ternary expressions See rule details
- Enforce newlines between operands of ternary expressions in
<template>
- Enforce newlines between operands of ternary expressions in<template>
See rule details for vue/multiline-ternary - Enforce no spaces between braces. - Enforce no spaces between braces. See rule details
- Enforce or ban the use of inline type-only markers for named imports - Enforce or ban the use of inline type-only markers for named imports See rule details for import/consistent-type-specifier-style
- Enforce or disallow capitalization of the first letter of a comment - Enforce or disallow capitalization of the first letter of a comment See rule details
- Enforce or disallow parentheses when invoking a constructor with no arguments - Enforce or disallow parentheses when invoking a constructor with no arguments See rule details
- Enforce or disallow spaces around equal signs in JSX attributes - Enforce or disallow spaces around equal signs in JSX attributes See rule details for react/jsx-equals-spacing
- Enforce or disallow spaces around equal signs in JSX attributes - Enforce or disallow spaces around equal signs in JSX attributes See rule details
- Enforce or disallow spaces inside of curly braces in JSX attributes and expressions - Enforce or disallow spaces inside of curly braces in JSX attributes and expressions See rule details for react/jsx-curly-spacing
- Enforce or disallow spaces inside of curly braces in JSX attributes and expressions - Enforce or disallow spaces inside of curly braces in JSX attributes and expressions See rule details
- Enforce order of attributes - Enforce order of attributes See rule details for vue/attributes-order
- Enforce order of component top-level elements - Enforce order of component top-level elements See rule details for vue/component-tags-order
- Enforce order of component top-level elements - Enforce order of component top-level elements See rule details for vue/block-order
- Enforce order of defineEmits and defineProps compiler macros - Enforce order of defineEmits and defineProps compiler macros See rule details for vue/define-macros-order
- Enforce order of properties in components - Enforce order of properties in components See rule details for vue/order-in-components
- Enforce placing object properties on separate lines - Enforce placing object properties on separate lines See rule details
- Enforce placing object properties on separate lines in
<template>
- Enforce placing object properties on separate lines in<template>
See rule details for vue/object-property-newline - Enforce propTypes declarations alphabetical sorting - Enforce propTypes declarations alphabetical sorting See rule details for react/sort-prop-types
- Enforce proper case for numeric literals. - Enforce proper case for numeric literals. See rule details
- Enforce proper position of the first property in JSX - Enforce proper position of the first property in JSX See rule details for react/jsx-first-prop-new-line
- Enforce proper position of the first property in JSX - Enforce proper position of the first property in JSX See rule details
- Enforce props alphabetical sorting - Enforce props alphabetical sorting See rule details for react/jsx-sort-props
- Enforce props alphabetical sorting - Enforce props alphabetical sorting See rule details
- Enforce props indentation in JSX - Enforce props indentation in JSX See rule details for react/jsx-indent-props
- Enforce props indentation in JSX - Enforce props indentation in JSX See rule details
- Enforce props with default values to be optional - Enforce props with default values to be optional See rule details for vue/no-required-prop-with-default
- Enforce shorthand or standard form for React fragments - Enforce shorthand or standard form for React fragments See rule details for react/jsx-fragments
- Enforce sorted import declarations within modules - Enforce sorted import declarations within modules See rule details
- Enforce spacing around colons of switch statements - Enforce spacing around colons of switch statements See rule details
- Enforce spacing before closing bracket in JSX - Enforce spacing before closing bracket in JSX See rule details for react/jsx-space-before-closing
- Enforce spacing between rest and spread operators and their expressions - Enforce spacing between rest and spread operators and their expressions See rule details
- Enforce specific casing for the component naming style in template - Enforce specific casing for the component naming style in template See rule details for vue/component-name-in-template-casing
- Enforce static class names order - Enforce static class names order See rule details for vue/static-class-names-order
- Enforce test and it usage conventions - Enforce test and it usage conventions See rule details for jest/consistent-test-it
- Enforce that props are read-only - Enforce that props are read-only See rule details for react/prefer-read-only-props
- Enforce the casing of component name in components options - Enforce the casing of component name in components options See rule details for vue/component-options-name-casing
- Enforce the consistent use of either backticks, double, or single quotes - Enforce the consistent use of either backticks, double, or single quotes See rule details
- Enforce the consistent use of either double or single quotes in JSX attributes - Enforce the consistent use of either double or single quotes in JSX attributes See rule details
- Enforce the location of arrow function bodies - Enforce the location of arrow function bodies See rule details
- Enforce the location of single-line statements - Enforce the location of single-line statements See rule details
- Enforce the style of numeric separators by correctly grouping digits. - Enforce the style of numeric separators by correctly grouping digits. See rule details
- Enforce the use of Unicode escapes instead of hexadecimal escapes. - Enforce the use of Unicode escapes instead of hexadecimal escapes. See rule details
- Enforce the use of
Buffer.from()
andBuffer.alloc()
instead of the deprecatednew Buffer()
. - Enforce the use ofBuffer.from()
andBuffer.alloc()
instead of the deprecatednew Buffer()
. See rule details - Enforce the use of
Math.trunc()
instead of bitwise operators. - Enforce the use ofMath.trunc()
instead of bitwise operators. See rule details - Enforce the use of
new
for all builtins, exceptString
,Number
,Boolean
,Symbol
, andBigInt
. - Enforce the use ofnew
for all builtins, exceptString
,Number
,Boolean
,Symbol
, andBigInt
. See rule details - Enforce throwing
TypeError
in type checking conditions. - Enforce throwingTypeError
in type checking conditions. See rule details - Enforce unified line brake in HTML comments - Enforce unified line brake in HTML comments See rule details for vue/html-comment-content-newline
- Enforce unified spacing in HTML comments - Enforce unified spacing in HTML comments See rule details for vue/html-comment-content-spacing
- Enforce use of defineOptions instead of default export. - Enforce use of defineOptions instead of default export. See rule details for vue/prefer-define-options
- Enforce using the digits argument with
Number#toFixed()
. - Enforce using the digits argument withNumber#toFixed()
. See rule details - Enforce using the separator argument with
Array#join()
. - Enforce using the separator argument withArray#join()
. See rule details - Enforce v-for directive's delimiter style - Enforce v-for directive's delimiter style See rule details for vue/v-for-delimiter-style
- Enforce valid titles - Enforce valid titles See rule details for jest/valid-title
- Enforce variables to be declared either together or separately in functions - Enforce variables to be declared either together or separately in functions See rule details
- Enforce whitespace in and around the JSX opening and closing brackets - Enforce whitespace in and around the JSX opening and closing brackets See rule details for react/jsx-tag-spacing
- Enforce whitespace in and around the JSX opening and closing brackets - Enforce whitespace in and around the JSX opening and closing brackets See rule details
- Enforce writing style for handlers in v-on directives - Enforce writing style for handlers in v-on directives See rule details for vue/v-on-handler-style
- Enforces consistent spacing inside TypeScript type generics - Enforces consistent spacing inside TypeScript type generics See rule details
- Ensure Web App has incoming client certificates enabled - Ensure Web App has incoming client certificates enabled.
- Ensure all imports appear before other statements - Ensure all imports appear before other statements See rule details for import/first
- Ensure app services use Azure files - Ensure app services use Azure files.
- Ensure key vault key is backed by HSM - Ensure key vault key is backed by HSM.
- Ensure the S3 bucket has access logging enabled - Ensure the S3 bucket has access logging enabled.
- Ensures presets are safe to use - See Material UI codemod projects for more details.
- Expect space before the type declaration in the named tuple - Expect space before the type declaration in the named tuple See rule details
- Find GitHub action secret references - Help identify and inventory your GitHub secrets that are being used in GitHub actions.
- Find Gradle
dependencies
blocks - Find the dependency handler containing any number of dependency definitions. - Find Spring Web dependency - Find compile scoped Spring Web dependency for Maven and Gradle, both direct and transitive.
- Find Virtual Thread opportunities - Find opportunities to convert existing code to use Virtual Threads.
- Find hardcoded IP addresses - Find hardcoded IP address anywhere in text-based files.
- Find patterns that require updating for Spring Boot 2.5 - Looks for a series of patterns that have not yet had auto-remediation recipes developed for.
- Find plain text secrets - Find secrets stored in plain text in code.
- Find privileged
resource_type
definitions. - By default,resource_type
definitions are unprivileged. - Find secrets - Locates secrets stored in plain text in code.
- Fix mis-encoded French comments, javadocs and pom.xml comments - Fixes mis-encoded French comments in your code, javadocs and in your pom.xml files. Mis-encoded comments contain a ? or � character.
- Fix whitespace-insensitive template indentation. - Fix whitespace-insensitive template indentation. See rule details
- Forbid empty named import - Forbid empty named import See rule details for import/no-empty-named-blocks
- Forbid import of modules using absolute paths - Forbid import of modules using absolute paths See rule details for import/no-absolute-path
- Forbid import statements with CommonJS module.exports - Forbid import statements with CommonJS module.exports See rule details for import/no-import-module-exports
- Forbid importing packages through relative paths - Forbid importing packages through relative paths See rule details for import/no-relative-packages
- Forbid namespace (a.k.a. "wildcard"
*
) imports. - Forbid namespace (a.k.a. "wildcard"*
) imports. See rule details for import/no-namespace - Forbid repeated import of the same module in multiple places - Forbid repeated import of the same module in multiple places See rule details for import/no-duplicates
- Forbid unnecessary path segments in import and require statements - Forbid unnecessary path segments in import and require statements See rule details for import/no-useless-path-segments
- Format TypeScript using ESLint Prettier plugin - Formats all TypeScript source code using the ESLint Prettier plugin.
- Improve regexes by making them shorter, consistent, and safer. - Improve regexes by making them shorter, consistent, and safer. See rule details
- Indentation for binary operators - Indentation for binary operators See rule details
- Interactions should be awaited - Interactions should be awaited See rule details for storybook/await-interactions
- JSpecify best practices - Apply JSpecify best practices, such as migrating off of alternatives, and adding missing
@Nullable
annotations. - Jackson best practices - Apply best practices for using Jackson library, including upgrade to Jackson 2.x and removing redundant annotations.
- Java API best practices - Use the Java standard library in a way that is most idiomatic.
- Java security best practices - Applies security best practices to Java code.
- Javascript UI library insights - Discover which popular javascript UI libraries (React, Vue.js, Angular, etc.) are being used in your projects.
- Javascript database interaction library insights - Discover which popular javascript database interaction libraries (Sequelize, TypeORM, Mongoose, etc.) are being used in your projects.
- Javascript form handling library insights - Discover which popular javascript form handling libraries (Formik, React Hook Form, Yup, etc.) are being used in your projects.
- Javascript linting & formatting library insights - Discover which popular javascript linting and formatting libraries (ESLint, Prettier, Stylelint, etc.) are being used in your projects.
- Javascript real-time communication library insights - Discover which popular javascript real-time communication libraries (Socket.io, Ws, SockJS, etc.) are being used in your projects.
- Javascript security library insights - Discover which popular javascript security libraries (Helmet, Cors, Bcrypt, etc.) are being used in your projects.
- Javascript server-side frameworks insights - Discover which popular javascript server-side frameworks (Express, Koa, Hapi, etc.) are being used in your projects.
- Javascript state management library insights - Discover which popular javascript state management libraries (Redux, MobX, Vuex, etc.) are being used in your projects.
- Javascript task runners & build tools insights - Discover which popular javascript task runners and build tools (Webpack, Parcel, Gulp, etc.) are being used in your projects.
- Javascript testing library insights - Discover which popular javascript testing libraries (Jest, Mocha, Chai, etc.) are being used in your projects.
- Javascript utility library insights - Discover which popular javascript utility libraries (Lodash, Moment.js, Date-fns, etc.) are being used in your projects.
- Kubernetes best practices - Applies best practices to Kubernetes manifests.
- Lifecycle methods should be methods on the prototype, not class fields - Lifecycle methods should be methods on the prototype, not class fields See rule details for react/no-arrow-function-lifecycle
- Lint TypeScript code using ESLint - The default config includes the
@typescript-eslint
plugin and the correspondingplugin:@typescript-eslint/recommended
extend. - Lombok Best Practices - Applies all recipes that enforce best practices for using Lombok.
- Migrate Apache Commons Logging 1.x to SLF4J 1.x - Transforms usages of Apache Commons Logging 1.x to leveraging SLF4J 1.x directly.
- Migrate Dropwizard to Spring Boot - Apply various changes to migrate Dropwizard applications to Spring Boot.
- Migrate Hamcrest assertions to JUnit Jupiter - Migrate Hamcrest
assertThat(..)
to JUnit JupiterAssertions
. - Migrate JCL to Log4j 2.x API - Transforms code written using Apache Commons Logging to use Log4j 2.x API.
- Migrate JUL to SLF4J - Migrates usage of Java Util Logging (JUL) to using SLF4J directly.
- Migrate Jackson from javax to jakarta namespace - Java EE has been rebranded to Jakarta EE. This recipe replaces existing Jackson dependencies with their counterparts that are compatible with Jakarta EE.
- Migrate JavaEE to Quarkus 2 - These recipes help with the migration of a JavaEE application using EJBs and Hibernate to Quarkus 2. Additional transformations like JSF, JMS, Quarkus Tests may be necessary.
- Migrate Log4j 2.x to Logback - Migrates usage of Apache Log4j 2.x to using
logback
as an SLF4J implementation directly. Note, this currently does not modifylog4j.properties
files. - Migrate Misk metrics to Micrometer - This recipe will move Misk metrics to Micrometer, where that is possible to do without a loss of fidelity.
- Migrate RestAssured from javax to jakarta namespace by upgrading to a version compatible with J2EE9 - Java EE has been rebranded to Jakarta EE. This recipe replaces existing RestAssured dependencies with their counterparts that are compatible with Jakarta EE.
- Migrate SAP cloud foundry logging support to Spring Boot 3.x - Migrate SAP cloud foundry logging support from
cf-java-logging-support-servlet
tocf-java-logging-support-servlet-jakarta
, to use Jakarta with Spring Boot 3. - Migrate SLF4J to Log4j 2.x API - Transforms code written using SLF4J to use Log4j 2.x API.
- Migrate Spring to Spring Boot - Migrate non Spring Boot applications to the latest compatible Spring Boot release. This recipe will modify an application's build files introducing Maven dependency management for Spring Boot, or adding the Gradle Spring Boot build plugin.
- Migrate
camel3
application tocamel4.
- Migratecamel3
quarkus application tocamel4
quarkus. - Migrate
javax.annotations
to SpotBugs annotations - SpotBugs is the preferred replacement of JSR-305 annotations for Jenkins plugins. - Migrate
web.xml
to Java Configuration - Migratesweb.xml
content to Spring Boot Configuration classes with respect to Java EE or Jakarta EE usage. - Migrate com.intellij:annotations to org.jetbrains:annotations - This recipe will upgrade old dependency of com.intellij:annotations to the newer org.jetbrains:annotations.
- Migrate deprecated
javax.activation
packages tojakarta.activation
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.annotation
packages tojakarta.annotation
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.batch
packages tojakarta.batch
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.decorator
packages tojakarta.decorator
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.ejb
packages tojakarta.ejb
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.el
packages tojakarta.el
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.enterprise
packages tojakarta.enterprise
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.faces
packages tojakarta.faces
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.inject
packages tojakarta.inject
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.interceptor
packages tojakarta.interceptor
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.jms
packages tojakarta.jms
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.json
packages tojakarta.json
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.jws
packages tojakarta.jws
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.mail
packages tojakarta.mail
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.persistence
packages tojakarta.persistence
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation - Migrate deprecated
javax.resource
packages tojakarta.resource
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.security.auth.message
packages tojakarta.security.auth.message
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.security.enterprise
packages tojakarta.security.enterprise
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.security.jacc
packages tojakarta.security.jacc
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.servlet
packages tojakarta.servlet
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.soap
packages tojakarta.soap
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.transaction
packages tojakarta.transaction
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.validation
packages tojakarta.validation
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.websocket
packages tojakarta.websocket
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.ws
packages tojakarta.ws
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.xml.bind
packages tojakarta.xml.bind
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate deprecated
javax.xml.ws
packages tojakarta.xml.ws
- Java EE has been rebranded to Jakarta EE, necessitating a package relocation. - Migrate from EasyMock to Mockito - This recipe will apply changes commonly needed when migrating from EasyMock to Mockito.
- Migrate from IBM Runtimes to Oracle Runtimes - This recipe will apply changes commonly needed when upgrading Java versions. The solutions provided in this list are solutions necessary for migrating from IBM Runtimes to Oracle Runtimes.
- Migrate from JMockit to Mockito - This recipe will apply changes commonly needed when migrating from JMockit to Mockito.
- Migrate from Jackson Codehaus (legacy) to Jackson FasterXML - In Jackson 2, the package and dependency coordinates moved from Codehaus to FasterXML.
- Migrate from Java Faker to Datafaker - Change imports and dependencies related to Java Faker to Datafaker replacements.
- Migrate from Micronaut 2.x to 3.x - This recipe will apply changes required for migrating from Micronaut 2 to Micronaut 3.
- Migrate from Micronaut 3.x to 4.x - This recipe will apply changes required for migrating from Micronaut 3 to Micronaut 4.
- Migrate from OpenJPA to EclipseLink JPA - These recipes help migrate Java Persistence applications using OpenJPA to EclipseLink JPA.
- Migrate from Spring Framework annotations to JSpecify - Migrate from Spring Framework annotations to JSpecify.
- Migrate from WebSphere traditional to Liberty - Use this category of rules to identify code changes needed when migrating from WebSphere Application Server traditional to Liberty.
- Migrate from the AWS SDK for Java v1 to the AWS SDK for Java v2 - This recipe will apply changes required for migrating from the AWS SDK for Java v1 to the AWS SDK for Java v2.
- Migrate from the AWS SDK for Java v1 to the AWS SDK for Java v2 including S3 Transfer Manager. - This recipe will apply changes required for migrating from the AWS SDK for Java v1 to the AWS SDK for Java v2, including S3 Transfer Manager. Transforms for Transfer Manager are incomplete and in-progress.
- Migrate the use of TaskExecutors with blocking IO - This recipe will any usage of TaskExecutors.IO to TaskExecutors.BLOCKING in order to be compatible with virtual threads.
- Migrate to 4.12.1 - Migrates Apache Camel application to 4.12.1
- Migrate to Android Gradle Plugin 7.3 - Recipes to migrate to Android Gradle Plugin version 7.3.
- Migrate to Android Gradle Plugin 7.4 - Recipes to migrate to Android Gradle Plugin version 7.4.
- Migrate to Android Gradle Plugin 8.0 - Recipes to migrate to Android Gradle Plugin version 8.0.
- Migrate to Android Gradle Plugin 8.2 - Recipes to migrate to Android Gradle Plugin version 8.2.
- Migrate to Android Gradle Plugin 8.3 - Recipes to migrate to Android Gradle Plugin version 8.3.
- Migrate to Android Gradle Plugin 8.4 - Recipes to migrate to Android Gradle Plugin version 8.4.
- Migrate to Android Gradle Plugin 8.5 - Recipes to migrate to Android Gradle Plugin version 8.5.
- Migrate to Android Gradle Plugin 8.7 - Recipes to migrate to Android Gradle Plugin version 8.7.
- Migrate to Hibernate 7.0.x - This recipe will apply changes commonly needed when migrating to Hibernate 7.0.x.
- Migrate to Hibernate Validator 8.0.x - This recipe will apply changes commonly needed when migrating to Hibernate Validator 8.0.x.
- Migrate to Hibernate for Jakarta EE 9 - Upgrade hibernate libraries to Jakarta EE9 versions.
- Migrate to IBM Semeru Runtimes - This recipe will apply changes commonly needed when upgrading Java versions. The solutions provided in this list are solutions only available in IBM Semeru Runtimes.
- Migrate to Jakarta EE 11 - These recipes help with the Migration to Jakarta EE 11, flagging and updating deprecated methods.
- Migrate to Jakarta EE 9.1 - These recipes help with Migration to Jakarta EE 9.1, flagging and updating deprecated methods.
- Migrate to Java 17 - This recipe will apply changes commonly needed when migrating to Java 17. Specifically, for those applications that are built on Java 8, this recipe will update and add dependencies on J2EE libraries that are no longer directly bundled with the JDK. This recipe will also replace deprecated API with equivalents when there is a clear migration strategy. Build files will also be updated to use Java 17 as the target/source and plugins will be also be upgraded to versions that are compatible with Java 17.
- Migrate to Java 25 - This recipe will apply changes commonly needed when migrating to Java 25. This recipe will also replace deprecated API with equivalents when there is a clear migration strategy. Build files will also be updated to use Java 25 as the target/source and plugins will be also be upgraded to versions that are compatible with Java 25.
- Migrate to Kubernetes API v1.32 - This recipe will apply changes commonly needed when migrating to Kubernetes API v1.32.
- Migrate to LaunchDarkly 7.x - This recipe will apply changes commonly needed when migrating to LaunchDarkly 7.x.
- Migrate to OkHttp 5.x - This recipe will apply changes commonly needed when migrating to OkHttp 5.x.
- Migrate to Spring Framework 6.2 for WebLogic 15.1.1 - Migrate applications to the Spring Framework 6.2 release and compatibility with WebLogic 15.1.1.
- Migrate to Spring Security 6.4 - Migrate applications to the latest Spring Security 6.4 release. This recipe will modify an application's build files, make changes to deprecated/preferred APIs, and migrate configuration settings that have changes between versions.
- Migrate to Struts 6.0 - Migrate Struts 2.x to Struts 6.0
- Migrate to WebLogic 14.1.1 - This recipe will apply changes required for migrating to WebLogic 14.1.1
- Migrate to WebLogic 14.1.2 - This recipe will apply changes required for migrating to WebLogic 14.1.2
- Migrate to WebLogic 15.1.1 - This recipe will apply changes required for migrating to WebLogic 15.1.1 and Jakarta EE 9.1
- Migrate xmlns entries in
persistence.xml
files - Java EE has been rebranded to Jakarta EE, necessitating an XML namespace relocation. - Migrates
camel 4.0
application tocamel 4.4
- Migratescamel 4.0
quarkus application tocamel 4.4
. - Migrates
camel 4.10
application tocamel 4.11
- Migratescamel 4.10
quarkus application tocamel 4.11
. - Migrates
camel 4.11
application tocamel 4.12
- Migratescamel 4.11
quarkus application tocamel 4.12
. - Migrates
camel 4.4
application tocamel 4.8
- Migratescamel 4.4
quarkus application tocamel 4.8
. - Migrates
camel 4.8
application tocamel 4.9
- Migratescamel 4.8
quarkus application tocamel 4.9
. - Migrates
camel 4.9
application tocamel 4.10
- Migratescamel 4.9
quarkus application tocamel 4.10
. - Migrates from Jackson 2.x to Jackson 3.x - Migrate applications to the latest Jackson 3.x release.
- Migrates from Netty 4.1.x to Netty 4.2.x - Migrate applications to the latest Netty 4.2.x release.
- Migrates to Apache Commons Collections 4.x - Migrate applications to the latest Apache Commons Collections 4.x release. This recipe modifies application's build files, make changes to deprecated/preferred APIs, and migrates configuration settings that have changes between versions.
- Migrates to Apache Commons Math 3.x - Migrate applications to the latest Apache Commons Math 3.x release. This recipe modifies application's build files, make changes to deprecated/preferred APIs, and migrates configuration settings that have changes between versions.
- Migrates to Apache POI 3.17 - Migrates to the last Apache POI 3.x release. This recipe modifies build files and makes changes to deprecated/preferred APIs that have changed between versions.
- Modernize Jenkinsfile - Updates
Jenkinsfile
to build with recommended Java versions, platforms, and settings. - Modernize a Jenkins plugin to the latest recommended versions - This recipe is intended to change over time to reflect the recommended tooling and recommended Jenkins baseline.
- Modernize a Jenkins plugin to the latest versions supported by Java 8 - This recipe is intended to break down the modernization of very old plugins into distinct steps. It allows modernizing all tooling up to the last versions that supported Java 8. This can then be followed by another recipe that makes the jump to Java 11.
- Moves date pickers to
@mui/x-date-picker
- See Material UI codemod projects for more details. - Moves lab modules to
@mui/material
- See Material UI codemod projects for more details. - Moves tree view to
@mui/x-tree-view
- See Material UI codemod projects for more details. - Next.js Codemods for API Updates - Next.js provides Codemod transformations to help upgrade your Next.js codebase when an API is updated or deprecated.
- OpenRewrite recipe best practices - Best practices for OpenRewrite recipe development.
- Optimizes imports - See Material UI codemod projects for more details.
- Post quantum cryptography - Locate cryptographic configuration which may need to be updated for a brave new post-quantum-supremacy world.
- Prefer JavaScript modules (ESM) over CommonJS. - Prefer JavaScript modules (ESM) over CommonJS. See rule details
- Prefer
.addEventListener()
and.removeEventListener()
over on-functions. - Prefer.addEventListener()
and.removeEventListener()
over on-functions. See rule details - Prefer
.at()
method for index access andString#charAt()
. - Prefer.at()
method for index access andString#charAt()
. See rule details - Prefer
.before()
over.insertBefore()
,.replaceWith()
over.replaceChild()
, prefer one of.before()
,.after()
,.append()
or.prepend()
overinsertAdjacentText()
andinsertAdjacentElement()
. - Prefer.before()
over.insertBefore()
,.replaceWith()
over.replaceChild()
, prefer one of.before()
,.after()
,.append()
or.prepend()
overinsertAdjacentText()
andinsertAdjacentElement()
. See rule details - Prefer
.find()
and.findLast()
over the first or last element from.filter()
. - Prefer.find()
and.findLast()
over the first or last element from.filter()
. See rule details - Prefer
.flatMap()
over.map().flat()
. - Prefer.flatMap()
over.map().flat()
. See rule details - Prefer
.includes()
over.indexOf()
andArray#some()
when checking for existence or non-existence. - Prefer.includes()
over.indexOf()
andArray#some()
when checking for existence or non-existence. See rule details - Prefer
.querySelector()
over.getElementById()
,.querySelectorAll()
over.getElementsByClassName()
and.getElementsByTagName()
. - Prefer.querySelector()
over.getElementById()
,.querySelectorAll()
over.getElementsByClassName()
and.getElementsByTagName()
. See rule details - Prefer
.some()
over.filter().length
check and.{find,findLast}()
. - Prefer.some()
over.filter().length
check and.{find,findLast}()
. See rule details - Prefer
Array#flat()
over legacy techniques to flatten arrays. - PreferArray#flat()
over legacy techniques to flatten arrays. See rule details - Prefer
Array#{indexOf,lastIndexOf}()
overArray#{findIndex,findLastIndex}()
when looking for the index of an item. - PreferArray#{indexOf,lastIndexOf}()
overArray#{findIndex,findLastIndex}()
when looking for the index of an item. See rule details - Prefer
Date.now()
to get the number of milliseconds since the Unix Epoch. - PreferDate.now()
to get the number of milliseconds since the Unix Epoch. See rule details - Prefer
Integer#remainderUnsigned
- Preferjava.lang.Integer#remainderUnsigned
instead of usingcom.google.common.primitives.UnsignedInts#remainderUnsigned
. - Prefer
KeyboardEvent#key
overKeyboardEvent#keyCode
. - PreferKeyboardEvent#key
overKeyboardEvent#keyCode
. See rule details - Prefer
Node#append()
overNode#appendChild()
. - PreferNode#append()
overNode#appendChild()
. See rule details - Prefer
Number
static properties over global ones. - PreferNumber
static properties over global ones. See rule details - Prefer
Reflect.apply()
overFunction#apply()
. - PreferReflect.apply()
overFunction#apply()
. See rule details - Prefer
RegExp#test()
overString#match()
andRegExp#exec()
. - PreferRegExp#test()
overString#match()
andRegExp#exec()
. See rule details - Prefer
Set#has()
overArray#includes()
when checking for existence or non-existence. - PreferSet#has()
overArray#includes()
when checking for existence or non-existence. See rule details - Prefer
String#replaceAll()
over regex searches with the global flag. - PreferString#replaceAll()
over regex searches with the global flag. See rule details - Prefer
String#slice()
overString#substr()
andString#substring()
. - PreferString#slice()
overString#substr()
andString#substring()
. See rule details - Prefer
String#startsWith()
&String#endsWith()
overRegExp#test()
. - PreferString#startsWith()
&String#endsWith()
overRegExp#test()
. See rule details - Prefer
String#trimStart()
/String#trimEnd()
overString#trimLeft()
/String#trimRight()
. - PreferString#trimStart()
/String#trimEnd()
overString#trimLeft()
/String#trimRight()
. See rule details - Prefer
System.lineSeparator()
- Prefer the Java standard library'sSystem.lineSeparator()
over third-party usage of apache'sIOUtils.LINE_SEPARATOR
. - Prefer
childNode.remove()
overparentNode.removeChild(childNode)
. - PreferchildNode.remove()
overparentNode.removeChild(childNode)
. See rule details - Prefer
export…from
when re-exporting. - Preferexport…from
when re-exporting. See rule details - Prefer
for…of
over theforEach
method. - Preferfor…of
over theforEach
method. See rule details - Prefer
java.nio.charset.StandardCharsets
- Prefer the Java standard library'sjava.nio.charset.StandardCharsets
over third-party usage of apache'sorg.apache.commons.io.Charsets
. - Prefer
java.nio.charset.StandardCharsets
- Prefer the Java standard library'sjava.nio.charset.StandardCharsets
overorg.apache.commons.lang3.CharEncoding
. - Prefer
switch
over multipleelse-if
. - Preferswitch
over multipleelse-if
. See rule details - Prefer await expect(...).resolves over expect(await ...) syntax - Prefer await expect(...).resolves over expect(await ...) syntax See rule details for jest/prefer-expect-resolves
- Prefer borrowing methods from the prototype instead of the instance. - Prefer borrowing methods from the prototype instead of the instance. See rule details
- Prefer default parameters over reassignment. - Prefer default parameters over reassignment. See rule details
- Prefer mock resolved/rejected shorthands for promises - Prefer mock resolved/rejected shorthands for promises See rule details for jest/prefer-mock-promise-shorthand
- Prefer modern Math APIs over legacy patterns. - Prefer modern Math APIs over legacy patterns. See rule details
- Prefer negative index over
.length - index
when possible. - Prefer negative index over.length - index
when possible. See rule details - Prefer omitting the catch binding parameter. - Prefer omitting the catch binding parameter. See rule details
- Prefer reading a JSON file as a buffer. - Prefer reading a JSON file as a buffer. See rule details
- Prefer ternary expressions over simple
if-else
statements. - Prefer ternary expressions over simpleif-else
statements. See rule details - Prefer the Java standard library instead of Guava - Guava filled in important gaps in the Java standard library and still does. But at least some of Guava's API surface area is covered by the Java standard library now, and some projects may be able to remove Guava altogether if they migrate to standard library for these functions.
- Prefer the Java standard library instead of Joda-Time - Before Java 8, Java lacked a robust date and time library, leading to the widespread use of Joda-Time to fill this gap. With the release of Java 8, the
java.time
package was introduced, incorporating most of Joda-Time's concepts. Features deemed too specialized or bulky forjava.time
were included in the ThreeTen-Extra library. This recipe migrates Joda-Time types tojava.time
andthreeten-extra
types. - Prefer the spread operator over
Array.from()
,Array#concat()
,Array#{slice,toSpliced}()
andString#split('')
. - Prefer the spread operator overArray.from()
,Array#concat()
,Array#{slice,toSpliced}()
andString#split('')
. See rule details - Prefer using
.dataset
on DOM elements over calling attribute methods. - Prefer using.dataset
on DOM elements over calling attribute methods. See rule details - Prefer using
Object.fromEntries()
to transform a list of key-value pairs into an object. - Prefer usingObject.fromEntries()
to transform a list of key-value pairs into an object. See rule details - Prefer using
Set#size
instead ofArray#length
. - Prefer usingSet#size
instead ofArray#length
. See rule details - Prefer using
String
,Number
,BigInt
,Boolean
, andSymbol
directly. - Prefer usingString
,Number
,BigInt
,Boolean
, andSymbol
directly. See rule details - Prefer using the
node:
protocol when importing Node.js builtin modules. - Prefer using thenode:
protocol when importing Node.js builtin modules. See rule details - Prepends emotion cache - See Material UI codemod projects for more details.
- Prevent abbreviations. - Prevent abbreviations. See rule details
- Properly use declaration-site type variance for well-known types - When using a method parameter like
Function<IN, OUT>
, it should rather beFunction<? super IN, ? extends OUT>
. This recipe checks for method parameters of well-known types. - Quarkus 2.x migration from Quarkus 1.x - Migrates Quarkus 1.x to 2.x.
- Reactor Best Practices - This recipe applies best practices for using Reactor.
- Recommended ESLint Styling - Collection of stylistic ESLint rules that are recommended by the ESLint Style.
- Recommended Jest code cleanup - Collection of cleanup ESLint rules that are recommended by eslint-plugin-jest.
- Recommended Storybook code cleanup - Collection of cleanup ESLint rules from eslint-plugin-storybook.
- Recommended svelte code cleanup - Collection of cleanup ESLint rules from eslint-plugin-svelte.
- Recommended vue code cleanup - Collection of cleanup ESLint rules from eslint-plugin-vue.
- Relocate
org.apache.commons:commons-io
tocommons-io:commons-io
- The deployment oforg.apache.commons:commons-io
was a publishing mistake around 2012 which was corrected by changing the deployment GAV to be located undercommons-io:commons-io
. - Remediate vulnerabilities from the OWASP Top Ten - OWASP publishes a list of the most impactful common security vulnerabilities. These recipes identify and remediate vulnerabilities from the OWASP Top Ten.
- Remove Develocity - Remove the Develocity plugin and configuration from the Gradle build and settings files.
- Remove Security AccessController - The Security Manager API is unsupported in Java 24. This recipe will remove the usage of
java.security.AccessController
. - Remove non existing camel-quarkus extensions - Removal of maven dependencies for extension, which are no longer part of Camel 3.x.
- Remove system props and add them to the
sx
prop - See Material UI codemod projects for more details. - Removes
Unstyled
suffix from base components - See Material UI codemod projects for more details. - Removes
component
prop from base components - See Material UI codemod projects for more details. - Removes
imgProps
prop from Avatar component - See Material UI codemod projects for more details. - Rename
gradle/gradle-build-action
togradle/actions/setup-gradle
- Rename the deprecatedgradle/gradle-build-action
togradle/actions/setup-gradle@v3
. - Rename
gradle/wrapper-validation-action
togradle/actions/wrapper-validation
- Rename the deprecatedgradle/wrapper-validation-action
togradle/actions/wrapper-validation@v3
. - Rename a file example - __
- Rename the package name from
com.nimbusds.jose.shaded.json
tonet.minidev.json
- Rename the package name fromcom.nimbusds.jose.shaded.json
tonet.minidev.json
. - Renames CSS properties for Box component - See Material UI codemod projects for more details.
- Renames CSS variables - See Material UI codemod projects for more details.
- Renames
Mui
classname prefix - See Material UI codemod projects for more details. - Renames
TextField
toInput
- See Material UI codemod projects for more details. - Renames
alpha
prop toopacity
- See Material UI codemod projects for more details. - Renames
closeIcon
prop tocloseButtonIcon
- See Material UI codemod projects for more details. - Renames
collapsedHeight
prop totransitionCollapsedHeight
- See Material UI codemod projects for more details. - Renames
color
prop tocolorOverride
- See Material UI codemod projects for more details. - Renames
component
prop toas
- See Material UI codemod projects for more details. - Renames
gap
prop tospacing
- See Material UI codemod projects for more details. - Renames
option
prop togetOptionLabel
- See Material UI codemod projects for more details. - Renames
row
prop toflexDirection="row"
- See Material UI codemod projects for more details. - Renames base components to slots - See Material UI codemod projects for more details.
- Renames components to slots - See Material UI codemod projects for more details.
- Replace OSSRH secrets with Sonatype secrets - Replace deprecated OSSRH_S01 secrets with new Sonatype secrets in GitHub Actions workflows. This is an example use of the
ReplaceSecrets
andReplaceSecretKeys
recipes combined used to update the Maven publishing secrets in OpenRewrite's GitHub organization. - Replace
@MockBean
and@SpyBean
- Replaces@MockBean
and@SpyBean
annotations with@MockitoBean
and@MockitoSpyBean
. - Replace
hudson.Util.getPastTimeString
withgetTimeSpanString
-hudson.Util.getPastTimeString
has been deprecated since the 2.204.1 LTS release on 2019-12-18. - Replace
org.apache.commons.lang3.Validate#notNull
withObjects#requireNonNull
- Replaceorg.apache.commons.lang3.Validate.notNull(..)
withObjects.requireNonNull(..)
. - Replace lodash and underscore array functions with native JavaScript - -
_.head(x)
->x[0]
-_.head(x, n)
->x.slice(n)
-_.first
(alias for_.head
) -_.tail(x)
->x.slice(1)
-_.tail(x, n)
->x.slice(n)
-_.rest
(alias for_.tail
) -_.last(x)
->x[x.length - 1]
-_.last(x, n)
->x.slice(x.length - n)
- Replace lodash and underscore function functions with native JavaScript - -
_.bind(fn, obj, ...x)
->fn.bind(obj, ...x)
-_.partial(fn, a, b);
->(...args) => fn(a, b, ...args)
- Replace lodash and underscore object functions with native JavaScript - -
_.clone(x)
->{ ...x }
-_.extend({}, x, y)
->{ ...x, ...y }
-_.extend(obj, x, y)
->Object.assign(obj, x, y)
-_.keys(x)
->Object.keys(x)
-_.pairs(x)
->Object.entries(x)
-_.values(x)
->Object.values(x)
- Replace lodash and underscore utility functions with native JavaScript - -
_.isArray(x)
->Array.isArray(x)
-_.isBoolean(x)
->typeof(x) === 'boolean'
-_.isFinite(x)
->Number.isFinite(x)
-_.isFunction(x)
->typeof(x) === 'function'
-_.isNull(x)
->x === null
-_.isString(x)
->typeof(x) === 'string'
-_.isUndefined(x)
->typeof(x) === 'undefined'
- Replaces
@mui
imports with@mui/material
- See Material UI codemod projects for more details. - Require
Array.isArray()
instead ofinstanceof Array
. - RequireArray.isArray()
instead ofinstanceof Array
. See rule details - Require
let
orconst
instead ofvar
- Requirelet
orconst
instead ofvar
See rule details - Require
new
when throwing an error. - Requirenew
when throwing an error. See rule details - Require a newline after each call in a method chain - Require a newline after each call in a method chain See rule details
- Require a specific member delimiter style for interfaces and type literals - Require a specific member delimiter style for interfaces and type literals See rule details
- Require braces around arrow function bodies - Require braces around arrow function bodies See rule details
- Require consistent spacing around type annotations - Require consistent spacing around type annotations See rule details
- Require const declarations for variables that are never reassigned after declared - Require const declarations for variables that are never reassigned after declared See rule details
- Require destructuring from arrays and/or objects - Require destructuring from arrays and/or objects See rule details
- Require empty lines around comments - Require empty lines around comments See rule details
- Require escape sequences to use uppercase values. - Require escape sequences to use uppercase values. See rule details
- Require key attribute for conditionally rendered repeated components - Require key attribute for conditionally rendered repeated components See rule details for vue/v-if-else-key
- Require one JSX element per line - Require one JSX element per line See rule details for react/jsx-one-expression-per-line
- Require one JSX element per line - Require one JSX element per line See rule details
- Require or disallow "Yoda" conditions - Require or disallow "Yoda" conditions See rule details
- Require or disallow Unicode byte order mark (BOM) - Require or disallow Unicode byte order mark (BOM) See rule details
- Require or disallow an empty line between class members - Require or disallow an empty line between class members See rule details
- Require or disallow assignment operator shorthand where possible - Require or disallow assignment operator shorthand where possible See rule details
- Require or disallow logical assignment operator shorthand - Require or disallow logical assignment operator shorthand See rule details
- Require or disallow method and property shorthand syntax for object literals - Require or disallow method and property shorthand syntax for object literals See rule details
- Require or disallow method and property shorthand syntax for object literals in
<template>
- Require or disallow method and property shorthand syntax for object literals in<template>
See rule details for vue/object-shorthand - Require or disallow newline at the end of files - Require or disallow newline at the end of files See rule details
- Require or disallow newlines around variable declarations - Require or disallow newlines around variable declarations See rule details
- Require or disallow newlines between sibling tags in template - Require or disallow newlines between sibling tags in template See rule details for vue/padding-line-between-tags
- Require or disallow padding lines between blocks - Require or disallow padding lines between blocks See rule details for vue/padding-line-between-blocks
- Require or disallow padding lines between statements - Require or disallow padding lines between statements See rule details
- Require or disallow padding lines in component definition - Require or disallow padding lines in component definition See rule details for vue/padding-lines-in-component-definition
- Require or disallow padding within blocks - Require or disallow padding within blocks See rule details
- Require or disallow semicolons instead of ASI - Require or disallow semicolons instead of ASI See rule details
- Require or disallow spacing around embedded expressions of template strings - Require or disallow spacing around embedded expressions of template strings See rule details
- Require or disallow spacing around embedded expressions of template strings in
<template>
- Require or disallow spacing around embedded expressions of template strings in<template>
See rule details for vue/template-curly-spacing - Require or disallow spacing around the `` in `yield` expressions - Require or disallow spacing around the `` in `yield` expressions See rule details
- Require or disallow spacing between function identifiers and their invocations - Require or disallow spacing between function identifiers and their invocations See rule details
- Require or disallow spacing between function identifiers and their invocations in
<template>
- Require or disallow spacing between function identifiers and their invocations in<template>
See rule details for vue/func-call-spacing - Require or disallow spacing between function identifiers and their invocations. Alias of `function-call-spacing`. - Require or disallow spacing between function identifiers and their invocations. Alias of `function-call-spacing`. See rule details
- Require or disallow spacing between template tags and their literals - Require or disallow spacing between template tags and their literals See rule details
- Require or disallow strict mode directives - Require or disallow strict mode directives See rule details
- Require or disallow trailing commas - Require or disallow trailing commas See rule details
- Require or disallow trailing commas in
<template>
- Require or disallow trailing commas in<template>
See rule details for vue/comma-dangle - Require or prevent a new line after jsx elements and expressions - Require or prevent a new line after jsx elements and expressions See rule details for react/jsx-newline
- Require or prevent a new line after jsx elements and expressions. - Require or prevent a new line after jsx elements and expressions. See rule details
- Require parentheses around arrow function arguments - Require parentheses around arrow function arguments See rule details
- Require parentheses around immediate `function` invocations - Require parentheses around immediate `function` invocations See rule details
- Require parenthesis around regex literals - Require parenthesis around regex literals See rule details
- Require quotes around object literal property names - Require quotes around object literal property names See rule details
- Require quotes around object literal property names in
<template>
- Require quotes around object literal property names in<template>
See rule details for vue/quote-props - Require spacing around infix operators - Require spacing around infix operators See rule details
- Require spacing around infix operators in
<template>
- Require spacing around infix operators in<template>
See rule details for vue/space-infix-ops - Require static class names in template to be in a separate class attribute - Require static class names in template to be in a separate class attribute See rule details for vue/prefer-separate-static-class
- Require template literals instead of string concatenation - Require template literals instead of string concatenation See rule details
- Require template literals instead of string concatenation in
<template>
- Require template literals instead of string concatenation in<template>
See rule details for vue/prefer-template - Require the use of === and !== in
<template>
- Require the use of === and !== in<template>
See rule details for vue/eqeqeq - Require the use of
===
and!==
- Require the use of===
and!==
See rule details - Require using .only and .skip over f and x - Require using .only and .skip over f and x See rule details for jest/no-test-prefixes
- Require using arrow functions for callbacks - Require using arrow functions for callbacks See rule details
- Require variables within the same declaration block to be sorted - Require variables within the same declaration block to be sorted See rule details
- SLF4J best practices - Applies best practices to logging with SLF4J.
- Set visibility of
premain
andagentmain
methods topublic
- Check for a behavior change in Java agents. - Setup Spring Framework 5.3.x PetClinic for WebLogic 14.1.2 - Setup Spring Framework 5.3.x PetClinic for WebLogic 14.1.2.
- Spring Boot 3.3 best practices - Applies best practices to Spring Boot 3 applications.
- Spring Boot 3.5 best practices - Applies best practices to Spring Boot 3.5+ applications.
- Stories should use PascalCase - Stories should use PascalCase See rule details for storybook/prefer-pascal-case
- Story files should have a default export - Story files should have a default export See rule details for storybook/default-exports
- Suggest using jest.spyOn() - Suggest using jest.spyOn() See rule details for jest/prefer-spy-on
- Suggest using test.todo - Suggest using test.todo See rule details for jest/prefer-todo
- Suggest using the built-in comparison matchers - Suggest using the built-in comparison matchers See rule details for jest/prefer-comparison-matcher
- Suggest using toBe() for primitive literals - Suggest using toBe() for primitive literals See rule details for jest/prefer-to-be
- Suggest using toContain() - Suggest using toContain() See rule details for jest/prefer-to-contain
- Suggest using toHaveLength() - Suggest using toHaveLength() See rule details for jest/prefer-to-have-length
- Testcontainers best practices - Apply best practices to Testcontainers usage.
- Testing best practices - Applies best practices to tests.
- Update the theme creation from
@mui/system@v5
to be compatible with@pigment-css/react
- See Material UI codemod projects for more details. - Update the usage of the
sx
prop to be compatible with@pigment-css/react
- See Material UI codemod projects for more details. - Update to Angular v15 - Upgrade to Angular v15
- Update to Angular v16 - Upgrade to Angular v16
- Update to Angular v17 - Upgrade to Angular v17
- Update to Angular v18 - Upgrade to Angular v18
- Update to Angular v19 - Upgrade to Angular v19
- Updates
borderRadius
prop values - See Material UI codemod projects for more details. - Updates
circle
prop tovariant="circular"
- See Material UI codemod projects for more details. - Updates
circular
prop tovariant="circular"
- See Material UI codemod projects for more details. - Updates
down
prop for Hidden component - See Material UI codemod projects for more details. - Updates
justify
prop tojustifyContent
for Grid component - See Material UI codemod projects for more details. - Updates
minRows
andmaxRows
props for TextareaAutosize component - See Material UI codemod projects for more details. - Updates
overlap
prop tovariant="dot"
- See Material UI codemod projects for more details. - Updates
round
values for theme typography - See Material UI codemod projects for more details. - Updates
size
prop for IconButton component - See Material UI codemod projects for more details. - Updates
variant
prop for Chip component - See Material UI codemod projects for more details. - Updates
variant
prop for CircularProgress component - See Material UI codemod projects for more details. - Updates
variant
prop for Fab component - See Material UI codemod projects for more details. - Updates
variant
prop for Skeleton component - See Material UI codemod projects for more details. - Updates
variant
prop usage - See Material UI codemod projects for more details. - Updates
width
values for theme breakpoints - See Material UI codemod projects for more details. - Updates base imports to use named exports - See Material UI codemod projects for more details.
- Updates createMuiTheme usage - See Material UI codemod projects for more details.
- Updates import paths for core styles - See Material UI codemod projects for more details.
- Updates link underline on hover - See Material UI codemod projects for more details.
- Updates props for Dialog component - See Material UI codemod projects for more details.
- Updates props for DialogTitle component - See Material UI codemod projects for more details.
- Updates props for Modal component - See Material UI codemod projects for more details.
- Updates props for Table component - See Material UI codemod projects for more details.
- Updates scroll buttons for Tabs component - See Material UI codemod projects for more details.
- Updates the usage of
styled
from@mui/system@v5
to be compatible with@pigment-css/react
- See Material UI codemod projects for more details. - Updates the usage of the
@mui/material/Grid2
,@mui/system/Grid
, and@mui/joy/Grid
components to their updated APIs. - See Material UI codemod projects for more details. - Updates theme breakpoints - See Material UI codemod projects for more details.
- Updates theme options - See Material UI codemod projects for more details.
- Updates theme palette mode - See Material UI codemod projects for more details.
- Updates theme spacing - See Material UI codemod projects for more details.
- Updates theme spacing API - See Material UI codemod projects for more details.
- Updates usage of ThemeProvider - See Material UI codemod projects for more details.
- Updates usage of
@mui/styles
- See Material UI codemod projects for more details. - Updates usage of
@mui/types
- See Material UI codemod projects for more details. - Updates usage of styled engine provider - See Material UI codemod projects for more details.
- Updates usage of transitions - See Material UI codemod projects for more details.
- Updates usage of useAutocomplete - See Material UI codemod projects for more details.
- Updates usage of useTransitionProps - See Material UI codemod projects for more details.
- Updates withMobileDialog higher-order component - See Material UI codemod projects for more details.
- Updates withWidth higher-order component - See Material UI codemod projects for more details.
- Upgrade ECMAScript 5 to ECMAScript 6 - A collection of common ECMAScript 5 to ECMAScript 6 updates.
- Upgrade Micrometer - This recipe will apply changes commonly needed when migrating Micrometer.
- Upgrade to .NET 6.0 using upgrade-assistant - Run upgrade-assistant upgrade across a repository to upgrade projects to .NET 6.0.
- Upgrade to .NET 7.0 using upgrade-assistant - Run upgrade-assistant upgrade across a repository to upgrade projects to .NET 7.0.
- Upgrade to .NET 8.0 using upgrade-assistant - Run upgrade-assistant upgrade across a repository to upgrade projects to .NET 8.0.
- Upgrade to .NET 9.0 using upgrade-assistant - Run upgrade-assistant upgrade across a repository to upgrade projects to .NET 9.0.
- Upgrade to Android SDK 35 - Recipes to upgrade to Android SDK version 35.
- Upgrade to Axonframework 4.x Jakarta - Migration file to upgrade from an Axon Framework Javax-specific project to Jakarta.
- Upgrade to Axonframework 4.x Javax - Migration file to upgrade an Axon Framework Javax-specific project and remain on Javax.
- Upgrade to Cucumber-JVM 7.x - Upgrade to Cucumber-JVM 7.x from any previous version.
- Upgrade to the latest Timefold Solver - Replace all your calls to deleted/deprecated types and methods of Timefold Solver with their proper alternatives.
- Use OkHttp 3 MockWebServer for JUnit 5 - Migrates OkHttp 3
MockWebServer
to enable JUnit Jupiter Extension support. - Use
SunJSSE
instead ofcom.sun.net.ssl.internal.ssl.Provider
- Thecom.sun.net.ssl.internal.ssl.Provider
provider name was removed. - Use
java.security.cert
instead ofjavax.security.cert
- Thejavax.security.cert
package has been deprecated for removal. - Use commons-lang3 API Plugin - Updates
pom.xml
to depend oncommons-lang3-api
and excludecommons-lang3
where it is brought in transitively. - Use destructured variables over properties. - Use destructured variables over properties. See rule details
- Use expect from @storybook/jest - Use expect from @storybook/jest See rule details for storybook/use-storybook-expect
- Use local variable type inference - Apply local variable type inference (
var
) for primitives and objects. These recipes can cause unused imports, be advised to run `org.openrewrite.java.RemoveUnusedImports afterwards. - Use modernized
java.util
APIs - Certain java util APIs have been introduced and are favored over previous APIs. - Wicket best practices - Applies Wicket best practices such as minimizing anonymous inner classes and upgrading to the latest version.
- disallow dynamic slot name - disallow dynamic slot name See rule details for svelte/no-dynamic-slot-name
- disallow spaces around equal signs in attribute - disallow spaces around equal signs in attribute See rule details for svelte/no-spaces-around-equal-signs-in-attribute
- disallow to use of the store itself as an operand. Need to use $ prefix or get function. - disallow to use of the store itself as an operand. Need to use $ prefix or get function. See rule details for svelte/require-store-reactive-access
- disallow unnecessary mustache interpolations - disallow unnecessary mustache interpolations See rule details for svelte/no-useless-mustaches
- enforce consistent indentation - enforce consistent indentation See rule details for svelte/indent
- enforce consistent spacing after the <!-- and before the --> in a HTML comment - enforce consistent spacing after the <!-- and before the --> in a HTML comment See rule details for svelte/spaced-html-comment
- enforce order of attributes - enforce order of attributes See rule details for svelte/sort-attributes
- enforce quotes style of HTML attributes - enforce quotes style of HTML attributes See rule details for svelte/html-quotes
- enforce self-closing style - enforce self-closing style See rule details for svelte/html-self-closing
- enforce the location of first attribute - enforce the location of first attribute See rule details for svelte/first-attribute-linebreak
- enforce the maximum number of attributes per line - enforce the maximum number of attributes per line See rule details for svelte/max-attributes-per-line
- enforce unified spacing in mustache - enforce unified spacing in mustache See rule details for svelte/mustache-spacing
- enforce use of shorthand syntax in attribute - enforce use of shorthand syntax in attribute See rule details for svelte/shorthand-attribute
- enforce use of shorthand syntax in directives - enforce use of shorthand syntax in directives See rule details for svelte/shorthand-directive
- io.quarkus.updates.core.quarkus30.AdditionalChanges - __
- io.quarkus.updates.core.quarkus30.ApplicationProperties - __
- io.quarkus.updates.core.quarkus30.ApplicationYml - __
- io.quarkus.updates.core.quarkus30.JavaxConfigurationFiles - __
- io.quarkus.updates.core.quarkus30.JavaxToJakartaAdditionalMigration - __
- io.quarkus.updates.core.quarkus30.JavaxToJakartaCodestarts - __
- io.quarkus.updates.core.quarkus30.JavaxToJakartaCodestartsTests - __
- io.quarkus.updates.core.quarkus30.JavaxToJakartaDocumentationAdoc - __
- io.quarkus.updates.core.quarkus30.JavaxToJakartaDocumentationMd - __
- io.quarkus.updates.core.quarkus30.JavaxToJakartaKotlin - __
- io.quarkus.updates.core.quarkus30.JavaxToJakartaKotlinCodestarts - __
- io.quarkus.updates.core.quarkus30.JavaxToJakartaKotlinCodestartsTests - __
- io.quarkus.updates.core.quarkus30.Kotlin - __
- io.quarkus.updates.core.quarkus30.UpgradeQuarkiverse - __
- io.quarkus.updates.core.quarkus31.RemoveMockitoInline - __
- io.quarkus.updates.core.quarkus310.FlywayDb2 - __
- io.quarkus.updates.core.quarkus310.FlywayDerby - __
- io.quarkus.updates.core.quarkus310.FlywayPostgreSQL - __
- io.quarkus.updates.core.quarkus310.SyncHibernateJpaModelgenVersionWithBOM - __
- io.quarkus.updates.core.quarkus310.UpdateConfigPackagePom - __
- io.quarkus.updates.core.quarkus310.UpdateConfigPackageSimpleProperties - __
- io.quarkus.updates.core.quarkus310.UpdateConfigPackageTypeFastJar - __
- io.quarkus.updates.core.quarkus310.UpdateConfigPackageTypeJar - __
- io.quarkus.updates.core.quarkus310.UpdateConfigPackageTypeMutableJar - __
- io.quarkus.updates.core.quarkus310.UpdateConfigPackageTypeNative - __
- io.quarkus.updates.core.quarkus310.UpdateConfigPackageTypeNativeSources - __
- io.quarkus.updates.core.quarkus310.UpdateConfigPackageTypeUberJar - __
- io.quarkus.updates.core.quarkus311.SyncHibernateJpaModelgenVersionWithBOM - __
- io.quarkus.updates.core.quarkus312.SyncHibernateJpaModelgenVersionWithBOM - __
- io.quarkus.updates.core.quarkus313.SyncHibernateJpaModelgenVersionWithBOM - __
- io.quarkus.updates.core.quarkus313.UpdateTestOIDCAuthServerUrl - __
- io.quarkus.updates.core.quarkus318.RemoveFlywayCleanOnValidationError - __
- io.quarkus.updates.core.quarkus319.ConfigurationPropertiesChange - __
- io.quarkus.updates.core.quarkus319.HibernateORMValidationMode - __
- io.quarkus.updates.core.quarkus319.MoveAccessTokenAnnotationToNewPackage - __
- io.quarkus.updates.core.quarkus32.ApplicationProperties - __
- io.quarkus.updates.core.quarkus32.ApplicationYml - __
- io.quarkus.updates.core.quarkus32.InjectMock - __
- io.quarkus.updates.core.quarkus321.TlsRegistrySplitPackagesFix - __
- io.quarkus.updates.core.quarkus323.HibernateORMSchemaManagementProperties - __
- io.quarkus.updates.core.quarkus324.AddHibernateAnnotationProcessorIfNewJpaModelgenDependency - __
- io.quarkus.updates.core.quarkus324.AddHibernateAnnotationProcessorIfOldJpaModelgenDependency - __
- io.quarkus.updates.core.quarkus324.LogConsoleAsyncEnable - __
- io.quarkus.updates.core.quarkus324.MigrateFromHibernateOrmSessionMethodsRemovedIn7 - __
- io.quarkus.updates.core.quarkus324.MigrateFromHibernateOrmVariousRemovedIn7 - __
- io.quarkus.updates.core.quarkus324.RemoveJpaModelgenDependencies - __
- io.quarkus.updates.core.quarkus324.ReplaceNewJpaModelgenAnnotationProcessor - __
- io.quarkus.updates.core.quarkus324.ReplaceOldJpaModelgenAnnotationProcessor - __
- io.quarkus.updates.core.quarkus33.ApplicationProperties - __
- io.quarkus.updates.core.quarkus33.ApplicationYml - __
- io.quarkus.updates.core.quarkus33.GraalVMSubstitutionsArtifact - __
- io.quarkus.updates.core.quarkus35.MutinyUniAndGroupCombinedWith - __
- io.quarkus.updates.core.quarkus35.MutinyUniMemoizeAtLeast - __
- io.quarkus.updates.core.quarkus36.JaegerSmallRyeOpenTracing - __
- io.quarkus.updates.core.quarkus37.AddJpaModelgenAnnotationProcessor - __
- io.quarkus.updates.core.quarkus37.AddJpaModelgenAnnotationProcessorIfOldArtifact - __
- io.quarkus.updates.core.quarkus37.HibernateSearchOutboxPolling - __
- io.quarkus.updates.core.quarkus37.MavenPlugins - __
- io.quarkus.updates.core.quarkus37.RemoveJpaModelgenDependencies - __
- io.quarkus.updates.core.quarkus37.ReplaceJpaModelgenAnnotationProcessor - __
- io.quarkus.updates.core.quarkus37.ResteasyClientRenaming - __
- io.quarkus.updates.core.quarkus37.SyncHibernateJpaModelgenVersionWithBOM - __
- io.quarkus.updates.core.quarkus38.SyncHibernateJpaModelgenVersionWithBOM - __
- io.quarkus.updates.core.quarkus383.GraalSDK - __
- io.quarkus.updates.core.quarkus39.GraalSDK - __
- io.quarkus.updates.core.quarkus39.Relocations - __
- io.quarkus.updates.core.quarkus39.RemovePanacheAnnotationProcessor - __
- io.quarkus.updates.core.quarkus39.SyncHibernateJpaModelgenVersionWithBOM - __
- io.quarkus.updates.core.quarkus39.UpdateConfigRoots - __
- io.quarkus.updates.minio.minio38.UpdateAll - __
- require class directives instead of ternary expressions - require class directives instead of ternary expressions See rule details for svelte/prefer-class-directive
- require or disallow a space before tag's closing brackets - require or disallow a space before tag's closing brackets See rule details for svelte/html-closing-bracket-spacing
- require style directives instead of style attribute - require style directives instead of style attribute See rule details for svelte/prefer-style-directive
rewrite-ai-search
- Find comments' language distribution - Finds all comments and uses AI to predict which language the comment is in.
- Find method invocations that resemble a pattern - This recipe uses two phase AI approach to find a method invocation that resembles a search string.
- Get embeddings for code snippets in code - This recipe calls an AI model to get an embedding for either classes or methods which can then be used for downstream tasks.
- Get recommendations - This recipe calls an AI model to get recommendations for modernizing the code base by looking at a sample of method declarations.
- List all methods used - List all methods used in any Java source file.
rewrite-all
- Find call graph - Produces a data table where each row represents a method call.
- Find duplicate source files - Record the presence of LSTs with duplicate paths, indicating that the same file was parsed more than once.
- Language composition report - Counts the number of lines of the various kinds of source code and data formats parsed by OpenRewrite. Comments are not included in line counts. This recipe emits its results as two data tables, making no changes to any source file. One data table is per-file, the other is per-repository.
rewrite-analysis
- Control flow visualization - Visualize the control flow of a Java program.
- Find method usages - Find method usages by pattern.
- Finds flow between two methods - Takes two patterns for the start/end methods to find flow between.
- URIs created with an HTTP scheme - This is a sample recipe demonstrating a simple application of local data flow analysis.
rewrite-apache
- Apache POI use
Cell.setCellType(CellType)
-Cell.setCellType()
can be configured with either an integer or a theCellType
enumeration. It is clearer and less error-prone to use theCellType
enumeration, so this recipe converts allsetCellType()
calls to use it. - Migrate from Plexus
AbstractLogEnabled
to SLF4J - Introduce a SLF4JLogger
field and replace calls togetLogger()
with calls to the field. - Prefer
java.nio.file.Files
- Prefer the Java standard library'sjava.nio.file.Files
over third-party usage of apache'sapache.commons.io.FileUtils
. - Prefer
java.util.Base64
- Prefer the Java standard library'sjava.util.Base64
over third-party usage of apache'sapache.commons.codec.binary.Base64
. - [Replace
Font.setBoldweight(short)
withFont.setBold(boolean)](/recipes/apache/poi/replacesetboldweightwithsetbold.md) - _Replace
Font.setBoldweight(short)or equivalent with
Font.setBold(boolean)`._ - Replace any StringUtils#isEmpty(String) and #isNotEmpty(String) - Replace any
StringUtils#isEmpty(String)
and#isNotEmpty(String)
withs == null || s.isEmpty()
ands != null && !s.isEmpty()
. - Use IOUtils method that include their charset encoding - Use
IOUtils
method invocations that include the charset encoding instead of using the deprecated versions that do not include a charset encoding. (e.g. convertsIOUtils.readLines(inputStream)
toIOUtils.readLines(inputStream, StandardCharsets.UTF_8)
. ApacheCommonsFileUtils
Refaster recipes - Refaster template recipes fororg.openrewrite.apache.commons.io.ApacheCommonsFileUtils
.ApacheCommonsStringUtils
Refaster recipes - Refaster template recipes fororg.openrewrite.apache.commons.lang.ApacheCommonsStringUtils
.MavenSharedStringUtils
Refaster recipes - Refaster template recipes fororg.openrewrite.apache.maven.shared.MavenSharedStringUtils
.PlexusFileUtils
Refaster recipes - Refaster template recipes fororg.openrewrite.codehaus.plexus.PlexusFileUtils
.PlexusStringUtils
Refaster recipes - Refaster template recipes fororg.openrewrite.codehaus.plexus.PlexusStringUtils
.
rewrite-azul
- Eliminate unused classes - Deprecate and later delete classes that are unused, as detected by Azul Intelligence Cloud.
- Find reachable methods - Find all methods defined in the repository's source code that are reachable.
rewrite-circleci
- Install an orb - Install a CircleCI orb if it is not already installed.
- Update CircleCI image - See the list of pre-built CircleCI images.
rewrite-codemods
- Biome recommendations - Run Biome recommended settings on your projects.
- Lint UI5 projects with UI5 linter - Runs the UI5 Linter, a static code analysis tool for UI5 projects. It checks JavaScript, TypeScript, XML, JSON, and other files in your project and reports findings.
- Run Putout - Run Putout on your projects.
rewrite-compiled-analysis
- Change
List#add
toList#plus
and verify. - We know this won't compile.
rewrite-comprehension
- Code comprehension with unit test examples - First runs a scanning recipe to grab all unit tests, then supplements the unit tests examples for the AI-generate descriptions.
- Improve recipe descriptors - Improving recipe display names and descriptions in turn improves Moddy.
- Search for a class that uses the given design technique - Search for a class that uses the given design technique.
- Update the README for an OpenRewrite recipe repository - Updates the README periodically to reflect the latest contents of recipe projects.
rewrite-concourse
- Change resource version - Pin or unpin a resource to a particular version.
- Find pinned resources by type - Find resources of a particular type that have pinned versions.
- Find resource - Find a Concourse resource by name.
- Update git resource
source.uri
references - Update git resourcesource.uri
URI values to point to a new URI value.
rewrite-core
- Append to text file - Appends or replaces content of an existing plain text file, or creates a new one if it doesn't already exist. Please note that this recipes requires existing plain text files' format to be successfully parsable by OpenRewrite. If a file is left unchanged, it might be parsed as a
Quark
rather than plain text. In such case, use theplainTextMask
option. See the Gradle or Maven plugin configuration page. - Change text - Completely replaces the contents of the text file with other text. Use together with a
FindSourceFiles
precondition to limit which files are changed. - Delete files - Delete files by source path.
- End of Line @ End of File (EOL @ EOF) - Ensure that the file ends with the newline character. Note: If this recipe modifies a file, it converts the file into plain text. As such, this recipe should be run after any recipe that modifies the language-specific LST.
- Experimental find text with multiselect - Search for text, treating all textual sources as plain text. This version of the recipe exists to experiment with multiselect recipe options.
- Find LST provenance - Produces a data table showing what versions of OpenRewrite/Moderne tooling was used to produce a given LST.
- Find build metadata - Find source files with matching build metadata.
- Find colliding source files - Finds source files which share a path with another source file. There should always be exactly one source file per path within a repository. This is a diagnostic for finding problems in OpenRewrite parsers/build plugins.
- Find committers on repositories - List the committers on a repository.
- Find deserialization errors - Produces a data table collecting all deserialization errors of serialized LSTs.
- Find files - Find files by source path. Paths are always interpreted as relative to the repository root.
- Find instances of type
Quark
-Quark
source files are pointers to the existence of a file without capturing any of the contents of the file. - Find parse to print inequality - OpenRewrite
Parser
implementations should produceSourceFile
objects whoseprintAll()
method should be byte-for-byte equivalent with the original source file. When this isn't true, recipes can still run on theSourceFile
and even produce diffs, but the diffs would fail to apply as a patch to the original source file. MostParser
useParser#requirePrintEqualsInput
to produce aParseError
when they fail to produce aSourceFile
that is print idempotent. - Find source files with
ParseExceptionResult
markers - This recipe explores parse failures after an LST is produced for classifying the types of failures that can occur and prioritizing fixes according to the most common problems. - Is in repository - A search recipe which marks files that are in a repository with one of the supplied names. Intended for use as a precondition for other recipes being run over many different repositories.
- List runtime classpath - A diagnostic utility which emits the runtime classpath to a data table.
- Move a file - Move a file to a different directory. The file name will remain the same.
- Remove ignoral of files or directories from .gitignore - This recipe will remove a file or directory from the .gitignore file. If the file or directory is already in the .gitignore file, it will be removed or negated. If the file or directory is not in the .gitignore file, no action will be taken.
- Repository contains file - Intended to be used primarily as a precondition for other recipes, this recipe checks if a repository contains a specific file or files matching a pattern. If present all files in the repository are marked with a
SearchResult
marker. If you want to get only the matching file as a search result, useFindSourceFiles
instead. - Set file permission attributes - Set a file's read, write and executable permission attributes.
- Show Git source control metadata - List out the contents of each unique
GitProvenance
marker in the set of source files. When everything is working correctly, exactly one such marker should be printed as all source files are expected to come from the same repository / branch / commit hash. - org.openrewrite.config.CompositeRecipe - A recipe that consists of a list of other recipes.
rewrite-cryptography
- Find hardcoded PEM certificates - Detects hardcoded PEM certificates passed into
CertificateFactory.generateCertificate()
.
rewrite-csharp
- A class that provides Equals(T) should implement IEquatable<T> - __
- A readonly DependencyProperty must be set with DependencyPropertyKey - A readonly DependencyProperty must be set with DependencyPropertyKey.
- Abstract type should not have public constructors - __
- Abstract types should not have public constructors - Constructors on abstract types can be called only by derived types. Because public constructors create instances of a type, and you cannot create instances of an abstract type, an abstract type that has a public constructor is incorrectly designed.
- Abstract types should not have public or internal constructors - __
- Access modifier should be declared - The access modifier for a C# element has not been explicitly defined.
- Accessible fields should begin with upper-case letter - The name of a public or internal field in C# does not begin with an upper-case letter.
- Accessor method for attached property should have standard documentation text - Accessor method for attached property should have standard documentation text.
- Add 'param' element to documentation comment - __
- Add 'static' modifier to all partial class declarations - __
- Add 'typeparam' element to documentation comment - __
- Add MarkupExtensionReturnType attribute - Add MarkupExtensionReturnType attribute.
- Add StructLayoutAttribute - __
- Add ValueConversion attribute - Add ValueConversion attribute.
- Add ValueConversion attribute (unknown types) - Add ValueConversion attribute (unknown types).
- Add [AttachedPropertyBrowsableForType] - Add [AttachedPropertyBrowsableForType].
- Add [ConstructorArgument] - Add [ConstructorArgument] for the property.
- Add [TemplatePart] to the type - Add [TemplatePart] to the type.
- Add a comma after the last value - __
- Add braces - __
- Add braces (when expression spans over multiple lines) - __
- Add braces to if-else - __
- Add braces to if-else (when expression spans over multiple lines) - __
- Add braces to switch section with multiple statements - __
- Add default field to converter - Add default field to converter.
- Add exception to documentation comment - __
- Add or remove region name - __
- Add paragraph to documentation comment - __
- Add parameter name to improve readability - __
- Add parentheses when necessary - __
- Add summary element to documentation comment - __
- Add/remove 'ConfigureAwait(false)' call - __
- Add/remove accessibility modifiers - __
- Add/remove parentheses from condition in conditional operator - __
- Add/remove trailing comma - __
- All accessors should be single-line or multi-line - Within a C# property, indexer or event, at least one of the child accessors is written on a single line, and at least one of the child accessors is written across multiple lines.
- All members declared in parent interfaces must have an implementation in a DynamicInterfaceCastableImplementation-attributed interface - Types attributed with 'DynamicInterfaceCastableImplementationAttribute' act as an interface implementation for a type that implements the 'IDynamicInterfaceCastable' type. As a result, it must provide an implementation of all of the members defined in the inherited interfaces, because the type that implements 'IDynamicInterfaceCastable' will not provide them otherwise.
- Argument passed to TaskCompletionSource constructor should be TaskCreationOptions enum instead of TaskContinuationOptions enum - TaskCompletionSource has constructors that take TaskCreationOptions that control the underlying Task, and constructors that take object state that's stored in the task. Accidentally passing a TaskContinuationOptions instead of a TaskCreationOptions will result in the call treating the options as state.
- Arithmetic expressions should declare precedence - A C# statement contains a complex arithmetic expression which omits parenthesis around operators.
- Attribute constructor should not use unnecessary parenthesis - TODO.
- Attributes should not share line - Each attribute should be placed on its own line of code.
- Avoid NullReferenceException - __
- Avoid comparison with bool constant - __
- Avoid constant arrays as arguments - Constant arrays passed as arguments are not reused when called repeatedly, which implies a new array is created each time. Consider extracting them to 'static readonly' fields to improve performance if the passed array is not mutated within the called method.
- Avoid implicit culture-sensitive methods - __
- Avoid inexact read with 'Stream.Read' - A call to 'Stream.Read' may return fewer bytes than requested, resulting in unreliable code if the return value is not checked.
- Avoid locking on publicly accessible instance - __
- Avoid nested ?: operators - __
- Avoid redundant length argument - An explicit length calculation can be error-prone and can be avoided when slicing to end of the buffer.
- Avoid unnecessary boxing of value type - __
- Avoid unsealed attributes - The .NET Framework class library provides methods for retrieving custom attributes. By default, these methods search the attribute inheritance hierarchy. Sealing the attribute eliminates the search through the inheritance hierarchy and can improve performance.
- Avoid unused private fields - Private fields were detected that do not appear to be accessed in the assembly.
- Avoid usage of using alias directive - __
- Avoid using 'Enumerable.Any()' extension method - Prefer using 'IsEmpty', 'Count' or 'Length' properties whichever available, rather than calling 'Enumerable.Any()'. The intent is clearer and it is more performant than using 'Enumerable.Any()' extension method.
- Avoid using redundant else - The 'if' block contains a jump statement (break, continue, goto, return, throw, yield break). Using 'else' is redundant and needlessly maintains a higher nesting level.
- Avoid zero-length array allocations - __
- Backing field for a DependencyProperty should be static and readonly - Backing field for a DependencyProperty should be static and readonly.
- Backing field for a DependencyProperty should match registered name - A dependency property's backing field should be named with the name it is registered with suffixed by 'Property'. This is the convention in the framework.
- Backing field for a DependencyPropertyKey should match registered name - A DependencyPropertyKey's backing field must be named with the name it is registered with suffixed by 'PropertyKey'.
- Backing field for a RoutedCommand should be static and readonly - Backing field for a RoutedCommand should be static and readonly.
- Backing field for a RoutedEvent should match registered name - A routed event's backing field should be named with the name it is registered with suffixed by 'Event'.
- Backing member for DependencyProperty should have standard documentation text - Backing member for DependencyProperty should have standard documentation text.
- Backing member for RoutedEvent should have standard documentation text - Backing member for RoutedEvent should have standard documentation text.
- Backing member for a RoutedEvent should be static and readonly - Backing member for a RoutedEvent should be static and readonly.
- Braces for multi-line statements should not share line - The opening or closing brace within a C# statement, element, or expression is not placed on its own line.
- Braces should not be omitted - The opening and closing braces for a C# statement have been omitted.
- Braces should not be omitted from multi-line child statement - The opening and closing braces for a multi-line C# statement have been omitted.
- CLR accessor for attached property must match registered type - CLR accessor for attached property must match registered type.
- CLR method for a DependencyProperty must match registered name - CLR methods for accessing a DependencyProperty must have names matching the name the DependencyProperty is registered with.
- CLR property for a DependencyProperty should match registered name - A CLR property accessor for a DependencyProperty must have the same name as the DependencyProperty is registered with.
- CLR property type should match registered type - CLR property type should match registered type.
- Call 'Enumerable.ThenBy' instead of 'Enumerable.OrderBy' - __
- Call extension method as instance method - __
- Cast sender to containing type - Cast sender to correct type.
- Cast sender to correct type - Cast sender to correct type.
- Cast value to correct type - Cast value to correct type.
- Cast value to correct type - Cast value to correct type.
- Chained statement blocks should not be preceded by blank line - Chained C# statements are separated by a blank line.
- Closing attribute brackets should be spaced correctly - A closing attribute bracket within a C# element is not spaced correctly.
- Closing brace should be followed by blank line - A closing brace within a C# element, statement, or expression is not followed by a blank line.
- Closing braces should be spaced correctly - A closing brace within a C# element is not spaced correctly.
- Closing braces should not be preceded by blank line - A closing brace within a C# element, statement, or expression is preceded by a blank line.
- Closing generic brackets should be spaced correctly - A closing generic bracket within a C# element is not spaced correctly.
- Closing parenthesis should be on line of last parameter - The closing parenthesis or bracket in a call to or declaration of a C# method/indexer/attribute/array/constructor/delegate is not placed on the same line as the last parameter.
- Closing parenthesis should be on line of opening parenthesis - The closing parenthesis or bracket in a call to a C# method or indexer, or the declaration of a method or indexer, is not placed on the same line as the opening bracket when the element does not take any parameters.
- Closing parenthesis should be spaced correctly - A closing parenthesis within a C# statement is not spaced correctly.
- Closing square brackets should be spaced correctly - A closing square bracket within a C# statement is not spaced correctly.
- Code analysis suppression should have justification - A Code Analysis SuppressMessage attribute does not include a justification.
- Code should not contain blank lines at start of file - The code file has blank lines at the start.
- Code should not contain empty statements - The C# code contains an extra semicolon.
- Code should not contain multiple blank lines in a row - The C# code contains multiple blank lines in a row.
- Code should not contain multiple statements on one line - The C# code contains more than one statement on a single line.
- Code should not contain multiple whitespace in a row - The code contains multiple whitespace characters in a row.
- Code should not contain space after new or stackalloc keyword in implicitly typed array allocation - An implicitly typed array allocation within a C# code file is not spaced correctly.
- Code should not contain trailing whitespace - There should not be any whitespace at the end of a line of code.
- Colons Should Be Spaced Correctly - A colon within a C# element is not spaced correctly.
- Combine 'Enumerable.Where' method chain - __
- Combine LINQ methods - __
- Comma should be on the same line as previous parameter - A comma between two parameters in a call to a C# method or indexer, or in the declaration of a method or indexer, is not placed on the same line as the previous parameter.
- Commas should be spaced correctly - The spacing around a comma is incorrect, within a C# code file.
- Comments should contain text - The C# comment does not contain any comment text.
- Composite enum value contains undefined flag - __
- Conditional expressions should declare precedence - A C# statement contains a complex conditional expression which omits parenthesis around operators.
- Consider calling ConfigureAwait on the awaited task - When an asynchronous method awaits a Task directly, continuation occurs in the same thread that created the task. Consider calling Task.ConfigureAwait(Boolean) to signal your intention for continuation. Call ConfigureAwait(false) on the task to schedule continuations to the thread pool, thereby avoiding a deadlock on the UI thread. Passing false is a good option for app-independent libraries. Calling ConfigureAwait(true) on the task has the same behavior as not explicitly calling ConfigureAwait. By explicitly calling this method, you're letting readers know you intentionally want to perform the continuation on the original synchronization context.
- Consider making public types internal - Unlike a class library, an application's API isn't typically referenced publicly, so types can be marked internal.
- Consider using 'StringBuilder.Append(char)' when applicable - 'StringBuilder.Append(char)' is more efficient than 'StringBuilder.Append(string)' when the string is a single character. When calling 'Append' with a constant, prefer using a constant char rather than a constant string containing one character.
- Consider using 'string.Contains' instead of 'string.IndexOf' - Calls to 'string.IndexOf' where the result is used to check for the presence/absence of a substring can be replaced by 'string.Contains'.
- Const field names should begin with upper-case letter - The name of a constant C# field should begin with an upper-case letter.
- Constant values should be placed on right side of comparisons - __
- Constructor summary documentation should begin with standard text - The XML documentation header for a C# constructor does not contain the appropriate summary text.
- Containing type should be used as registered owner - When registering a DependencyProperty register containing type as owner type.
- Containing type should be used as registered owner - When registering a RoutedEvent register containing type as owner type.
- Convert 'if' to 'return' statement - __
- Convert 'if' to assignment - __
- Convert comment to documentation comment - __
- Convert interpolated string to concatenation - __
- Convert lambda expression body to expression body - __
- Declaration keywords should follow order - The keywords within the declaration of an element do not follow a standard ordering scheme.
- Declare each attribute separately - __
- Declare each type in separate file - __
- Declare enum member with zero value (when enum has FlagsAttribute) - __
- Declare enum value as combination of names - __
- Declare type inside namespace - __
- Declare using directive on top level - __
- Default label should be the last label in a switch section - __
- Define accessors for attribute arguments - __
- DependencyPropertyKey member must be declared before DependencyProperty member - DependencyPropertyKey member must be declared before DependencyProperty member.
- Dereference and access of symbols should be spaced correctly - A dereference symbol or an access-of symbol within a C# element is not spaced correctly.
- Destructor summary documentation should begin with standard text - The XML documentation header for a C# finalizer does not contain the appropriate summary text.
- Dispose methods should call base class dispose - A type that implements System.IDisposable inherits from a type that also implements IDisposable. The Dispose method of the inheriting type does not call the Dispose method of the parent type. To fix a violation of this rule, call base.Dispose in your Dispose method.
- Do not call ToImmutableCollection on an ImmutableCollection value - __
- Do not combine attributes - Each attribute usage should be placed in its own set of square brackets for maximum readability.
- Do not combine fields - Each field should be declared on its own line, in order to clearly see each field of a type and allow for proper documentation of the behavior of each field.
- Do not compare Span<T> to 'null' or 'default' - Comparing a span to 'null' or 'default' might not do what you intended. 'default' and the 'null' literal are implicitly converted to 'Span<T>.Empty'. Remove the redundant comparison or make the code more explicit by using 'IsEmpty'.
- Do not duplicate indexed element initializations - Indexed elements in objects initializers must initialize unique elements. A duplicate index might overwrite a previous element initialization.
- Do not initialize unnecessarily - The .NET runtime initializes all fields of reference types to their default values before running the constructor. In most cases, explicitly initializing a field to its default value in a constructor is redundant, adding maintenance costs and potentially degrading performance (such as with increased assembly size), and the explicit initialization can be removed. In some cases, such as with static readonly fields that permanently retain their default value, consider instead changing them to be constants or properties.
- Do not mark enums with FlagsAttribute - An externally visible enumeration is marked by using FlagsAttribute, and it has one or more values that are not powers of two or a combination of the other defined values on the enumeration.
- Do not pass a non-nullable value to 'ArgumentNullException.ThrowIfNull' - 'ArgumentNullException.ThrowIfNull' throws when the passed argument is 'null'. Certain constructs like non-nullable structs, 'nameof()' and 'new' expressions are known to never be null, so 'ArgumentNullException.ThrowIfNull' will never throw.
- Do not pass a nullable struct to 'ArgumentNullException.ThrowIfNull' - 'ArgumentNullException.ThrowIfNull' accepts an 'object', so passing a nullable struct may cause the value to be boxed.
- Do not pass non-read-only struct by read-only reference - __
- Do not place regions within elements - The C# code contains a region within the body of a code element.
- Do not prefix calls with base unless local implementation exists - A call to a member from an inherited class begins with 'base.', and the local class does not contain an override or implementation of the member.
- Do not prefix local calls with 'this.' - A call to an instance member of the local class or a base class is prefixed with
this.
. - Do not use 'WaitAll' with a single task - Using 'WaitAll' with a single task may result in performance loss, await or return the task instead.
- Do not use 'WhenAll' with a single task - Using 'WhenAll' with a single task may result in performance loss, await or return the task instead.
- Do not use Count() or LongCount() when Any() can be used - For non-empty collections, Count() and LongCount() enumerate the entire sequence, while Any() stops at the first item or the first item that satisfies a condition.
- Do not use CountAsync() or LongCountAsync() when AnyAsync() can be used - For non-empty collections, CountAsync() and LongCountAsync() enumerate the entire sequence, while AnyAsync() stops at the first item or the first item that satisfies a condition.
- Do not use Enumerable methods on indexable collections - This collection is directly indexable. Going through LINQ here causes unnecessary allocations and CPU work.
- Do not use blocking calls in a sync method (need to make calling method async) - __
- Do not use blocking calls in an async method - __
- Do not use default value type constructor - When creating a new instance of a value type T, the syntax 'default(T)' is functionally equivalent to the syntax 'new T()'. To avoid confusion regarding the behavior of the resulting instance, the first form is preferred.
- Do not use placeholder elements - The element documentation contains a <placeholder> element.
- Do not use regions - The C# code contains a region.
- Documentation lines should begin with single space - A line within a documentation header above a C# element does not begin with a single space.
- Documentation text should end with a period - A section of the XML header documentation for a C# element does not end with a period.
- Don't set DataContext and Style using SetCurrentValue - Set DataContext and Style using SetValue.
- Duplicate enum value - __
- Duplicate word in a comment - __
- Element documentation header should be preceded by blank line - An element documentation header above a C# element is not preceded by a blank line.
- Element documentation headers should not be followed by blank line - An element documentation header above a C# element is followed by a blank line.
- Element return value documentation should have text - The <returns> tag within a C# element's documentation header is empty.
- Element return value should be documented - A C# element is missing documentation for its return value.
- Element should begin with upper-case letter - The name of a C# element does not begin with an upper-case letter.
- Element should not be on a single line - A C# element containing opening and closing braces is written completely on a single line.
- Elements should be documented - A C# code element is missing a documentation header.
- Elements should be separated by blank line - Adjacent C# elements are not separated by a blank line.
- Elements should have the same indentation - Elements at the same level in the syntax tree should have the same indentation.
- Enum Storage should be Int32 - An enumeration is a value type that defines a set of related named constants. By default, the System.Int32 data type is used to store the constant value. Although you can change this underlying type, it is not required or recommended for most scenarios.
- Enum should declare explicit values - __
- Enum values should be on separate lines - Enum values should be placed on their own lines for maximum readability.
- Enumeration items should be documented - An item within a C# enumeration is missing an Xml documentation header.
- Enums should have zero value - The default value of an uninitialized enumeration, just as other value types, is zero. A nonflags-attributed enumeration should define a member by using the value of zero so that the default value is a valid value of the enumeration. If an enumeration that has the FlagsAttribute attribute applied defines a zero-valued member, its name should be ""None"" to indicate that no values have been set in the enumeration.
- Event accessors should follow order - An add accessor appears after a remove accessor within an event.
- EventArgs should not be null - __
- Exceptions should be public - An internal exception is visible only inside its own internal scope. After the exception falls outside the internal scope, only the base exception can be used to catch the exception. If the internal exception is inherited from T:System.Exception, T:System.SystemException, or T:System.ApplicationException, the external code will not have sufficient information to know what to do with the exception.
- Expression is always equal to true/false - __
- Field names should begin with lower-case letter - The name of a field in C# does not begin with a lower-case letter.
- Field names should begin with underscore - A field name in C# does not begin with an underscore.
- Field names should not begin with underscore - A field name in C# begins with an underscore.
- Field names should not contain underscore - A field name in C# contains an underscore.
- File contains no code - __
- File header company name text should match - The file header at the top of a C# code file does not contain the appropriate company name text.
- File header copyright text should match - The file header at the top of a C# code file does not contain the appropriate copyright text.
- File header file name documentation should match file name - The file attribute within copyright tag of the file header at the top of a C# code file does not contain the name of the file.
- File header should contain file name - The file header at the top of a C# code file is missing the file name.
- File header should have copyright text - The file header at the top of a C# code file is missing copyright text.
- File header should have summary - The file header at the top of a C# code file does not contain a filled-in summary tag.
- File header should have valid company text - The file header at the top of a C# code file does not contain company name text.
- File header should show copyright - The file header at the top of a C# code file is missing a copyright tag.
- File may only contain a single type - A C# code file contains more than one unique type.
- File name should match first type name - The file name of a C# code file does not match the first type declared in the file.
- File should have header - A C# code file is missing a standard file header.
- Fix documentation comment tag - __
- Format documentation comment summary - __
- Forward the 'CancellationToken' parameter to methods - Forward the 'CancellationToken' parameter to methods to ensure the operation cancellation notifications gets properly propagated, or pass in 'CancellationToken.None' explicitly to indicate intentionally not propagating the token.
- Forward the CancellationToken parameter to methods that take one - __
- Forward the CancellationToken using .WithCancellation() - __
- Forward the TimeProvider to methods that take one - __
- Generic type constraints should be on their own line - Each type constraint clause for a generic type parameter should be listed on a line of code by itself.
- IEqualityComparer<string> or IComparer<string> is missing - __
- Identifiers should not contain underscores - By convention, identifier names do not contain the underscore () character. This rule checks namespaces, types, members, and parameters._
- Implement IEquatable when overriding Object.Equals - When a type T overrides Object.Equals(object), the implementation must cast the object argument to the correct type T before performing the comparison. If the type implements IEquatable<T>, and therefore offers the method T.Equals(T), and if the argument is known at compile time to be of type T, then the compiler can call IEquatable<T>.Equals(T) instead of Object.Equals(object), and no cast is necessary, improving performance.
- Implement exception constructors - __
- Implement non-generic counterpart - __
- Implement standard exception constructors - Failure to provide the full set of constructors can make it difficult to correctly handle exceptions.
- Include/omit parentheses when creating new object - __
- Increment decrement symbols should be spaced correctly - An increment or decrement symbol within a C# element is not spaced correctly.
- Inline lazy initialization - __
- Inline local variable - __
- Instantiate argument exceptions correctly - A call is made to the default (parameterless) constructor of an exception type that is or derives from ArgumentException, or an incorrect string argument is passed to a parameterized constructor of an exception type that is or derives from ArgumentException.
- Interface methods should be callable by child types - An unsealed externally visible type provides an explicit method implementation of a public interface and does not provide an alternative externally visible method that has the same name.
- Interface names should begin with I - The name of a C# interface does not begin with the capital letter I.
- Invalid argument null check - __
- Invalid reference in a documentation comment - __
- Join string expressions - __
- Keywords should be spaced correctly - The spacing around a C# keyword is incorrect.
- Make class sealed - __
- Make class sealed - __
- Make class static - __
- Make class static - __
- Make field read-only - __
- Make interpolated string - __
- Make member readonly - __
- Make method an extension method - __
- Make method static (deprecated, use CA1822 instead) - __
- Make parameter ref read-only - __
- Make property static (deprecated, use CA1822 instead) - __
- Mark ISerializable types with serializable - To be recognized by the common language runtime as serializable, types must be marked by using the SerializableAttribute attribute even when the type uses a custom serialization routine through implementation of the ISerializable interface.
- Mark all non-serializable fields - An instance field of a type that is not serializable is declared in a type that is serializable.
- Mark attributes with AttributeUsageAttribute - __
- Mark attributes with AttributeUsageAttribute - __
- Mark enums with FlagsAttribute - An enumeration is a value type that defines a set of related named constants. Apply FlagsAttribute to an enumeration when its named constants can be meaningfully combined.
- Mark local variable as const - __
- Mark members as static - Members that do not access instance data or call instance methods can be marked as static. After you mark the methods as static, the compiler will emit nonvirtual call sites to these members. This can give you a measurable performance gain for performance-sensitive code.
- Mark publicly visible type with DebuggerDisplay attribute - __
- MarkupExtensionReturnType must use correct return type - MarkupExtensionReturnType must use correct return type.
- Member access symbols should be spaced correctly - The spacing around a member access symbol is incorrect, within a C# code file.
- Members defined on an interface with the 'DynamicInterfaceCastableImplementationAttribute' should be 'static' - Since a type that implements 'IDynamicInterfaceCastable' may not implement a dynamic interface in metadata, calls to an instance interface member that is not an explicit implementation defined on this type are likely to fail at runtime. Mark new interface members 'static' to avoid runtime errors.
- Merge 'else' with nested 'if' - __
- Merge 'if' with nested 'if' - __
- Merge preprocessor directives - __
- Merge switch sections with equivalent content - __
- Method overrides should not change default values - __
- Method overrides should not omit params keyword - __
- Name of CoerceValueCallback should match registered name - Name of CoerceValueCallback should match registered name.
- Name of PropertyChangedCallback should match registered name - Name of PropertyChangedCallback should match registered name.
- Name of ValidateValueCallback should match registered name - Name of ValidateValueCallback should match registered name.
- Name of the event should match registered name - Name of the event should match registered name.
- Name the invoked method OnEventName - Name the invoked method OnEventName.
- Name the invoked method OnEventName - Name the invoked method OnEventName.
- Negative signs should be spaced correctly - A negative sign within a C# element is not spaced correctly.
- Non-private readonly fields should begin with upper-case letter - The name of a non-private readonly C# field should being with an upper-case letter.
- Normalize format of enum flag value - __
- Normalize null check - __
- Normalize usage of infinite loop - __
- Nullable type symbols should be spaced correctly - A nullable type symbol within a C# element is not spaced correctly.
- Opening attribute brackets should be spaced correctly - An opening attribute bracket within a C# element is not spaced correctly.
- Opening braces should be spaced correctly - An opening brace within a C# element is not spaced correctly.
- Opening braces should not be followed by blank line - An opening brace within a C# element, statement, or expression is followed by a blank line.
- Opening braces should not be preceded by blank line - An opening brace within a C# element, statement, or expression is preceded by a blank line.
- Opening generic brackets should be spaced correctly - An opening generic bracket within a C# element is not spaced correctly.
- Opening parenthesis or bracket should be on declaration line - The opening parenthesis or bracket is not placed on the same line as the method/indexer/attribute/array name.
- Opening parenthesis should be spaced correctly - An opening parenthesis within a C# statement is not spaced correctly.
- Opening square brackets should be spaced correctly - An opening square bracket within a C# statement is not spaced correctly.
- Operator is unnecessary - __
- Operator keyword should be followed by space - The operator keyword within a C# operator overload method is not followed by any whitespace.
- Operator overloads have named alternates - An operator overload was detected, and the expected named alternative method was not found. The named alternative member provides access to the same functionality as the operator and is provided for developers who program in languages that do not support overloaded operators.
- Operators should have symmetrical overloads - A type implements the equality or inequality operator and does not implement the opposite operator.
- Optimize Enumerable.Count() usage - __
- Optimize LINQ method call - __
- Optimize StringBuilder usage - __
- Optimize StringBuilder.Append/AppendLine call - __
- Optimize method call - __
- Optimize string method usage - __
- Order elements in documentation comment - __
- Order modifiers - __
- Order named arguments according to the order of parameters - __
- Order type parameter constraints - __
- Overload operator equals on overriding value type Equals - In most programming languages there is no default implementation of the equality operator (==) for value types. If your programming language supports operator overloads, you should consider implementing the equality operator. Its behavior should be identical to that of Equals.
- Override Object.Equals(object) when implementing IEquatable<T> - When a type T implements the interface IEquatable<T>, it suggests to a user who sees a call to the Equals method in source code that an instance of the type can be equated with an instance of any other type. The user might be confused if their attempt to equate the type with an instance of another type fails to compile. This violates the "principle of least surprise".
- Override equals and operator equals on value types - For value types, the inherited implementation of Equals uses the Reflection library and compares the contents of all fields. Reflection is computationally expensive, and comparing every field for equality might be unnecessary. If you expect users to compare or sort instances, or to use instances as hash table keys, your value type should implement Equals.
- Override methods on comparable types - A public or protected type implements the System.IComparable interface. It does not override Object.Equals nor does it overload the language-specific operator for equality, inequality, less than, less than or equal, greater than or greater than or equal.
- Overriding member should not change 'params' modifier - __
- Parameter name differs from base name - __
- Parameter names should begin with lower-case letter - The name of a parameter in C# does not begin with a lower-case letter.
- Parameter names should match base declaration - Consistent naming of parameters in an override hierarchy increases the usability of the method overrides. A parameter name in a derived method that differs from the name in the base declaration can cause confusion about whether the method is an override of the base method or a new overload of the method.
- Parameter type should be nullable - Parameter type should be nullable.
- Parameters with [EditorRequired] attributes should also be marked as [Parameter] - __
- Parameters with [SupplyParameterFromQuery] attributes should also be marked as [Parameter] - __
- Partial elements should be documented - A C# partial element is missing a documentation header.
- Partial elements should declare access - The partial element does not have an access modifier defined.
- Positive signs should be spaced correctly - A positive sign within a C# element is not spaced correctly.
- Prefer 'AsSpan' over 'Substring' - 'AsSpan' is more efficient than 'Substring'. 'Substring' performs an O(n) string copy, while 'AsSpan' does not and has a constant cost.
- Prefer 'Clear' over 'Fill' - It is more efficient to use 'Clear', instead of 'Fill' with default value.
- Prefer 'Convert.ToHexString' and 'Convert.ToHexStringLower' over call chains based on 'BitConverter.ToString' - Use 'Convert.ToHexString' or 'Convert.ToHexStringLower' when encoding bytes to a hexadecimal string representation. These methods are more efficient and allocation-friendly than using 'BitConverter.ToString' in combination with 'String.Replace' to replace dashes and 'String.ToLower'.
- Prefer Dictionary.Contains methods - 'ContainsKey' is usually O(1), while 'Keys.Contains' may be O(n) in some cases. Additionally, many dictionary implementations lazily initialize the Keys collection to cut back on allocations.
- Prefer IsEmpty over Count - For determining whether the object contains or not any items, prefer using 'IsEmpty' property rather than retrieving the number of items from the 'Count' property and comparing it to 0 or 1.
- Prefer generic overload when type is known - Using a generic overload is preferable to the 'System.Type' overload when the type is known, promoting cleaner and more type-safe code with improved compile-time checks.
- Prefer rethrowing an exception implicitly - __
- Prefer static 'HashData' method over 'ComputeHash' - It is more efficient to use the static 'HashData' method over creating and managing a HashAlgorithm instance to call 'ComputeHash'.
- Prefer strongly-typed Append and Insert method overloads on StringBuilder - StringBuilder.Append and StringBuilder.Insert provide overloads for multiple types beyond System.String. When possible, prefer the strongly-typed overloads over using ToString() and the string-based overload.
- Prefer the 'IDictionary.TryAdd(TKey, TValue)' method - Prefer a 'TryAdd' call over an 'Add' call guarded by a 'ContainsKey' check. 'TryAdd' behaves the same as 'Add', except that when the specified key already exists, it returns 'false' instead of throwing an exception.
- Prefer the 'IDictionary.TryGetValue(TKey, out TValue)' method - Prefer a 'TryGetValue' call over a Dictionary indexer access guarded by a 'ContainsKey' check. 'ContainsKey' and the indexer both would lookup the key under the hood, so using 'TryGetValue' removes the extra lookup.
- Prefer the 'Memory'-based overloads for 'ReadAsync' and 'WriteAsync' - 'Stream' has a 'ReadAsync' overload that takes a 'Memory<Byte>' as the first argument, and a 'WriteAsync' overload that takes a 'ReadOnlyMemory<Byte>' as the first argument. Prefer calling the memory based overloads, which are more efficient.
- Prefix local calls with this - A call to an instance member of the local class or a base class is not prefixed with 'this.', within a C# code file.
- Preprocessor keywords should not be preceded by space - A C# preprocessor-type keyword is preceded by space.
- Property accessors should follow order - A get accessor appears after a set accessor within a property or indexer.
- Property changed callback should have standard documentation text - Property changed callback should have standard documentation text.
- Property documentation should have value - The XML header documentation for a C# property does not contain a <value> tag.
- Property documentation should have value text - The XML header documentation for a C# property contains an empty <value> tag.
- Property summary documentation should match accessors - The documentation text within a C# property’s <summary> tag does not match the accessors within the property.
- Property summary documentation should omit accessor with restricted access - The documentation text within a C# property’s <summary> tag takes into account all of the accessors within the property, but one of the accessors has limited access.
- Protected should come before internal - The keyword '0' is positioned after the keyword '1' within the declaration of a 0 1 C# element.
- Provide a parameterless constructor that is as visible as the containing type for concrete types derived from 'System.Runtime.InteropServices.SafeHandle' - Providing a parameterless constructor that is as visible as the containing type for a type derived from 'System.Runtime.InteropServices.SafeHandle' enables better performance and usage with source-generated interop solutions.
- Put constructor initializers on their own line - A constructor initializer, including the colon character, should be on its own line.
- Query clause should begin on new line when previous clause spans multiple lines - A clause within a C# query expression begins on the same line as the previous clause, when the previous clause spans across multiple lines.
- Query clause should follow previous clause - A C# query clause does not begin on the same line as the previous clause, or on the next line.
- Query clauses should be on separate lines or all on one line - The clauses within a C# query expression are not all placed on the same line, and each clause is not placed on its own line.
- Query clauses spanning multiple lines should begin on own line - A clause within a C# query expression spans across multiple lines, and does not begin on its own line.
- Reduce 'if' nesting - __
- Register containing member name as name for routed command - Register containing member name as name for routed command.
- Register containing type as owner for routed command - Register containing type as owner for routed command.
- Register name and owning type for routed command - Register containing type as owner for routed command.
- Remove 'partial' modifier from type with a single part - __
- Remove argument list from attribute - __
- Remove braces - __
- Remove braces from if-else - __
- Remove delegate parenthesis when possible - A call to a C# anonymous method does not contain any method parameters, yet the statement still includes parenthesis.
- Remove empty Finalizers - Finalizers should be avoided where possible, to avoid the additional performance overhead involved in tracking object lifetime.
- Remove empty statement - __
- Remove empty syntax - __
- Remove enum default underlying type - __
- Remove original exception from throw statement - __
- Remove redundant 'ToCharArray' call - __
- Remove redundant 'ToString' call - __
- Remove redundant 'as' operator - __
- Remove redundant 'sealed' modifier - __
- Remove redundant Dispose/Close call - __
- Remove redundant argument value - __
- Remove redundant assignment - __
- Remove redundant async/await - __
- Remove redundant auto-property initialization - __
- Remove redundant base constructor call - __
- Remove redundant base interface - __
- Remove redundant boolean literal - __
- Remove redundant cast - __
- Remove redundant catch block - __
- Remove redundant constructor - __
- Remove redundant default switch section - __
- Remove redundant delegate creation - __
- Remove redundant field initialization - __
- Remove redundant overriding member - __
- Remove redundant parentheses - __
- Remove redundant statement - __
- Remove trailing white-space - __
- Remove unnecessary 'else' - __
- Remove unnecessary braces from record declaration - __
- Remove unnecessary braces in switch section - __
- Remove unnecessary case label - __
- Remove unused member declaration - __
- Remove useless OrderBy call - __
- Remove useless ToString call - __
- Replace constant Enum.ToString with nameof - __
- Resource can be disposed asynchronously - __
- Rethrow to preserve stack details - __
- Return Task.FromResult instead of returning null - __
- Return completed task instead of returning null - __
- Seal internal types - When a type is not accessible outside its assembly and has no subtypes within its containing assembly, it can be safely sealed. Sealing types can improve performance.
- Seal methods that satisfy private interfaces - An inheritable public type provides an overridable method implementation of an internal (Friend in Visual Basic) interface. To fix a violation of this rule, prevent the method from being overridden outside the assembly.
- Semicolons should be spaced correctly - The spacing around a semicolon is incorrect, within a C# code file.
- Sender should be 'this' for instance events - __
- Set mutable dependency properties using SetCurrentValue - Prefer setting mutable dependency properties using SetCurrentValue.
- Simplify 'default' expression - __
- Simplify Nullable<T> to T? - __
- Simplify argument null check - __
- Simplify boolean comparison - __
- Simplify coalesce expression - __
- Simplify code branching - __
- Simplify conditional expression - __
- Simplify lazy initialization - __
- Simplify logical negation - __
- Simplify nested using statement - __
- Simplify numeric comparison - __
- Single line comments should begin with single space - A single-line comment within a C# code file does not begin with a single space.
- Single-line comment should be preceded by blank line - A single-line comment within C# code is not preceded by a blank line.
- Single-line comments should not be followed by blank line - A single-line comment within C# code is followed by a blank line.
- Single-line comments should not use documentation style slashes - The C# code contains a single-line comment which begins with three forward slashes in a row.
- Sort enum members - __
- Specify a culture or use an invariant version - Specify culture to help avoid accidental implicit dependency on current culture. Using an invariant version yields consistent results regardless of the culture of an application.
- Specify marshaling for P/Invoke string arguments - A platform invoke member allows partially trusted callers, has a string parameter, and does not explicitly marshal the string. This can cause a potential security vulnerability.
- Split parameters should start on line after declaration - The parameters to a C# method or indexer call or declaration span across multiple lines, but the first parameter does not start on the line after the opening bracket.
- Split variable declaration - __
- Statement should not be on a single line - A C# statement containing opening and closing braces is written completely on a single line.
- Statement should not use unnecessary parenthesis - A C# statement contains parenthesis which are unnecessary and should be removed.
- Statement should not use unnecessary parenthesis - A C# statement contains parenthesis which are unnecessary and should be removed.
- Static field names should begin with underscore - A static field name in C# does not begin with an underscore.
- Static holder types should be Static or NotInheritable - __
- Static readonly fields should begin with upper-case letter - The name of a static readonly field does not begin with an upper-case letter.
- Store files as UTF-8 with byte order mark - Source files should be saved using the UTF-8 encoding with a byte order mark
- String contains an implicit end of line character - __
- StringComparison is missing - __
- StyleTypedProperty is missing - StyleTypedProperty is missing.
- Symbols should be spaced correctly - The spacing around an operator symbol is incorrect, within a C# code file.
- System using directives should be placed before other using directives - A using directive which declares a member of the 'System' namespace appears after a using directive which declares a member of a different namespace, within a C# code file.
- Test for NaN correctly - This expression tests a value against Single.Nan or Double.Nan. Use Single.IsNan(Single) or Double.IsNan(Double) to test the value.
- Test for empty strings using string length - Comparing strings by using the String.Length property or the String.IsNullOrEmpty method is significantly faster than using Equals.
- The callback is trivial, convert to lambda - The callback is trivial, convert to lambda for better locality.
- This method uses runtime marshalling even when the 'DisableRuntimeMarshallingAttribute' is applied - This method uses runtime marshalling even when runtime marshalling is disabled, which can cause unexpected behavior differences at runtime due to different expectations of a type's native layout.
- Type parameter names should begin with T - The name of a C# type parameter does not begin with the capital letter T.
- Types that own disposable fields should be disposable - A class declares and implements an instance field that is a System.IDisposable type, and the class does not implement IDisposable. A class that declares an IDisposable field indirectly owns an unmanaged resource and should implement the IDisposable interface.
- URI-like parameters should not be strings - This rule assumes that the parameter represents a Uniform Resource Identifier (URI). A string representation or a URI is prone to parsing and encoding errors, and can lead to security vulnerabilities. 'System.Uri' class provides these services in a safe and secure manner.
- Unconstrained type parameter checked for null - __
- Unnecessary assignment - __
- Unnecessary call to 'Contains(item)' - Do not guard 'Add(item)' or 'Remove(item)' with 'Contains(item)' for the set. The former two already check whether the item exists and will return if it was added or removed.
- Unnecessary call to 'Dictionary.ContainsKey(key)' - Do not guard 'Dictionary.Remove(key)' with 'Dictionary.ContainsKey(key)'. The former already checks whether the key exists, and will not throw if it does not.
- Unnecessary enum flag - __
- Unnecessary explicit use of enumerator - __
- Unnecessary interpolated string - __
- Unnecessary interpolation - __
- Unnecessary null check - __
- Unnecessary null-forgiving operator - __
- Unnecessary raw string literal - __
- Unnecessary semicolon at the end of declaration - __
- Unnecessary unsafe context - __
- Unnecessary usage of verbatim string literal - __
- Unused element in a documentation comment - __
- Unused parameter - __
- Unused type parameter - __
- Use "" or 'string.Empty' - __
- Use 'Cast' instead of 'Select' to cast - __
- Use 'Count/Length' property instead of 'Any' method - __
- Use 'Environment.CurrentManagedThreadId' - 'Environment.CurrentManagedThreadId' is simpler and faster than 'Thread.CurrentThread.ManagedThreadId'.
- Use 'Environment.ProcessId' - 'Environment.ProcessId' is simpler and faster than 'Process.GetCurrentProcess().Id'.
- Use 'Environment.ProcessPath' - 'Environment.ProcessPath' is simpler and faster than 'Process.GetCurrentProcess().MainModule.FileName'.
- Use 'HasFlag' method or bitwise operator - __
- Use 'Order' instead of 'OrderBy' - __
- Use 'StartsWith' instead of 'IndexOf' - It is both clearer and faster to use 'StartsWith' instead of comparing the result of 'IndexOf' to zero.
- Use 'ThrowIfCancellationRequested' - 'ThrowIfCancellationRequested' automatically checks whether the token has been canceled, and throws an 'OperationCanceledException' if it has.
- Use 'for' statement instead of 'while' statement - __
- Use 'is' operator instead of 'as' operator - __
- Use 'is' operator instead of SequenceEqual - __
- Use 'string.Equals' - It is both clearer and likely faster to use 'string.Equals' instead of comparing the result of 'string.Compare' to zero.
- Use 'string.IsNullOrEmpty' method - __
- Use 'var' or explicit type - __
- Use --/++ operator instead of assignment - __
- Use ArgumentException throw helper - Throw helpers are simpler and more efficient than an if block constructing a new exception instance.
- Use ArgumentNullException throw helper - Throw helpers are simpler and more efficient than an if block constructing a new exception instance.
- Use ArgumentOutOfRangeException throw helper - Throw helpers are simpler and more efficient than an if block constructing a new exception instance.
- Use Array.Empty<T>() - __
- Use AsSpan or AsMemory instead of Range-based indexers when appropriate - The Range-based indexer on string values produces a copy of requested portion of the string. This copy is usually unnecessary when it is implicitly used as a ReadOnlySpan or ReadOnlyMemory value. Use the AsSpan method to avoid the unnecessary copy.
- Use AsSpan or AsMemory instead of Range-based indexers when appropriate - The Range-based indexer on array values produces a copy of requested portion of the array. This copy is usually unnecessary when it is implicitly used as a ReadOnlySpan or ReadOnlyMemory value. Use the AsSpan method to avoid the unnecessary copy.
- Use AsSpan or AsMemory instead of Range-based indexers when appropriate - The Range-based indexer on array values produces a copy of requested portion of the array. This copy is often unwanted when it is implicitly used as a Span or Memory value. Use the AsSpan method to avoid the copy.
- Use AttributeUsageAttribute - __
- Use DateTime.UnixEpoch - __
- Use DateTimeOffset.UnixEpoch - __
- Use EventArgs.Empty - __
- Use EventArgs.Empty - __
- Use EventHandler<T> - __
- Use Guid.Empty - __
- Use InvokeVoidAsync when the returned value is not used - __
- Use Length/Count property instead of Count() when available - Enumerable.Count() potentially enumerates the sequence while a Length/Count property is a direct access.
- Use ObjectDisposedException throw helper - Throw helpers are simpler and more efficient than an if block constructing a new exception instance.
- Use Regex instance instead of static method - __
- Use SequenceEqual instead of equality operator - __
- Use SetValue in setter - Use SetValue in setter.
- Use String.Equals instead of equality operator - __
- Use StringComparer.GetHashCode instead of string.GetHashCode - __
- Use StringComparison when comparing strings - __
- Use Task.ConfigureAwait - __
- Use ^ operator - __
- Use a cached 'SearchValues' instance - Using a cached 'SearchValues' instance is more efficient than passing values to 'IndexOfAny'/'ContainsAny' directly.
- Use an explicit StringComparer when possible - __
- Use anonymous function or method group - __
- Use async/await when necessary - __
- Use auto-implemented property - __
- Use block body or expression body - __
- Use braces consistently - The opening and closing braces of a chained if/else if/else construct were included for some clauses, but omitted for others.
- Use built-in type alias - The code uses one of the basic C# types, but does not use the built-in alias for the type.
- Use char literal for a single character lookup - 'string.Contains(char)' is available as a better performing overload for single char lookup.
- Use char overload - The char overload is a better performing overload than a string with a single char.
- Use coalesce expression - __
- Use coalesce expression instead of 'if' - __
- Use coalesce expression instead of conditional expression - __
- Use compound assignment - __
- Use conditional access - __
- Use conditional access instead of conditional expression - __
- Use constant instead of field - __
- Use containing member as key when creating a ComponentResourceKey - Use containing member as key when creating a ComponentResourceKey.
- Use containing type when creating a ComponentResourceKey - Use containing type when creating a ComponentResourceKey.
- Use correct argument for [AttachedPropertyBrowsableForType] - Use correct argument for [AttachedPropertyBrowsableForType].
- Use correct handler type - Use correct handler type.
- Use direct methods instead of LINQ methods - __
- Use element access - __
- Use enum field explicitly - __
- Use exception filter - __
- Use explicitly/implicitly typed array - __
- Use implicit/explicit object creation - __
- Use indexer instead of LINQ methods - __
- Use lambda expression instead of anonymous method - __
- Use lambda syntax - Lambda expressions are more succinct and easier to read than anonymous methods, so they should are preferred whenever the two are functionally equivalent.
- Use langword in XML comment - __
- Use line endings correctly at end of file - Code should not contain blank lines at the end of the file
- Use literal suffix notation instead of casting - Use literal suffix notation instead of casting, in order to improve readability, avoid bugs related to illegal casts and ensure that optimal IL is produced.
- Use literals where appropriate - A field is declared static and read-only (Shared and ReadOnly in Visual Basic), and is initialized by using a value that is computable at compile time. Because the value that is assigned to the targeted field is computable at compile time, change the declaration to a const (Const in Visual Basic) field so that the value is computed at compile time instead of at runtime.
- Use method chaining - __
- Use nameof operator - __
- Use nameof operator in ArgumentException - __
- Use nameof to express symbol names - Using nameof helps keep your code valid when refactoring.
- Use nameof() instead of constant - Use nameof() as it is less fragile than constant.
- Use nameof() instead of literal - Use nameof() as it is less fragile than string literal.
- Use ordinal string comparison - A string comparison operation that is nonlinguistic does not set the StringComparison parameter to either Ordinal or OrdinalIgnoreCase. By explicitly setting the parameter to either StringComparison.Ordinal or StringComparison.OrdinalIgnoreCase, your code often gains speed, becomes more correct, and becomes more reliable.
- Use parentheses to make not pattern clearer - __
- Use pattern matching instead of combination of 'as' operator and null check - __
- Use pattern matching instead of combination of 'is' operator and cast operator - __
- Use pattern matching instead of equality operators for discrete value - __
- Use pattern matching instead of equality operators for null check - __
- Use pattern matching instead of inequality operators for discrete value - __
- Use pattern matching instead of inequality operators for null check - __
- Use predefined type - __
- Use raw string literal - __
- Use read-only auto-implemented property - __
- Use readable conditions - When a comparison is made between a variable and a literal, the variable should be placed on the left-hand-side to maximize readability.
- Use short-circuiting operator - __
- Use span-based 'string.Concat' - It is more efficient to use 'AsSpan' and 'string.Concat', instead of 'Substring' and a concatenation operator.
- Use string interpolation instead of 'string.Concat' - __
- Use string.Create instead of FormattableString - __
- Use string.Empty for empty strings - The C# code includes an empty string, written as "".
- Use string.Length instead of comparison with empty string - __
- Use tabs correctly - The code contains a tab or space character which is not consistent with the current project settings.
- Use the 'StringComparison' method overloads to perform case-insensitive string comparisons - Avoid calling 'ToLower', 'ToUpper', 'ToLowerInvariant' and 'ToUpperInvariant' to perform case-insensitive string comparisons because they lead to an allocation. Instead, prefer calling the method overloads of 'Contains', 'IndexOf' and 'StartsWith' that take a 'StringComparison' enum value to perform case-insensitive comparisons. Switching to using an overload that takes a 'StringComparison' might cause subtle changes in behavior, so it's important to conduct thorough testing after applying the suggestion. Additionally, if a culturally sensitive comparison is not required, consider using 'StringComparison.OrdinalIgnoreCase'.
- Use the Regex source generator - __
- Use trailing comma in multi-line initializers - A multi-line initializer in a C# code file should use a comma on the last line.
- Using alias directives should be ordered alphabetically by alias name - The using-alias directives within a C# code file are not sorted alphabetically by alias name.
- Using alias directives should be placed after other using directives - A using-alias directive is positioned before a regular using directive.
- Using directives should be ordered alphabetically by namespace - The using directives within a C# code file are not sorted alphabetically by namespace.
- Using directives should be placed correctly - A C# using directive is placed outside of a namespace element.
- Using directives should be qualified - All using directives should be qualified.
- Using static directives should be ordered alphabetically - All using static directives should be ordered alphabetically.
- Using static directives should be placed at the correct location. - A using static directive is positioned before a regular or after an alias using directive.
- Validate arguments correctly - __
- Validate arguments correctly in iterator methods - __
- Value type object is never equal to null - __
- ValueConversion must use correct types - ValueConversion must use correct types.
- Variable names should begin with lower-case letter - The name of a variable in C# does not begin with a lower-case letter.
- Variable names should not be prefixed - A field name in C# is prefixed with 'm', 's_', or 't_'._
- Void return value should not be documented - A C# code element does not contain a return value, or returns void, but the documentation header for the element contains a <returns> tag.
- While-do footer should not be preceded by blank line - The while footer at the bottom of a do-while statement is separated from the statement by a blank line.
- XmlnsDefinitions does not map all namespaces with public types - XmlnsDefinitions does not map all namespaces with public types.
- [ConstructorArgument] must match - [ConstructorArgument] must match the name of the constructor parameter.
- [deprecated] Avoid usage of do statement to create an infinite loop - __
- [deprecated] Avoid usage of for statement to create an infinite loop - __
- [deprecated] Avoid usage of while statement to create an infinite loop - __
- [deprecated] Format documentation summary on a single line - __
- [deprecated] Format documentation summary on multiple lines - __
- [deprecated] Remove empty 'else' clause - __
- [deprecated] Remove empty 'finally' clause - __
- [deprecated] Remove empty destructor - __
- [deprecated] Remove empty initializer - __
- [deprecated] Remove empty namespace declaration - __
- [deprecated] Remove empty region - __
- [deprecated] Remove empty statement - __
- [deprecated] Remove redundant comma in initializer - __
- [deprecated] Remove unnecessary blank line - __
- [deprecated] Use 'var' instead of explicit type (in foreach) - __
- [deprecated] Use 'var' instead of explicit type (when the type is not obvious) - __
- [deprecated] Use 'var' instead of explicit type (when the type is obvious) - __
- [deprecated] Use bit shift operator - __
- [deprecated] Use explicit type instead of 'var' (foreach variable) - __
- [deprecated] Use explicit type instead of 'var' (when the type is not obvious) - __
- [deprecated] Use explicit type instead of 'var' (when the type is obvious) - __
rewrite-devcenter
- Parent POM upgrade - Determine the current state of a repository relative to a desired parent POM upgrade.
rewrite-docker
- Find uses of docker base images - Produce an impact analysis of base images used in Dockerfiles, .gitlab-ci files, Kubernetes Deployment file, etc.
rewrite-dotnet
- Analyze a .NET project using upgrade-assistant - Run upgrade-assistant analyze across a repository to analyze changes required to upgrade projects to a newer version of .NET. This recipe will generate an
org.openrewrite.dotnet.UpgradeAssistantAnalysis
data table containing the report details.
rewrite-dropwizard
- Remove
super
calls when the class does not extend another class - Removes calls tosuper(...)
orsuper.someMethod(...)
if the class does not have a real superclass besidesjava.lang.Object
.
rewrite-feature-flags
- Change the default value for feature key - Change the default value for
Variation
invocations for feature key. - Find a FF4j feature flag - Find a FF4j feature flag.
- Find a LaunchDarkly feature flag - Find a LaunchDarkly feature flag.
- Find an OpenFeature feature flag - Find an OpenFeature feature flag.
- Find an Unleash feature flag - Find an Unleash feature flag.
- Remove FF4j's
check
for feature key - Replacecheck()
invocations forfeatureKey
withreplacementValue
, and simplify constant if branch execution. - Remove LaunchDarkly's
boolVariation
for feature key - ReplaceboolVariation
invocations for feature key with value, and simplify constant if branch execution. - Remove LaunchDarkly's
boolVariation
for feature key - ReplaceboolVariation
invocations for feature key with value, and simplify constant if branch execution. - Remove OpenFeature's
getBooleanValue
for feature key - ReplacegetBooleanValue()
invocations forfeatureKey
withreplacementValue
, and simplify constant if branch execution. - Remove Unleash's
isEnabled
for feature key - ReplaceisEnabled()
invocations forfeatureKey
withreplacementValue
, and simplify constant if branch execution.
rewrite-github-actions
- Add cron workflow trigger - The
schedule
event allows you to trigger a workflow at a scheduled time. - Cancel in-progress workflow when it is triggered again - When a workflow is already running and would be triggered again, cancel the existing workflow. See
styfle/cancel-workflow-action
for details. - Change GitHub Action version - Change the version of a GitHub Action in any
.github/workflows/*.yml
file. - Find jobs missing timeout - Find GitHub Actions jobs missing a timeout.
- Remove all cron triggers - Removes all cron triggers from a workflow.
- Replace runners for a job - Replaces the runners of a given job.
- Setup Java dependency caching - GitHub actions supports dependency caching on Maven and Gradle projects. See the blog post.
- Upgrade
slackapi/slack-github-action
- Update the Slack GitHub Action to use version 2.0. - Use
actions/setup-java
IBMsemeru
distribution - Adopt OpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from adopt-openj9 to IBM semeru to keep receiving software and security updates. See more details in the Good-bye AdoptOpenJDK post. - Use
actions/setup-java
temurin
distribution - Adopt OpenJDK got moved to Eclipse Temurin and won't be updated anymore. It is highly recommended to migrate workflows from adopt to temurin to keep receiving software and security updates. See more details in the Good-bye AdoptOpenJDK post. - Use
actions/setup-java
temurin
distribution as they are cached in hosted runners - Host runners include Temurin by default as part of the (hosted tool cache)(https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#hosted-tool-cache). Using Temurin speeds up builds as there is no need to download and configure the Java SDK with every build. - Use
secrets: inherit
if possible - Pass all secrets to a reusable workflow usingsecrets: inherit
. See Simplify using secrets with reusable workflows for details.
rewrite-gitlab
- Add GitLab component - Add a GitLab component to an existing list, or add a new list where none was present.
- Add GitLab stages - Add or Update the set of stages defined in
.gitlab-ci.yml
. - Add GitLab template - Add a GitLab template to an existing list, or add a new list where none was present.
- Change GitLab Component - Change a GitLab Component in use.
- Change GitLab template - Change a GitLab template in use.
- Find GitLab Component - Find a GitLab Component in use.
- Find GitLab Template - Find a GitLab Template in use.
- Remove GitLab template - Remove a GitLab template from use.
rewrite-gradle
- Add Gradle platform dependency - Add a gradle platform dependency to a
build.gradle
file in the correct configuration based on where it is used. - Add Gradle plugin - Add a build plugin to a Gradle build file's
plugins
block. - Add Gradle settings plugin - Add plugin to Gradle settings file
plugins
block by id. - Add a Gradle settings repository - Add a Gradle settings repository to
settings.gradle(.kts)
. - Add the Develocity Gradle plugin - Add the Develocity Gradle plugin to settings.gradle files.
- Change Extra Property - Gradle's ExtraPropertiesExtension is a commonly used mechanism for setting arbitrary key/value pairs on a project. This recipe will change the value of a property with the given key name if that key can be found. It assumes that the value being set is a String literal. Does not add the value if it does not already exist.
- Change Gradle dependency - Change a Gradle dependency coordinates. The
newGroupId
ornewArtifactId
MUST be different from before. - Change a Gradle dependency classifier - Changes classifier of an existing dependency declared in
build.gradle
files. - Change a Gradle dependency extension - Changes extension of an existing dependency declared in
build.gradle
files. - Change a Gradle plugin - Changes the selected Gradle plugin to the new plugin.
- Change a Gradle plugin version by id - Change a Gradle plugin by id to a later version.
- Dependency constraint to resolution rule - Gradle dependency constraints are useful for managing the versions of transitive dependencies. Some plugins, such as the Spring Dependency Management plugin, do not respect these constraints. This recipe converts constraints into resolution rules, which can achieve similar effects to constraints but are harder for plugins to ignore.
- Does not include Gradle dependency - A precondition which returns false if visiting a Gradle file which includes the specified dependency in the classpath of some scope. For compatibility with multimodule projects, this should most often be applied as a precondition.
- Enable Develocity build cache - Adds
buildCache
configuration todevelocity
where not yet present. - Find Gradle JVMTestSuite plugin configuration - Find Gradle JVMTestSuite plugin configurations and produce a data table.
- Find Gradle dependency - Finds dependencies declared in gradle build files. See the reference on Gradle configurations or the diagram below for a description of what configuration to use. A project's compile and runtime classpath is based on these configurations. <img alt="Gradle compile classpath" src="https://docs.gradle.org/current/userguide/img/java-library-ignore-deprecated-main.png" width="200px"/> A project's test classpath is based on these configurations. <img alt="Gradle test classpath" src="https://docs.gradle.org/current/userguide/img/java-library-ignore-deprecated-test.png" width="200px"/>.
- Find Gradle plugin - Find a Gradle plugin by id and/or class name. For best results both should be specified, as one cannot automatically be used to infer the other.
- Find Gradle projects - Gradle projects are those with
build.gradle
orbuild.gradle.kts
files. - Find Gradle repository - Find a Gradle repository by url.
- Find Gradle wrappers - Find Gradle wrappers.
- Migrate from Gradle Enterprise to Develocity - Migrate from the Gradle Enterprise Gradle plugin to the Develocity Gradle plugin.
- Module has dependency - Searches for Gradle Projects (modules) that have a dependency matching the specified id or implementing class. Places a
SearchResult
marker on all sources within a project with a matching dependency. This recipe is intended to be used as a precondition for other recipes. For example this could be used to limit the application of a spring boot migration to only projects that use spring-boot-starter, limiting unnecessary upgrading. If the search result you want is instead just the build.gradle(.kts) file that use the dependency, use theFindDependency
recipe instead. - Module has plugin - Searches for Gradle Projects (modules) that have a plugin matching the specified id or implementing class. Places a
SearchResult
marker on all sources within a project with a matching plugin. This recipe is intended to be used as a precondition for other recipes. For example this could be used to limit the application of a spring boot migration to only projects that apply the spring dependency management plugin, limiting unnecessary upgrading. If the search result you want is instead just the build.gradle(.kts) file applying the plugin, use theFindPlugins
recipe instead. - Remove a Gradle dependency - Removes a single dependency from the dependencies section of the
build.gradle
. - Remove redundant explicit dependencies and versions - Remove explicitly-specified dependencies and dependency versions that are managed by a Gradle
platform
/enforcedPlatform
. - Remove repository - Removes a repository from Gradle build scripts. Named repositories include "jcenter", "mavenCentral", "mavenLocal", and "google".
- Upgrade transitive Gradle dependencies - Upgrades the version of a transitive dependency in a Gradle build file. There are many ways to do this in Gradle, so the mechanism for upgrading a transitive dependency must be considered carefully depending on your style of dependency management.
- Use HTTPS for repositories - Use HTTPS for repository URLs.
- Use
Map
notation for Gradle dependency declarations - In Gradle, dependencies can be expressed as aString
like"groupId:artifactId:version"
, or equivalently as aMap
likegroup: 'groupId', name: 'artifactId', version: 'version'
(groovy) orgroup = "groupId", name = "artifactId", version = "version"
(kotlin). This recipe replaces dependencies represented asStrings
with an equivalent dependency represented as aMap
.
rewrite-groovy
- Format Groovy code - Format Groovy code using a standard comprehensive set of Groovy formatting recipes.
- Groovy GString curly braces - In Groovy GStrings, curly braces are optional for single variable expressions. This recipe adds them, so that the expression is always surrounded by curly braces.
- Move a closure which is the last argument of a method invocation out of parentheses - Groovy allows a shorthand syntax that allows a closure to be placed outside of parentheses.
- Stylize Groovy code to omit parentheses - Omit parentheses for last argument lambdas in Groovy code.
rewrite-hcl
- Blank lines - Add and/or remove blank lines.
- Delete content - Delete HCL content by path.
- Find and replace literals in HCL files - Find and replace literal values in HCL files. This recipe parses the source files on which it runs as HCL, meaning you can execute HCL language-specific recipes before and after this recipe in a single recipe run.
- Find content - Find HCL content by path.
- Format HCL code - Format HCL code using a standard comprehensive set of HCL formatting recipes.
- Move content to another file - Move content to another HCL file, deleting it in the original file.
- Normalize format - Move whitespace to the outermost LST element possible.
- Remove trailing whitespace - Remove any extra trailing whitespace from the end of each line.
- Replace legacy attribute index syntax - Replace legacy attribute index syntax (
.0
) with the new syntax ([0]
). - Spaces - Format whitespace in HCL code.
- Tabs and indents - Format tabs and indents in HCL code.
rewrite-hibernate
- Find JPQL definitions - Find Java Persistence Query Language definitions in the codebase.
- Migrate
UserType
to Hibernate 6 - With Hibernate 6 theUserType
interface received a type parameter making it more strictly typed. This recipe applies the changes required to adhere to this change.
rewrite-java
- Add a
null
method argument - Add anull
argument to method invocations. - Add comment to method invocations - Add a comment to method invocations in a Java source file.
- Add method parameter to a method declaration - Adds a new method parameter to an existing method declaration.
- Blank lines - Add and/or remove blank lines.
- Calculate token length of classes - Locates class definitions and predicts the number of token in each.
- Calculate token length of method definitions - Locates method definitions and predicts the number of token in each.
- Change method target to variable - Change method invocations to method calls on a variable.
- Change type in String literals - Change a given type to another when used in a String literal.
- Check whether a type is not in use - Useful as a precondition to skip over compilation units using the argument type.
- Create Java class - Create a new, empty Java class.
- Demonstrate rendering of
Markup
markers - Tooling may decide to elide or display differently markup of different levels. - Find class hierarchy - Discovers all class declarations within a project, recording which files they appear in, their superclasses, and interfaces. That information is then recorded in a data table.
- Find compile errors - Compile errors result in a particular LST structure that can be searched for.
- Find empty classes - Find empty classes without annotations that do not implement an interface or extend a class.
- Find fields - Find uses of a field.
- Find fields of type - Finds declared fields matching a particular class name.
- Find files compiled at a specific Java version - Finds Java source files matching a particular language level. This is useful especially as a precondition for other recipes.
- Find files in a source set - Source sets are a way to organize your source code into logical groups. For example, Java projects commonly have a
main
source set for application code and atest
source set for test code. This recipe will find all files in a given source set. - Find files that are likely not tests - Sources that do not contain indicators of being, or being exclusively for the use in tests. This recipe is simply a negation of the
org.openrewrite.java.search.IsLikelyTest
recipe. - Find files with a particular build tool version - Finds Java source files built with a particular build tool. This is useful especially as a precondition for other recipes.
- Find literals - Find literals matching a pattern.
- Find method declaration - Locates the declaration of a method.
- Find methods with empty bodies - Find methods with empty bodies and single public no arg constructors.
- Find missing type information on Java LSTs - This is a diagnostic recipe to highlight where LSTs are missing type attribution information.
- Find source files with imports - Locates source files that have imports matching the given type pattern, regardless of whether that import is used in the code.
- Find sources that are likely tests - Sources that contain indicators of being, or being exclusively for the use in tests. This recipe is not exhaustive, but is intended to be a good starting point for finding test sources. Looks at the source set name, and types in use; for example looks for uses of JUnit & TestNG annotations/assertions.
- Find the oldest Java version in use - The oldest Java version in use is the lowest Java version in use in any source set of any subproject of a repository. It is possible that, for example, the main source set of a project uses Java 8, but a test source set uses Java 17. In this case, the oldest Java version in use is Java 8.
- Find type mappings - Study the frequency of
J
types and theirJavaType
type attribution. - Find types - Find type references by name.
- Find uses of
@Repeatable
annotations - Java 8 introduced the concept of@Repeatable
annotations. - Find uses of deprecated classes, methods, and fields - Find deprecated uses of methods, fields, and types. Optionally ignore those classes that are inside deprecated scopes.
- Format Java code - Format Java code using a standard comprehensive set of Java formatting recipes.
- Normalize format - Move whitespace to the outermost LST element possible.
- Normalize line breaks - Consistently use either Windows style (CRLF) or Linux style (LF) line breaks. If no
GeneralFormatStyle
is specified this will use whichever style of line endings are more common. - Normalize to tabs or spaces - Consistently use either tabs or spaces in indentation.
- Randomize tree IDs - Scramble the IDs. This was intended as a utility to test en masse different techniques for UUID generation and compare their relative performance outside a microbenchmark.
- Remove interface implementations - Removes
implements
clauses from classes implementing the specified interface. Removes@Overrides
annotations from methods which no longer override anything. - Remove static import - Removes static imports and replaces them with qualified references. For example,
emptyList()
becomesCollections.emptyList()
. - Replace String literal with constant - Replace String literal with constant, adding import on class if needed.
- Replace annotation - Replace an Annotation with another one if the annotation pattern matches. Only fixed parameters can be set in the replacement.
- Replace constant with literal value - Replace a named constant with a literal value when you wish to remove the old constant. A
String
literal must include escaped quotes. - Result of method call ignored - Find locations where the result of the method call is being ignored.
- Single line comments begin with a whitespace - Write
// hi
instead of//hi
. - Spaces - Format whitespace in Java code.
- Study the size of the classpath by source set - Emit one data table row per source set in a project, with the number of types in the source set.
- Tabs and indents - Format tabs and indents in Java code.
- Transform calls to
Objects.isNull(..)
andObjects.nonNull(..)
- Replace calls toObjects.isNull(..)
andObjects.nonNull(..)
with a simple null check. Using these methods outside of stream predicates is not idiomatic. - Typecast parentheses padding - Fixes whitespace padding between a typecast type identifier and the enclosing left and right parenthesis. For example, when configured to remove spacing,
( int ) 0L;
becomes(int) 0L;
. - Update source positions - Calculate start position and length for every LST element.
- Wrapping and braces - Format line wraps and braces in Java code.
rewrite-java-dependencies
- Dependency insight for Gradle and Maven - Finds dependencies, including transitive dependencies, in both Gradle and Maven projects. Matches within all Gradle dependency configurations and Maven scopes.
- Dependency report - Emits a data table detailing all Gradle and Maven dependencies. This recipe makes no changes to any source file.
- Dependency resolution diagnostic - Recipes which manipulate dependencies must be able to successfully access the artifact repositories and resolve dependencies from them. This recipe produces two data tables used to understand the state of dependency resolution. The Repository accessibility report lists all the artifact repositories known to the project and whether respond to network access. The network access is attempted while the recipe is run and so is representative of current conditions. The Gradle dependency configuration errors lists all the dependency configurations that failed to resolve one or more dependencies when the project was parsed. This is representative of conditions at the time the LST was parsed.
- Find minimum JUnit version - A recipe to find the minimum version of JUnit dependencies. This recipe is designed to return the minimum version of JUnit in a project. It will search for JUnit 4 and JUnit 5 dependencies in the project. If both versions are found, it will return the minimum version of JUnit 4. If a minimumVersion is provided, the recipe will search to see if the minimum version of JUnit used by the project is no lower than the minimumVersion. For example: if the minimumVersion is 4, and the project has JUnit 4.12 and JUnit 5.7, the recipe will return JUnit 4.12. If the project has only JUnit 5.7, the recipe will return JUnit 5.7. Another example: if the minimumVersion is 5, and the project has JUnit 4.12 and JUnit 5.7, the recipe will not return any results.
- Find relocated dependencies - Find Maven and Gradle dependencies and Maven plugins that have relocated to a new
groupId
orartifactId
. Relocation information comes from the oga-maven-plugin maintained by Jonathan Lermitage, Filipe Roque and others. This recipe makes no changes to any source file by default. AddchangeDependencies=true
to change dependencies, but note that you might need to run additional recipes to update imports and adopt other breaking changes. - Find the oldest matching dependency version in use - The oldest dependency version in use is the lowest dependency version in use in any source set of any subproject of a repository. It is possible that, for example, the main source set of a project uses Jackson 2.11, but a test source set uses Jackson 2.16. In this case, the oldest Jackson version in use is Java 2.11.
- Module has dependency - Searches for both Gradle and Maven modules that have a dependency matching the specified groupId and artifactId. Places a
SearchResult
marker on all sources within a module with a matching dependency. This recipe is intended to be used as a precondition for other recipes. For example this could be used to limit the application of a spring boot migration to only projects that use spring-boot-starter, limiting unnecessary upgrading. If the search result you want is instead just the build.gradle(.kts) or pom.xml file applying the plugin, use theFindDependency
recipe instead. - Repository has dependency - Searches for both Gradle and Maven modules that have a dependency matching the specified groupId and artifactId. Places a
SearchResult
marker on all sources within a repository with a matching dependency. This recipe is intended to be used as a precondition for other recipes. For example this could be used to limit the application of a spring boot migration to only projects that use a springframework dependency, limiting unnecessary upgrading. If the search result you want is instead just the build.gradle(.kts) or pom.xml file applying the plugin, use theFindDependency
recipe instead. - Upgrade transitive Gradle or Maven dependencies - Upgrades the version of a transitive dependency in a Maven pom.xml or Gradle build.gradle. Leaves direct dependencies unmodified. Can be paired with the regular Upgrade Dependency Version recipe to upgrade a dependency everywhere, regardless of whether it is direct or transitive.
rewrite-java-security
- Dependency insight for C# - Finds dependencies in
*.csproj
andpackages.config
. - Find and fix vulnerable Nuget 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, which aggregates vulnerability data from several public databases, including the National Vulnerability Database maintained by the United States government. Dependencies following Semantic Versioning will see their patch version updated where applicable.
- Find hard-coded loopback IPv4 addresses - Locates mentions of hard-coded IPv4 addresses from the loopback IP range. The loopback IP range includes
127.0.0.0
to127.255.255.255
. This detects the entire localhost/loopback subnet range, not just the commonly used127.0.0.1
. - Find hard-coded private IPv4 addresses - Locates mentions of hard-coded IPv4 addresses from private IP ranges. Private IP ranges include: *
192.168.0.0
to192.168.255.255
*10.0.0.0
to10.255.255.255
*172.16.0.0
to172.31.255.255
It is not detecting the localhost subnet127.0.0.0
to127.255.255.255
. - Find licenses in use in third-party dependencies - Locates and reports on all licenses in use.
- Find sensitive API endpoints - Find data models exposed by REST APIs that contain sensitive information like PII and secrets.
- Fix CWE-338 with
SecureRandom
- Use a cryptographically strong pseudo-random number generator (PRNG). - Improper privilege management - Marking code as privileged enables a piece of trusted code to temporarily enable access to more resources than are available directly to the code that called it.
- Prevent clickjacking - The
frame-ancestors
directive can be used in a Content-Security-Policy HTTP response header to indicate whether or not a browser should be allowed to render a page in a<frame>
or<iframe>
. Sites can use this to avoid Clickjacking attacks by ensuring that their content is not embedded into other sites. - Remove unused dependencies - Scans through source code collecting references to types and methods, removing any dependencies that are not used from Maven or Gradle build files. This recipe takes reflective access into account: When reflective access to a class is made unambiguously via a string literal, such as:
Class.forName("java.util.List")
that is counted correctly. When reflective access to a class is made ambiguously via anything other than a string literal no dependencies will be removed. This recipe takes transitive dependencies into account: When a direct dependency is not used but a transitive dependency it brings in is in use the direct dependency is not removed. - Secure Spring service exporters - The default Java deserialization mechanism is available via
ObjectInputStream
class. This mechanism is known to be vulnerable. If an attacker can make an application deserialize malicious data, it may result in arbitrary code execution. Spring’sRemoteInvocationSerializingExporter
uses the default Java deserialization mechanism to parse data. As a result, all classes that extend it are vulnerable to deserialization attacks. The Spring Framework contains at leastHttpInvokerServiceExporter
andSimpleHttpInvokerServiceExporter
that extendRemoteInvocationSerializingExporter
. These exporters parse data from the HTTP body using the unsafe Java deserialization mechanism. See the full blog post by Artem Smotrakov on CVE-2016-1000027 from which the above description is excerpted. - Secure random - Use cryptographically secure Pseudo Random Number Generation in the "main" source set. Replaces instantiation of
java.util.Random
withjava.security.SecureRandom
. - SecureRandom seeds are not constant or predictable - Remove
SecureRandom#setSeed(*)
method invocations having constant or predictable arguments. - Software bill of materials - Produces a software bill of materials (SBOM) for a project. An SBOM is a complete list of all dependencies used in a project, including transitive dependencies. The produced SBOM is in the CycloneDX XML format. Supports Gradle and Maven. Places a file named sbom.xml adjacent to the Gradle or Maven build file.
- Upgrade C# dependency versions - Upgrades dependencies in
*.csproj
andpackages.config
.
rewrite-jenkins
- Add XML declaration to Jelly files - Ensure the XML declaration
<?jelly escape-by-default='true'?>
is present in all.jelly
files. - Add plugin developer team to CODEOWNERS - Adds the
{artifactId}-plugin-developers
team to all files in.github/CODEOWNERS
if absent. - Create
index.jelly
if it doesn't exist - Jenkins tooling requiressrc/main/resources/index.jelly
exists with a description. - Is the project a Jenkins plugin? - Checks if the project is a Jenkins plugin by the presence of a managed version of jenkins-core
rewrite-json
- Add value to JSON Object - Adds a
value
at the specifiedkeyPath
with the specifiedkey
, if the key doesn't already exist. - Change key - Change a JSON mapping entry key, while leaving the value intact.
- Change value - Change a JSON mapping entry value leaving the key intact.
- Delete key - Delete a JSON mapping entry key.
- Find JSON object members - Find JSON object members by JsonPath expression.
- Format JSON - Format JSON code using a standard comprehensive set of JSON formatting recipes.
- JSON indent - Format tabs and indents in JSON.
- JSON new lines - Split members into separate lines in JSON.
rewrite-kotlin
- Find Kotlin sources and collect data metrics - Use data table to collect source files types and counts of files with extensions
.kt
. - Format Kotlin code - Format Kotlin code using a standard comprehensive set of Kotlin formatting recipes.
- Remove method invocation parentheses around single lambda argument - For example, convert
1.let({ it + 1 })
to1.let { it + 1 }
. - Remove trailing comma in Kotlin - Remove trailing commas in variable, parameter, and class property lists.
- Remove unnecessary parentheses on Kotlin types - In Kotlin, it's possible to add redundant nested parentheses in type definitions. This recipe is designed to remove those unnecessary parentheses.
- Remove unnecessary trailing semicolon - Some Java programmers may mistakenly add semicolons at the end when writing Kotlin code, but in reality, they are not necessary.
- Rename type alias - Change the name of a given type alias.
rewrite-kubernetes
- Add RBAC rules - Add RBAC rules to ClusterRoles or namespaced Roles.
- Cap exceeds resource value - Cap resource values that exceed a specific maximum.
- Find annotation - Find annotations that optionally match a given regex.
- Find annotation - Find annotations that optionally match a given value.
- Find disallowed image tags - The set of image tags to find which are considered disallowed.
- Find exceeds resource limit - Find resource manifests that have limits set beyond a specific maximum.
- Find exceeds resource ratio - Find resource manifests that have requests to limits ratios beyond a specific maximum.
- Find image by name - The image name to search for in containers and initContainers.
- Find label - Find labels that optionally match a given regex.
- Find missing image digest - Find instances of a container name that fails to specify a digest.
- Find non-TLS Ingresses - Find Ingress resources that don't disallow HTTP or don't have TLS configured.
- Find uses of
externalIP
- Find anyService
whoseexternalIP
list contains, or does not contain, one of a list of IPs. - Service type - Type of Kubernetes
Service
to find. - Update
Service
externalIP
- Swap out an IP address with another one inService
externalIP
settings. - Update image name - Search for image names that match patterns and replace the components of the name with new values.
rewrite-liberty
- Replace
WSPrincipal.getCredential()
withWSSubject
lookup - ReplacesWSCredential credential = WSPrincipal.getCredential();
with anull
initializer +try/catch
lookup. - Replace beans.xml file - This Recipe replaces OpenWebBeans schema in every beans.xml with the standard CDI schema.
rewrite-logging-frameworks
- Change SLF4J log level - Change the log level of SLF4J log statements.
- Configure logback logger level - Within logback.xml configuration files sets the specified log level for a particular class. Will not create a logback.xml if one does not already exist.
- Log exceptions as parameters rather than as string concatenations - By using the exception as another parameter you get the whole stack trace.
- Prepend a random name to each Log4J statement - To make finding the callsite of a logging statement easier in code search.
- Use logger instead of system print statements - Replace
System.out
andSystem.err
print statements with a logger.
rewrite-maven
- Add Maven parent - Add a parent pom to a Maven pom.xml. Does nothing if a parent pom is already present.
- Add a comment to a
Maven
dependency - Adds a comment as the first element in aMaven
dependency. - Add a configuration option for the Maven runtime - Add a new configuration option for the Maven runtime if not already present.
- Add repository - Adds a new Maven Repository or updates a matching repository.
- Add the Develocity Maven extension - To integrate the Develocity Maven extension into Maven projects, ensure that the
develocity-maven-extension
is added to the.mvn/extensions.xml
file if not already present. Additionally, configure the extension by adding the.mvn/develocity.xml
configuration file. - Change Maven Project Version - Change the project version of a Maven pom.xml. Identifies the project to be changed by its groupId and artifactId. If the version is defined as a property, this recipe will only change the property value if the property exists within the same pom.
- Change Maven plugin configuration - Apply the specified configuration to a Maven plugin. Will not add the plugin if it does not already exist in the pom.
- Change Maven plugin dependencies - Applies the specified dependencies to a Maven plugin. Will not add the plugin if it does not already exist in the pom.
- Change Maven plugin executions - Apply the specified executions to a Maven plugin. Will not add the plugin if it does not already exist in the pom.
- Dependency management dependencies should have a version - If they don't have a version, they can't possibly affect dependency resolution anywhere, and can be safely removed.
- Does not include Maven dependency - A precondition which returns false if visiting a Maven pom which includes the specified dependency in the classpath of some scope. For compatibility with multimodule projects, this should most often be applied as a precondition.
- Effective dependencies - Emit the data of binary dependency relationships.
- Effective managed dependencies - Emit the data of binary dependency relationships.
- Enable Develocity build cache - Add Develocity build cache configuration to any
.mvn/
Develocity configuration file that lack existing configuration. - Find Maven dependency management entry - Finds first-order dependency management entries, i.e. dependencies that are defined directly in a project.
- Find Maven plugin - Finds a Maven plugin within a pom.xml.
- Find Maven project properties - Finds the specified Maven project properties within a pom.xml.
- Find Maven projects - Maven projects are
pom.xml
files with aMavenResolutionResult
marker. - Find SCM tag - Finds any
<scm>
tag directly inside the<project>
root of a Maven pom.xml file. - Find effective maven settings - List the effective maven settings file for the current project.
- Increment Maven project version - Increase Maven project version by incrementing either the major, minor, or patch version as defined by semver. Other versioning schemes are not supported.
- List effective Maven repositories - Lists the Maven repositories that would be used for dependency resolution, in order of precedence. This includes Maven repositories defined in the Maven settings file (and those contributed by active profiles) as determined when the LST was produced.
- Manage dependencies - Make existing dependencies managed by moving their version to be specified in the dependencyManagement section of the POM.
- Maven parent insight - Find Maven parents matching a
groupId
andartifactId
. - Maven repository order - Determine the order in which dependencies will be resolved for each
pom.xml
based on its defined repositories and effectivesettings.xml
. - Modernize obsolete Maven poms - Very old Maven poms are no longer supported by current versions of Maven. This recipe updates poms with
<pomVersion>3</pomVersion>
to<modelVersion>4.0.0</modelVersion>
of the Maven pom schema. This does not attempt to upgrade old dependencies or plugins and is best regarded as the starting point of a migration rather than an end-point. - Module has dependency - Searches for Maven modules that have a dependency matching the specified groupId and artifactId. Places a
SearchResult
marker on all sources within a module with a matching dependency. This recipe is intended to be used as a precondition for other recipes. For example this could be used to limit the application of a spring boot migration to only projects that use spring-boot-starter, limiting unnecessary upgrading. If the search result you want is instead just the build.gradle(.kts) file applying the plugin, use theFindDependency
recipe instead. - Module has plugin - Searches for Maven modules that have a plugin matching the specified groupId and artifactId. Places a
SearchResult
marker on all sources within a module with a matching plugin. This recipe is intended to be used as a precondition for other recipes. For example this could be used to limit the application of a spring boot migration to only projects that apply the spring boot plugin, limiting unnecessary upgrading. If the search result you want is instead just the build.gradle(.kts) file applying the plugin, use theFindPlugins
recipe instead. - Print Maven dependency hierarchy in DOT format - The DOT language format is specified here.
- Remove repository - Removes a matching Maven repository.
- Remove unused properties - Detect and remove Maven property declarations which do not have any usage within the project.
- Update Maven wrapper - Update the version of Maven used in an existing Maven wrapper.
- Upgrade transitive Maven dependencies - Upgrades the version of a transitive dependency in a Maven pom file. Leaves direct dependencies unmodified. Can be paired with the regular Upgrade Dependency Version recipe to upgrade a dependency everywhere, regardless of whether it is direct or transitive.
rewrite-micrometer
- Convert Micrometer Timer to Observations - Convert Micrometer Timer to Observations.
- Find Dropwizard metrics - Find uses of Dropwizard metrics that could be converted to a more modern metrics instrumentation library.
rewrite-micronaut
- Find Micronaut properties config - Find Micronaut properties configuration files.
- Find Micronaut yaml config - Find Micronaut yaml configuration files.
rewrite-migrate-java
- A collection of
String
rules - A collection of rules for refactoring methods called onString
instances in Java code. - Add
JDeprScan
Maven Plug-in - Add theJDeprScan
Maven plugin to scan class files for uses of deprecated APIs. - Add maven jar plugin to suppress illegal reflection warnings - Adds a maven jar plugin that's configured to suppress Illegal Reflection Warnings.
- Add null check to existing switch cases - In later Java 21+, null checks are valid in switch cases. This recipe will only add null checks to existing switch cases if there are no other statements in between them or if the block in the if statement is not impacting the flow of the switch.
- Add scope annotation to injected classes - Finds member variables annotated with
@Inject' and applies
@Dependent` scope annotation to the variable's type. - Convert
@lombok.Value
class to Record - Convert Lombok@Value
annotated classes to standard Java Records. - Convert
new URL(String, ..)
tonew URI(String, ..).toURL()
- Convertsnew URL(String, ..)
constructors tonew URI(String, ..).toURL()
. - Find Java versions in use - Finds Java versions in use.
- Find data used on DTOs - Find data elements used on DTOs. This is useful to provide information where data over-fetching may be a problem.
- Find methods that only use one DTO data element - Find methods that have 'opportunities' for improvement.
- Find uses of internal javax APIs - The libraries that define these APIs will have to be migrated before any of the repositories that use them.
- Find which Java version is in use - A diagnostic for studying the distribution of Java language version levels (both source and target compatibility across files and source sets).
- Force indentation to either tabs or spaces - This is useful for one-off migrations of a codebase that has mixed indentation styles, while preserving all other auto-detected formatting rules.
- Plan a Java version migration - Study the set of Java versions and associated tools in use across many repositories.
- Prefer
EnumSet of(..)
- PreferEnumSet of(..)
instead of usingSet of(..)
when the arguments are enums in Java 5 or higher. - Prefer
Map.of(..)
- PreferMap.of(..)
instead of usingjava.util.Map#put(..)
in Java 10 or higher. - Prefer
new HashMap<>()
- Prefer the Java standard library over third-party usage of Guava in simple cases like this. - Prefer
new LinkedHashMap<>()
- Prefer the Java standard library over third-party usage of Guava in simple cases like this. - Project has no Jakarta annotations - Mark all source as found per
JavaProject
where no Jakarta annotations are found. This is useful mostly as a precondition for recipes that require Jakarta annotations to be present - Remove invocations of deprecated invocations from Deflater, Inflater, ZipFile - Remove invocations of finalize() deprecated invocations from Deflater, Inflater, ZipFile.
- Rename getter methods to fit Lombok - Rename methods that are effectively getter to the name Lombok would give them. Limitations: - If two methods in a class are effectively the same getter then one's name will be corrected and the others name will be left as it is. - If the correct name for a method is already taken by another method then the name will not be corrected. - Method name swaps or circular renaming within a class cannot be performed because the names block each other. E.g.
int getFoo() { return ba; } int getBa() { return foo; }
stays as it is. - Replace DTO method parameters with data elements - Replace method parameters that have DTOs with their data elements when only the specified data element is used.
- Replace
0 < s.length()
with!s.isEmpty()
- Replace0 < s.length()
ands.length() != 0
with!s.isEmpty()
. - Replace
String
literal - Replace the value of a completeString
literal. - Replace invocations of
finalize()
onFileInputStream
andFileOutputStream
withclose()
- Replace invocations of the deprecatedfinalize()
method onFileInputStream
andFileOutputStream
withclose()
. - Simplify Micrometer meter tags - Use the simplest method to add new tags.
- Update Maven Java project properties - The Java version is determined by several project properties, including: *
java.version
*jdk.version
*javaVersion
*jdkVersion
*maven.compiler.source
*maven.compiler.target
*maven.compiler.release
*release.version
If none of these properties are in use and the maven compiler plugin is not otherwise configured, adds themaven.compiler.release
property. - Use Maven compiler plugin release configuration - Replaces any explicit
source
ortarget
configuration (if present) on themaven-compiler-plugin
withrelease
, and updates therelease
value if needed. Will not downgrade the Java version if the current version is higher.
rewrite-nodejs
- Find Node.js projects - Find Node.js projects and summarize data about them.
- 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, which aggregates vulnerability data from several public databases, including the National Vulnerability Database maintained by the United States government. Dependencies following Semantic Versioning will see their patch version updated where applicable.
- Upgrade Node.js dependencies - Upgrade matching Node.js direct dependencies.
rewrite-properties
- Add comment before property key - Add a new comment before a property key if not already present, optionally commenting out the property.
- Find property - Finds occurrences of a property key.
rewrite-quarkus
- Find Quarkus property - Finds occurrences of a Quarkus property key.
- Migrate SLF4J Logger injection and usage to Quarkus static
Log
- Removes usage of SLF4J Logger fields, adjusts imports, and replaces logger method calls with static Quarkus Log calls, including message formatting and method renaming for parameterized logging. - Search Quarkus profiles - Search the properties for existing Quarkus profiles.
rewrite-rewrite
- Find OpenRewrite recipes - This recipe finds all OpenRewrite recipes, primarily to produce a data table that is being used to experiment with fine-tuning a large language model to produce more recipes.
rewrite-spring
- Add
SetUseTrailingSlashMatch()
in configuration - This is part of Spring MVC and WebFlux URL Matching Changes, as of Spring Framework 6.0, the trailing slash matching configuration option has been deprecated and its default value set to false. This means that previously, a controller@GetMapping("/some/greeting")
would match bothGET /some/greeting
andGET /some/greeting/
, but it doesn't matchGET /some/greeting/
anymore by default and will result in an HTTP 404 error. This recipe is change the default with the global Spring MVC or Webflux configuration. - Add
io.spring.dependency-management
plugin, if in use - Prior to Spring Boot 2.0 the dependency management plugin was applied automatically as part of the overall spring boot plugin. Afterwards the dependency-management plugin must be applied explicitly, or Gradle'splatform()
feature may be used instead. This recipe makes usage of io-spring.dependency-management explicit in anticipation of upgrade to Spring Boot 2.0 or later. - Add missing
@Configuration
annotation - Class having@Bean
annotation over any methods but missing@Configuration
annotation over the declaring class would have@Configuration
annotation added. - Add trailing slash to Spring routes - This is part of Spring MVC and WebFlux URL Matching Changes, as of Spring Framework 6.0, the trailing slash matching configuration option has been deprecated and its default value set to false. This means that previously, a controller
@GetMapping("/some/greeting")
would match bothGET /some/greeting
andGET /some/greeting/
, but it doesn't matchGET /some/greeting/
anymore by default and will result in an HTTP 404 error. This recipe is to add declaration of additional route explicitly on the controller handler (like@GetMapping("/some/greeting", "/some/greeting/")
. - Bean methods should return concrete types - Replace Bean method return types with concrete types being returned. This is required for Spring 6 AOT.
- Delete empty
web.xml
files - Deletesweb.xml
files that contain only an empty<web-app>
root element with no child elements. - Expand Spring YAML properties - Expand YAML properties to not use the dot syntax shortcut.
- Find HTTP API calls via
RestTemplate
- Find outbound HTTP API calls made via Spring'sRestTemplate
class. - Find Spring API endpoints - Find all HTTP API endpoints exposed by Spring applications. More specifically, this marks method declarations annotated with
@RequestMapping
,@GetMapping
,@PostMapping
,@PutMapping
,@DeleteMapping
, and@PatchMapping
as search results. - Find Spring components - Find Spring components, including controllers, services, repositories, return types of
@Bean
annotated methods, etc. - Integration scheduler pool size - Spring Integration now reuses an available
TaskScheduler
rather than configuring its own. In a typical application setup relying on the auto-configuration, this means that Spring Integration uses the auto-configured task scheduler that has a pool size of 1. To restore Spring Integration’s default of 10 threads, use thespring.task.scheduling.pool.size
property. - Is likely a Spring Boot project - Marks the project if it's likely a Spring Boot project.
- Is likely a Spring Framework project - Marks the project if it's likely a Spring Framework project.
- Is likely not a Spring Boot project - Marks the project if it's likely not a Spring Boot project.
- Maintain trailing slash URL mappings - This is part of Spring MVC and WebFlux URL Matching Changes, as of Spring Framework 6.0, the trailing slash matching configuration option has been deprecated and its default value set to false. This means that previously, a controller
@GetMapping("/some/greeting")
would match bothGET /some/greeting
andGET /some/greeting/
, but it doesn't matchGET /some/greeting/
anymore by default and will result in an HTTP 404 error. This recipe is to maintain trailing slash in all HTTP url mappings. - Migrate multi-condition
@ConditionalOnBean
annotations - Migrate multi-condition@ConditionalOnBean
annotations toAnyNestedCondition
. - [Migrate ´web.xml
to
WebApplicationInitializer](/recipes/java/spring/framework/webxml/webxmltowebapplicationinitializer.md) - _Migrate
web.xmlto
WebApplicationInitializerfor Spring applications. This allows for programmatic configuration of the web application context, replacing the need for XML-based configuration. This recipe only picks up
web.xmlfiles located in the
src/main/webapp/WEB-INF` directory to avoid inference with tests._ - Normalize Spring properties to kebab-case - Normalize Spring properties to use lowercase and hyphen-separated syntax. For example, changing
spring.main.showBanner
tospring.main.show-banner
. With Spring's relaxed binding,kebab-case
may be used in properties files and still be converted to configuration beans. Note, an exception to this is the case of@Value
, which is match-sensitive. For example,@Value("${anExampleValue}")
will not matchan-example-value
. The Spring reference documentation recommends usingkebab-case
for properties where possible. - Remove
TestRestTemplate.HttpClientOption.ENABLE_REDIRECTS
option - TheTestRestTemplate
now uses the same follow redirects settings as the regular RestTemplate. TheHttpOption.ENABLE_REDIRECTS
option has also been deprecated. This recipe removes the option from theTestRestTemplate
constructor arguments. - Remove implicit web annotation names - Removes implicit web annotation names.
- Remove unnecessary
@Repository
annotation from Spring DataRepository
sub-interface - Removes superfluous@Repository
annotation from Spring DataRepository
sub-interfaces. - Remove unneeded
oauth2Login
config when upgrading to Spring Security 6 -oauth2Login()
is a Spring Security feature that allows users to authenticate with an OAuth2 or OpenID Connect 1.0 provider. When a user is authenticated using this feature, they are granted a set of authorities that determines what actions they are allowed to perform within the application. In Spring Security 5, the default authority given to a user authenticated with an OAuth2 or OpenID Connect 1.0 provider viaoauth2Login()
isROLE_USER
. This means that the user is allowed to access the application's resources as a regular user. However, in Spring Security 6, the default authority given to a user authenticated with an OAuth2 provider isOAUTH2_USER
, and the default authority given to a user authenticated with an OpenID Connect 1.0 provider isOIDC_USER
. These authorities are more specific and allow for better customization of the user's permissions within the application. If you are upgrading to Spring Security 6 and you have previously configured aGrantedAuthoritiesMapper
to handle the authorities of users authenticated viaoauth2Login()
, you can remove it completely as the new default authorities should be sufficient. - Rename bean - Renames a Spring bean, both declaration and references.
- Separate application YAML by profile - The Spring team's recommendation is to separate profile properties into their own YAML files now.
- Update the API manifest - Keep a consolidated manifest of the API endpoints that this application exposes up-to-date.
- Upgrade Spring dependencies - Upgrades dependencies according to the specified version of spring boot. Spring boot has many direct and transitive dependencies. When a module has an explicit dependency on one of these it may also need to be upgraded to match the version used by spring boot.
- Use TLS for AMQP connection strings - Use TLS for AMQP connection strings.
- Use TLS for JDBC connection strings - Increasingly, for compliance reasons (e.g. NACHA), JDBC connection strings should be TLS-enabled. This recipe will update the port and optionally add a connection attribute to indicate that the connection is TLS-enabled.
- Use
DiskSpaceHealthIndicator(File, DataSize)
-DiskSpaceHealthIndicator(File, long)
was deprecated in Spring Data 2.1 for removal in 2.2. - Use
QuerydslPredicateExecutor<T>
-QuerydslJpaRepository<T, ID extends Serializable>
was deprecated in Spring Data 2.1.
rewrite-sql
- Change a SQL function name - When migrating between dialects, often one name can be substituted for another. For example, Oracle's NVL function can be replaced with Postgres COALESCE.
- Find SQL function - Find SQL functions by name.
- Find SQL in code and resource files - Find SQL in code (e.g. in string literals) and in resources like those ending with
.sql
. - Format SQL in string text blocks - Checks whether a text block may contain SQL, and if so, formats the text accordingly.
rewrite-static-analysis
- Add
serialVersionUID
to aSerializable
class when missing - AserialVersionUID
field is strongly recommended in allSerializable
classes. If this is not defined on aSerializable
class, the compiler will generate this value. If a change is later made to the class, the generated value will change and attempts to deserialize the class will fail. - Avoid boxed boolean expressions - Under certain conditions the
java.lang.Boolean
type is used as an expression, and it may throw aNullPointerException
if the value is null. - Chain calls to builder methods - Chain calls to builder methods that are on separate lines into one chain of builder calls.
- Combine semantically equal catch blocks - Combine catches in a try that contain semantically equivalent blocks. No change will be made when a caught exception exists if combining catches may change application behavior or type attribution is missing.
- Control flow statement indentation - Program flow control statements like
if
,while
, andfor
can omit curly braces when they apply to only a single statement. This recipe ensures that any statements which follow that statement are correctly indented to show they are not part of the flow control statement. - Don't use final on local variables - Remove the
final
modifier keyword from local variables regardless of whether they are used within a local class or an anonymous class. - Finalize local variables - Adds the
final
modifier keyword to local variables which are not reassigned. - Finalize method arguments - Adds the
final
modifier keyword to method parameters. - Hidden field - Refactor local variables or parameters which shadow a field defined in the same class.
- Mask credit card numbers - When encountering string literals which appear to be credit card numbers, mask the last eight digits with the letter 'X'.
- Reformat local variable names to camelCase - Reformat local variable and method parameter names to camelCase to comply with Java naming convention. The recipe will not rename variables declared in for loop controls or catches with a single character. The first character is set to lower case and existing capital letters are preserved. Special characters that are allowed in java field names
$
and_
are removed (unless the name starts with one). If a special character is removed the next valid alphanumeric will be capitalized. Currently, does not support renaming members of classes. The recipe will not rename a variable if the result already exists in the class, conflicts with a java reserved keyword, or the result is blank. - Reformat private field names to camelCase - Reformat private field names to camelCase to comply with Java naming convention. The recipe will not rename fields with default, protected or public access modifiers. The recipe will not rename private constants. The first character is set to lower case and existing capital letters are preserved. Special characters that are allowed in java field names
$
and_
are removed. If a special character is removed the next valid alphanumeric will be capitalized. The recipe will not rename a field if the result already exists in the class, conflicts with a java reserved keyword, or the result is blank. - Remove JavaDoc
@param
,@return
, and@throws
with no description - Removes@param
,@return
, and@throws
with no description from JavaDocs. - Remove
Object.finalize()
invocations - Remove calls toObject.finalize()
. This method is called during garbage collection and calling it manually is misleading. - Remove
toString()
calls on arrays - The result fromtoString()
calls on arrays is largely useless. The output does not actually reflect the contents of the array.Arrays.toString(array)
should be used instead as it gives the contents of the array. - Remove author tags from JavaDocs - Removes author tags from JavaDocs to reduce code maintenance.
- Remove garbage collection invocations - Removes calls to
System.gc()
andRuntime.gc()
. When to invoke garbage collection is best left to the JVM. - Remove redundant casts - Removes unnecessary type casts. Does not currently check casts in lambdas, class constructors, and method invocations.
- Remove unneeded assertions - Remove unneeded assertions like
assert true
,assertTrue(true)
, orassertFalse(false)
. - Remove unneeded block - Flatten blocks into inline statements when possible.
- Removes from code Java 14's
instanceof
pattern matching - Adds an explicit variable declaration at the beginning ofif
statement instead ofinstanceof
pattern matching. - Rename caught exceptions in empty catch blocks to
ignored
- Renames caught exceptions in empty catch blocks toignored
.ignored
will be incremented by 1 if a namespace conflict exists. - Rename packages to lowercase - By convention all Java package names should contain only lowercase letters, numbers, and dashes. This recipe converts any uppercase letters in package names to be lowercase.
- Replace Stream.toList() with Stream.collect(Collectors.toList()) - Replace Java 16
Stream.toList()
with Java 11Stream.collect(Collectors.toList())
. - Replace
Optional#isPresent()
withOptional#ifPresent()
- ReplaceOptional#isPresent()
withOptional#ifPresent()
. Please note that this recipe is only suitable for if-blocks that lack an Else-block and have a single condition applied. - Replace
catch(Exception)
with specific declared exceptions thrown in the try block - Replacescatch(Exception e)
blocks with a multi-catch block (catch (SpecificException1 | SpecificException2 e)
) containing only the exceptions declared thrown by method or constructor invocations within thetry
block that are not already caught by more specificcatch
clauses. - Replace
java.util.Set#removeAll(java.util.Collection)
withjava.util.Collection#forEach(Set::remove)
- Usingjava.util.Collection#forEach(Set::remove)
rather thanjava.util.Set#removeAll(java.util.Collection)
may improve performance due to a possible O(n^2) complexity. - Replace
java.util.Stack
withjava.util.Deque
- From the Javadoc ofStack
: > A more complete and consistent set of LIFO stack operations is provided by the Deque interface and its implementations, which should be used in preference to this class. - Replace duplicate
String
literals - ReplacesString
literals with a length of 5 or greater repeated a minimum of 3 times. QualifiedString
literals include final Strings, method invocations, and new class invocations. Adds a newprivate static final String
or uses an existing equivalent class field. A new variable name will be generated based on the literal value if an existing field does not exist. The generated name will append a numeric value to the variable name if a name already exists in the compilation unit. - Replace invocations of
Collections#sort(List, Comparator)
withList#sort(Comparator)
- Thejava.util.Collections#sort(..)
implementation defers to thejava.util.List#sort(Comparator)
, replaced it with thejava.util.List#sort(Comparator)
implementation for better readability. - Replace redundant String format invocations that are wrapped with PrintStream operations - Replaces
PrintStream.print(String.format(format, ...args))
withPrintStream.printf(format, ...args)
(and forprintln
, appends a newline to the format string). - Replace referential equality operators with Object equals method invocations when the operands both override
Object.equals(Object obj)
- Using==
or!=
compares object references, not the equality of two objects. This modifies code where both sides of a binary operation (==
or!=
) overrideObject.equals(Object obj)
except when the comparison is within an overriddenObject.equals(Object obj)
method declaration itself. The resulting transformation must be carefully reviewed since any modifications change the program's semantics. - Replace text block with regular string - Replace text block with a regular multi-line string.
- Replaces
Object.notify()
withObject.notifyAll()
-Object.notifyAll()
andObject.notify()
both wake up sleeping threads, butObject.notify()
only rouses one whileObject.notifyAll()
rouses all of them. SinceObject.notify()
might not wake up the right thread,Object.notifyAll()
should be used instead. See this for more information. - Set charset encoding explicitly when calling
String#getBytes
- This makes the behavior of the code platform neutral. It will not override any existing explicit encodings, even if they don't match the default encoding option. - Simplify
java.time.Duration
units - Simplifiesjava.time.Duration
units to be more human-readable. - Simplify compound statement - Fixes or removes useless compound statements. For example, removing
b &= true
, and replacingb &= false
withb = false
. - Simplify consecutive assignments - Combine consecutive assignments into a single statement where possible.
- Simplify ternary expressions - Simplifies various types of ternary expressions to improve code readability.
- Sorted set stream should be collected to LinkedHashSet - Converts
set.stream().sorted().collect(Collectors.toSet())
toset.stream().sorted().collect(LinkedHashSet::new)
. - Ternary operators should not be nested - Nested ternary operators can be hard to read quickly. Prefer simpler constructs for improved readability. If supported, this recipe will try to replace nested ternaries with switch expressions.
- URL Equals and Hash Code - Uses of
equals()
andhashCode()
causejava.net.URL
to make blocking internet connections. Instead, usejava.net.URI
. - Unwrap
@Repeatable
annotations - Java 8 introduced the concept of@Repeatable
annotations, making the wrapper annotation unnecessary. - Use Empty Array for
Collection.toArray()
- Changes new array creation withCollection#toArray(T[])
to use an empty array argument, which is better for performance. According to theCollection#toArray(T[])
documentation: > If the collection fits in the specified array, it is returned therein. However, although it's not intuitive, allocating a right-sized array ahead of time to pass to the API appears to be generally worse for performance according to benchmarking and JVM developers due to a number of implementation details in both Java and the virtual machine. H2 achieved significant performance gains by switching to empty arrays instead pre-sized ones. - Use
Collection
interfaces - UseDeque
,List
,Map
,ConcurrentMap
,Queue
, andSet
instead of implemented collections. Replaces the return type of public method declarations and the variable type public variable declarations. - Use
StandardCharset
constants - ReplacesCharset.forName(java.lang.String)
with the equivalentStandardCharset
constant. - Use
String.contentEquals(CharSequence)
instead ofString.equals(CharSequence.toString())
- UseString.contentEquals(CharSequence)
instead ofString.equals(CharSequence.toString())
. - Use
String::replace()
when first parameter is not a real regular expression - WhenString::replaceAll
is used, the first argument should be a real regular expression. If it’s not the case,String::replace
does exactly the same thing asString::replaceAll
without the performance drawback of the regex. - Use
System.lineSeparator()
- Replace calls toSystem.getProperty("line.separator")
withSystem.lineSeparator()
. - Use explicit types on lambda arguments - Adds explicit types on lambda arguments, which are otherwise optional. This can make the code clearer and easier to read. This does not add explicit types on arguments when the lambda has one or two parameters and does not have a block body, as things are considered more readable in those cases. For example,
stream.map((a, b) -> a.length);
will not have explicit types added. - Use lambda expressions instead of anonymous classes - Instead of anonymous class declarations, use a lambda where possible. Using lambdas to replace anonymous classes can lead to more expressive and maintainable code, improve code readability, reduce code duplication, and achieve better performance in some cases.
- Week Year (YYYY) should not be used for date formatting - For most dates Week Year (YYYY) and Year (yyyy) yield the same results. However, on the last week of December and the first week of January, Week Year could produce unexpected results.
hashCode()
should not be called on array instances - ReplacehashCode()
calls on arrays withArrays.hashCode()
because the results fromhashCode()
are not helpful.
rewrite-struts
- Find Struts actions - Find actions and their associated definitions.
- Find struts XML files - Struts XML files may have any name, and may be outside a resources directory, so the true test is to look at the content of the file.
rewrite-terraform
- Find Terraform resource - Find a Terraform resource by resource type.
- Use a long enough byte length for
random
resources - Use a long enough byte length forrandom
resources.
rewrite-testing-frameworks
- Close unclosed static mocks - Ensures that all
mockStatic
calls are properly closed. IfmockStatic
is in lifecycle methods like@BeforeEach
or@BeforeAll
, creates a class variable and closes it in@AfterEach
or@AfterAll
. IfmockStatic
is inside a test method, wraps it in a try-with-resources block. - JUnit 4 MockitoJUnitRunner.Silent to JUnit Jupiter MockitoExtension with LENIENT settings - Replace
@RunWith(MockitoJUnitRunner.Silent.class)
with@ExtendWith(MockitoExtension.class)
and@MockitoSettings(strictness = Strictness.LENIENT)
. - Migrate JUnit 4 environmentVariables rule to JUnit 5 system stubs extension - Replaces usage of the JUnit 4
@Rule EnvironmentVariables
with the JUnit 5-compatibleSystemStubsExtension
and@SystemStub EnvironmentVariables
from the System Stubs library. - Remove empty tests without comments - Removes empty methods with a
@Test
annotation if the body does not have comments. - Replace Mockito 1.x
anyString()
withnullable(String.class)
- Since Mockito 2.10anyString()
no longer matches null values. Usenullable(Class)
instead. - Simplify
throws
statements of tests - Replace all thrown exception classes of test method signatures byException
. - Use JUnit5's
assertSame
orassertNotSame
instead ofassertTrue(... == ...)
- Prefers the usage ofassertSame
orassertNotSame
methods instead of using of vanillaassertTrue
orassertFalse
with a boolean comparison. - assertTrue(x instanceof y) to assertInstanceOf(y.class, x) - Migration of JUnit4 (or potentially JUnit5) test case in form of assertTrue(x instanceof y) to assertInstanceOf(y.class, x).
rewrite-third-party
- Refaster rules related to AssertJ assertions over
Duration
s - These rules simplify and improve the readability of tests by usingDuration
-specific AssertJ assertion methods instead of generic assertions. Source. - Refaster rules related to AssertJ assertions over
Instant
s - These rules simplify and improve the readability of tests by usingInstant
-specific AssertJ assertion methods instead of generic assertions. Source. - Refaster rules related to AssertJ assertions over
Path
s - These rules simplify and improve the readability of tests by usingPath
-specific AssertJ assertion methods instead of generic assertions. Source. AssertJBigIntegerRules
Refaster recipes - Refaster template recipes fortech.picnic.errorprone.refasterrules.AssertJBigIntegerRules
. Source.AssertJByteRules
Refaster recipes - Refaster template recipes fortech.picnic.errorprone.refasterrules.AssertJByteRules
. Source.AssertJDoubleRules
Refaster recipes - Refaster template recipes fortech.picnic.errorprone.refasterrules.AssertJDoubleRules
. Source.AssertJFloatRules
Refaster recipes - Refaster template recipes fortech.picnic.errorprone.refasterrules.AssertJFloatRules
. Source.AssertJIntegerRules
Refaster recipes - Refaster template recipes fortech.picnic.errorprone.refasterrules.AssertJIntegerRules
. Source.AssertJLongRules
Refaster recipes - Refaster template recipes fortech.picnic.errorprone.refasterrules.AssertJLongRules
. Source.AssertJShortRules
Refaster recipes - Refaster template recipes fortech.picnic.errorprone.refasterrules.AssertJShortRules
. Source.AssortedRules
Refaster recipes - Assorted Refaster rules that do not (yet) belong in one of the other classes with more topical Refaster rules. Source.BigDecimalRules
Refaster recipes - Refaster rules related to expressions dealing withBigDecimal
s. Source.BugCheckerRules
Refaster recipes - Refaster rules related tocom.google.errorprone.bugpatterns.BugChecker
classes. Source.CharSequenceRules
Refaster recipes - Refaster rules related to expressions dealing withCharSequence
s. Source.ClassRules
Refaster recipes - Refaster rules related to expressions dealing with classes. Source.CollectionRules
Refaster recipes - Refaster rules related to expressions dealing with (arbitrary) collections. Source.ComparatorRules
Refaster recipes - Refaster rules related to expressions dealing withComparator
s. Source.DoubleStreamRules
Refaster recipes - Refaster rules related to expressions dealing withDoubleStream
s. Source.EqualityRules
Refaster recipes - Refaster rules related to expressions dealing with (in)equalities. Source.FileRules
Refaster recipes - Refaster rules related to expressions dealing with files. Source.ImmutableEnumSetRules
Refaster recipes - Refaster rules related to expressions dealing withcom.google.common.collect.ImmutableEnumSet
s. Source.ImmutableListMultimapRules
Refaster recipes - Refaster rules related to expressions dealing withImmutableListMultimap
s. Source.ImmutableListRules
Refaster recipes - Refaster rules related to expressions dealing withImmutableList
s. Source.ImmutableMapRules
Refaster recipes - Refaster rules related to expressions dealing withImmutableMap
s. Source.ImmutableMultisetRules
Refaster recipes - Refaster rules related to expressions dealing withImmutableMultiset
s. Source.ImmutableSetMultimapRules
Refaster recipes - Refaster rules related to expressions dealing withImmutableSetMultimap
s. Source.ImmutableSetRules
Refaster recipes - Refaster rules related to expressions dealing withImmutableSet
s. Source.ImmutableSortedMapRules
Refaster recipes - Refaster rules related to expressions dealing withImmutableSortedMap
s. Source.ImmutableSortedMultisetRules
Refaster recipes - Refaster rules related to expressions dealing withImmutableSortedMultiset
s. Source.ImmutableSortedSetRules
Refaster recipes - Refaster rules related to expressions dealing withImmutableSortedSet
s. Source.ImmutableTableRules
Refaster recipes - Refaster rules related to expressions dealing withImmutableTable
s. Source.IntStreamRules
Refaster recipes - Refaster rules related to expressions dealing withIntStream
s. Source.JacksonRules
Refaster recipes - Refaster rules related to Jackson expressions and statements. Source.LongStreamRules
Refaster recipes - Refaster rules related to expressions dealing withLongStream
s. Source.MapEntryRules
Refaster recipes - Refaster rules related to expressions dealing withMap.Entry
instances. Source.MapRules
Refaster recipes - Refaster rules related to expressions dealing withMap
instances. Source.MicrometerRules
Refaster recipes - Refaster rules related to expressions dealing with Micrometer. Source.MockitoRules
Refaster recipes - Refaster rules related to Mockito expressions and statements. Source.MultimapRules
Refaster recipes - Refaster rules related to expressions dealing withMultimap
s. Source.NullRules
Refaster recipes - Refaster rules related to expressions dealing with (possibly) null values. Source.OptionalRules
Refaster recipes - Refaster rules related to expressions dealing withOptional
s. Source.PatternRules
Refaster recipes - Refaster rules related to code dealing with regular expressions. Source.PreconditionsRules
Refaster recipes - Refaster templates related to statements dealing withPreconditions
. Source.PrimitiveRules
Refaster recipes - Refaster rules related to expressions dealing with primitives. Source.RandomGeneratorRules
Refaster recipes - Refaster rules related to expressions dealing withRandomGenerator
instances. Source.RxJava2AdapterRules
Refaster recipes - Refaster rules related to expressions dealing withRxJava2Adapter
. Source.StreamRules
Refaster recipes - Refaster rules related to expressions dealing withStream
s. Source.StringRules
Refaster recipes - Refaster rules related to expressions dealing withString
s. Source.SuggestedFixRules
Refaster recipes - Refaster rules related to expressions dealing withSuggestedFix
es. Source.TimeRules
Refaster recipes - Refaster rules related to expressions dealing with time. Source.WebClientRules
Refaster recipes - Refaster rules related to expressions dealing withorg.springframework.web.reactive.function.client.WebClient
and related types. Source.
rewrite-vulncheck
- Use VulnCheck Exploit Intelligence to fix vulnerabilities - 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 VulnCheck Vulnerability Intelligence. The recipe has an option to limit fixes to only those vulnerabilities that have evidence of exploitation at various levels of severity.
rewrite-xml
- Add a comment to an XML tag - Adds a comment as the first element in an XML tag.
- Add date bounds to OWASP suppressions - Adds an expiration date to all OWASP suppressions in order to ensure that they are periodically reviewed. For use with the OWASP
dependency-check
tool. More details: https://jeremylong.github.io/DependencyCheck/general/suppression.html. - Blank lines - Add line breaks at appropriate places between XML syntax elements.
- Find OWASP vulnerability suppression XML files - These files are used to suppress false positives in OWASP Dependency Check.
- Find XML namespace URIs - Find XML namespace URIs, optionally restricting the search by a XPath expression.
- Find XML namespace prefixes - Find XML namespace prefixes, optionally restricting the search by a XPath expression.
- Find XML tags - Find XML tags by XPath expression.
- Find files without Namespace URI - Find XML root elements that do not have a specific Namespace URI, optionally restricting the search by an XPath expression.
- Format XML - Indents XML using the most common indentation size and tabs or space choice in use in the file.
- Normalize format - Move whitespace to the outermost LST element possible.
- Normalize line breaks - Consistently use either Windows style (CRLF) or Linux style (LF) line breaks. If no
GeneralFormatStyle
is specified this will use whichever style of line endings are more common. - Normalize to tabs or spaces - Consistently use either tabs or spaces in indentation.
- Remove empty XML Tag - Removes XML tags that do not have attributes or children, including self closing tags.
- Remove out-of-date OWASP suppressions - Remove all OWASP suppressions with a suppression end date in the past, as these are no longer valid. For use with the OWASP
dependency-check
tool. More details on OWASP suppression files can be found here. - Remove trailing whitespace - Remove any extra trailing whitespace from the end of each line.
- Tabs and indents - Format tabs and indents in XML code.
- Update OWASP suppression date bounds - Updates the expiration date for OWASP suppressions having a matching cve tag. For use with the OWASP
dependency-check
tool. More details: https://jeremylong.github.io/DependencyCheck/general/suppression.html. - XML style Auto-detection debug - Runs XML Autodetect and records the results in data tables and search markers. A debugging tool for figuring out why XML documents get styled the way they do.
- XSLT transformation - Apply the specified XSLT transformation on matching files. Note that there are no format matching guarantees when running this recipe.
rewrite-yaml
- Append to sequence - Append item to YAML sequence.
- Change YAML property - Change a YAML property. Expects dot notation for nested YAML mappings, similar to how Spring Boot interprets
application.yml
files. - Coalesce YAML properties - Simplify nested map hierarchies into their simplest dot separated property form, similar to how Spring Boot interprets
application.yml
files. - Create YAML file - Create a new YAML file.
- Find YAML properties - Find YAML properties that match the specified
propertyKey
. Expects dot notation for nested YAML mappings, similar to how Spring Boot interpretsapplication.yml
files. - Unfold YAML properties - Transforms dot-separated property keys in YAML files into nested map hierarchies to enhance clarity and readability, or for compatibility with tools expecting structured YAML.
- YAML indent - Format tabs and indents in YAML.