Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion docs/changelog/8-59-1-Release.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: What's changed in OpenRewrite version 8.59.1.

# 8.59.1 release (2025-07-24)

_Total recipe count: 4006_
_Total recipe count: 4576_

:::info
This changelog only shows what recipes have been added, removed, or changed. OpenRewrite may do releases that do not include these types of changes. To see these changes, please go to the [releases page](https://github.com/openrewrite/rewrite/releases).
Expand Down
1 change: 1 addition & 0 deletions docs/recipes/csharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ _Recipes for C# codebases._
## Categories

* [Dependencies](/recipes/csharp/dependencies)
* [Recipes](/recipes/csharp/recipes)


11 changes: 11 additions & 0 deletions docs/recipes/csharp/recipes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Recipes

## Categories

* [Meziantou](/recipes/csharp/recipes/meziantou)
* [Microsoft](/recipes/csharp/recipes/microsoft)
* [Roslynator](/recipes/csharp/recipes/roslynator)
* [Stylecop](/recipes/csharp/recipes/stylecop)
* [Wpfanalyzers](/recipes/csharp/recipes/wpfanalyzers)


7 changes: 7 additions & 0 deletions docs/recipes/csharp/recipes/meziantou/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Meziantou

## Categories

* [Analyzer](/recipes/csharp/recipes/meziantou/analyzer)


72 changes: 72 additions & 0 deletions docs/recipes/csharp/recipes/meziantou/analyzer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Analyzer

## Recipes

* [A class that provides Equals(T) should implement IEquatable<T>](./equalityshouldbecorrectlyimplementedma0077.md)
* [Abstract types should not have public or internal constructors](./abstracttypesshouldnothaveconstructorsma0017.md)
* [Add StructLayoutAttribute](./usestructlayoutattributema0008.md)
* [Add a comma after the last value](./commama0007.md)
* [Add parameter name to improve readability](./namedparameterma0003.md)
* [Avoid comparison with bool constant](./avoidcomparisonwithboolconstantma0073.md)
* [Avoid implicit culture-sensitive methods](./usestringcomparisonma0074.md)
* [Avoid using redundant else](./avoidusingredundantelsema0071.md)
* [Combine LINQ methods](./optimizelinqusagema0029.md)
* [Do not use blocking calls in a sync method (need to make calling method async)](./donotuseblockingcallinasynccontextma0045.md)
* [Do not use blocking calls in an async method](./donotuseblockingcallinasynccontextma0042.md)
* [EventArgs should not be null](./useeventargsemptyma0093.md)
* [Forward the CancellationToken parameter to methods that take one](./useanoverloadthathascancellationtokenfixer_argumentma0040.md)
* [Forward the CancellationToken using .WithCancellation()](./useanoverloadthathascancellationtokenfixer_awaitforeachma0079.md)
* [Forward the TimeProvider to methods that take one](./useanoverloadthathastimeproviderma0166.md)
* [IEqualityComparer<string> or IComparer<string> is missing](./usestringcomparerma0002.md)
* [Make class sealed](./classmustbesealedma0053.md)
* [Make class static](./makeclassstaticma0036.md)
* [Make interpolated string](./makeinterpolatedstringma0165.md)
* [Make member readonly](./makememberreadonlyma0102.md)
* [Make method static (deprecated, use CA1822 instead)](./makemethodstaticma0038.md)
* [Make property static (deprecated, use CA1822 instead)](./makemethodstaticma0041.md)
* [Mark attributes with AttributeUsageAttribute](./markattributeswithattributeusageattributema0010.md)
* [Method overrides should not change default values](./methodoverridesshouldnotchangeparameterdefaultsma0061.md)
* [Method overrides should not omit params keyword](./preserveparamsonoverridema0081.md)
* [Optimize Enumerable.Count() usage](./optimizelinqusagema0031.md)
* [Optimize StringBuilder usage](./optimizestringbuilderusagema0028.md)
* [Optimize string method usage](./optimizestartswithma0089.md)
* [Parameters with [EditorRequired] attributes should also be marked as [Parameter]](./parameterattributeforrazorcomponentma0117.md)
* [Parameters with [SupplyParameterFromQuery] attributes should also be marked as [Parameter]](./parameterattributeforrazorcomponentma0116.md)
* [Prefer rethrowing an exception implicitly](./donotremoveoriginalexceptionfromthrowstatementma0027.md)
* [Remove empty statement](./removeemptystatementma0037.md)
* [Remove redundant argument value](./simplifycallerargumentexpressionma0108.md)
* [Remove useless OrderBy call](./optimizelinqusagema0030.md)
* [Remove useless ToString call](./removeuselesstostringma0044.md)
* [Replace constant Enum.ToString with nameof](./replaceenumtostringwithnameofma0052.md)
* [Return Task.FromResult instead of returning null](./returntaskfromresultinsteadofreturningnullma0022.md)
* [Sender should be 'this' for instance events](./eventsshouldhaveproperargumentsma0091.md)
* [String contains an implicit end of line character](./stringshouldnotcontainsnondeterministicendoflinema0101.md)
* [StringComparison is missing](./usestringcomparisonma0001.md)
* [Use 'Cast' instead of 'Select' to cast](./optimizelinqusagema0078.md)
* [Use 'Order' instead of 'OrderBy'](./optimizelinqusagema0159.md)
* [Use 'is' operator instead of SequenceEqual](./useispatterninsteadofsequenceequalma0128.md)
* [Use Array.Empty<T>()](./usearrayemptyma0005.md)
* [Use DateTime.UnixEpoch](./usedatetimeunixepochma0113.md)
* [Use DateTimeOffset.UnixEpoch](./usedatetimeunixepochma0114.md)
* [Use EventArgs.Empty](./useeventargsemptyma0019.md)
* [Use Guid.Empty](./useguidemptyma0067.md)
* [Use InvokeVoidAsync when the returned value is not used](./usejsruntimeinvokevoidasyncwhenreturnvalueisnotusedma0120.md)
* [Use SequenceEqual instead of equality operator](./donotuseequalityoperatorsforspanofcharma0103.md)
* [Use String.Equals instead of equality operator](./usestringequalsma0006.md)
* [Use StringComparer.GetHashCode instead of string.GetHashCode](./donotusestringgethashcodema0021.md)
* [Use Task.ConfigureAwait](./useconfigureawaitma0004.md)
* [Use an explicit StringComparer when possible](./donotuseequalitycomparerdefaultofstringma0024.md)
* [Use direct methods instead of LINQ methods](./optimizelinqusagema0020.md)
* [Use indexer instead of LINQ methods](./optimizelinqusagema0098.md)
* [Use langword in XML comment](./uselangwordinxmlcommentma0154.md)
* [Use nameof operator in ArgumentException](./argumentexceptionshouldspecifyargumentnamema0043.md)
* [Use parentheses to make not pattern clearer](./notpatternshouldbeparenthesizedcodema0164.md)
* [Use pattern matching instead of equality operators for discrete value](./usepatternmatchingforequalitycomparisonsma0148.md)
* [Use pattern matching instead of equality operators for null check](./usepatternmatchingforequalitycomparisonsma0142.md)
* [Use pattern matching instead of inequality operators for discrete value](./usepatternmatchingforequalitycomparisonsma0149.md)
* [Use pattern matching instead of inequality operators for null check](./usepatternmatchingforequalitycomparisonsma0141.md)
* [Use string.Create instead of FormattableString](./usestringcreateinsteadofformattablestringma0111.md)
* [Use the Regex source generator](./useregexsourcegeneratorma0110.md)
* [Validate arguments correctly in iterator methods](./validateargumentscorrectlyma0050.md)


Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
sidebar_label: "Abstract types should not have public or internal constructors"
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Abstract types should not have public or internal constructors

**org.openrewrite.csharp.recipes.meziantou.analyzer.AbstractTypesShouldNotHaveConstructorsMA0017**


## Recipe source

[GitHub](https://github.com/openrewrite/rewrite-csharp/blob/main/rewrite-csharp/src/main/java/org/openrewrite/csharp/recipes/meziantou/analyzer/AbstractTypesShouldNotHaveConstructorsMA0017.java),
[Issue Tracker](https://github.com/openrewrite/rewrite-csharp/issues),
[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-csharp/)

This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license).


## Usage

This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite:rewrite-csharp` in your build file or by running a shell command (in which case no build changes are needed):
<Tabs groupId="projectType">


<TabItem value="moderne-cli" label="Moderne CLI">

You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command.

```shell title="shell"
mod run . --recipe AbstractTypesShouldNotHaveConstructorsMA0017
```

If the recipe is not available locally, then you can install it using:
```shell
mod config recipes jar install org.openrewrite:rewrite-csharp:{{VERSION_ORG_OPENREWRITE_REWRITE_CSHARP}}
```
</TabItem>
</Tabs>

## See how this recipe works across multiple open-source repositories

import RecipeCallout from '@site/src/components/ModerneLink';

<RecipeCallout link="https://app.moderne.io/recipes/org.openrewrite.csharp.recipes.meziantou.analyzer.AbstractTypesShouldNotHaveConstructorsMA0017" />

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

Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS.
## Data Tables

<Tabs groupId="data-tables">
<TabItem value="org.openrewrite.table.SourcesFileResults" label="SourcesFileResults">

### Source files that had results
**org.openrewrite.table.SourcesFileResults**

_Source files that were modified by the recipe run._

| Column Name | Description |
| ----------- | ----------- |
| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. |
| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. |
| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. |
| Recipe that made changes | The specific recipe that made a change. |
| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. |
| Cycle | The recipe cycle in which the change was made. |

</TabItem>

<TabItem value="org.openrewrite.table.SourcesFileErrors" label="SourcesFileErrors">

### Source files that errored on a recipe
**org.openrewrite.table.SourcesFileErrors**

_The details of all errors produced by a recipe run._

| Column Name | Description |
| ----------- | ----------- |
| Source path | The file that failed to parse. |
| Recipe that made changes | The specific recipe that made a change. |
| Stack trace | The stack trace of the failure. |

</TabItem>

<TabItem value="org.openrewrite.table.RecipeRunStats" label="RecipeRunStats">

### Recipe performance
**org.openrewrite.table.RecipeRunStats**

_Statistics used in analyzing the performance of recipes._

| Column Name | Description |
| ----------- | ----------- |
| The recipe | The recipe whose stats are being measured both individually and cumulatively. |
| Source file count | The number of source files the recipe ran over. |
| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. |
| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. |
| 99th percentile scanning time (ns) | 99 out of 100 scans completed in this amount of time. |
| Max scanning time (ns) | The max time scanning any one source file. |
| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. |
| 99th percentile edit time (ns) | 99 out of 100 edits completed in this amount of time. |
| Max edit time (ns) | The max time editing any one source file. |

</TabItem>

</Tabs>
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
---
sidebar_label: "Use nameof operator in ArgumentException"
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# Use nameof operator in ArgumentException

**org.openrewrite.csharp.recipes.meziantou.analyzer.ArgumentExceptionShouldSpecifyArgumentNameMA0043**


## Recipe source

[GitHub](https://github.com/openrewrite/rewrite-csharp/blob/main/rewrite-csharp/src/main/java/org/openrewrite/csharp/recipes/meziantou/analyzer/ArgumentExceptionShouldSpecifyArgumentNameMA0043.java),
[Issue Tracker](https://github.com/openrewrite/rewrite-csharp/issues),
[Maven Central](https://central.sonatype.com/artifact/org.openrewrite/rewrite-csharp/)

This recipe is available under the [Moderne Source Available License](https://docs.moderne.io/licensing/moderne-source-available-license).


## Usage

This recipe has no required configuration options. It can be activated by adding a dependency on `org.openrewrite:rewrite-csharp` in your build file or by running a shell command (in which case no build changes are needed):
<Tabs groupId="projectType">


<TabItem value="moderne-cli" label="Moderne CLI">

You will need to have configured the [Moderne CLI](https://docs.moderne.io/user-documentation/moderne-cli/getting-started/cli-intro) on your machine before you can run the following command.

```shell title="shell"
mod run . --recipe ArgumentExceptionShouldSpecifyArgumentNameMA0043
```

If the recipe is not available locally, then you can install it using:
```shell
mod config recipes jar install org.openrewrite:rewrite-csharp:{{VERSION_ORG_OPENREWRITE_REWRITE_CSHARP}}
```
</TabItem>
</Tabs>

## See how this recipe works across multiple open-source repositories

import RecipeCallout from '@site/src/components/ModerneLink';

<RecipeCallout link="https://app.moderne.io/recipes/org.openrewrite.csharp.recipes.meziantou.analyzer.ArgumentExceptionShouldSpecifyArgumentNameMA0043" />

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

Please [contact Moderne](https://moderne.io/product) for more information about safely running the recipes on your own codebase in a private SaaS.
## Data Tables

<Tabs groupId="data-tables">
<TabItem value="org.openrewrite.table.SourcesFileResults" label="SourcesFileResults">

### Source files that had results
**org.openrewrite.table.SourcesFileResults**

_Source files that were modified by the recipe run._

| Column Name | Description |
| ----------- | ----------- |
| Source path before the run | The source path of the file before the run. `null` when a source file was created during the run. |
| Source path after the run | A recipe may modify the source path. This is the path after the run. `null` when a source file was deleted during the run. |
| Parent of the recipe that made changes | In a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all. |
| Recipe that made changes | The specific recipe that made a change. |
| Estimated time saving | An estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds. |
| Cycle | The recipe cycle in which the change was made. |

</TabItem>

<TabItem value="org.openrewrite.table.SourcesFileErrors" label="SourcesFileErrors">

### Source files that errored on a recipe
**org.openrewrite.table.SourcesFileErrors**

_The details of all errors produced by a recipe run._

| Column Name | Description |
| ----------- | ----------- |
| Source path | The file that failed to parse. |
| Recipe that made changes | The specific recipe that made a change. |
| Stack trace | The stack trace of the failure. |

</TabItem>

<TabItem value="org.openrewrite.table.RecipeRunStats" label="RecipeRunStats">

### Recipe performance
**org.openrewrite.table.RecipeRunStats**

_Statistics used in analyzing the performance of recipes._

| Column Name | Description |
| ----------- | ----------- |
| The recipe | The recipe whose stats are being measured both individually and cumulatively. |
| Source file count | The number of source files the recipe ran over. |
| Source file changed count | The number of source files which were changed in the recipe run. Includes files created, deleted, and edited. |
| Cumulative scanning time (ns) | The total time spent across the scanning phase of this recipe. |
| 99th percentile scanning time (ns) | 99 out of 100 scans completed in this amount of time. |
| Max scanning time (ns) | The max time scanning any one source file. |
| Cumulative edit time (ns) | The total time spent across the editing phase of this recipe. |
| 99th percentile edit time (ns) | 99 out of 100 edits completed in this amount of time. |
| Max edit time (ns) | The max time editing any one source file. |

</TabItem>

</Tabs>
Loading
Loading