Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add diagnostic if no members are mapped (#1129)
Add ExpectNoMemberMappingsAttribute to expect no member mappings
- Loading branch information
Showing
60 changed files
with
415 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
sidebar_label: RMG066 | ||
description: 'Mapperly analyzer diagnostic RMG066 — No members are mapped in an object mapping' | ||
--- | ||
|
||
# RMG066 — No members are mapped in an object mapping | ||
|
||
If Mapperly maps to an object without mapping any member, `RMG066` is emitted. | ||
|
||
The generated implementation part of the mapping method usually looks like this: | ||
|
||
```csharp | ||
public partial Target Map(Source source) | ||
{ | ||
var target = new Target(); | ||
return target; | ||
} | ||
``` | ||
|
||
Usually this is not expected. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--- | ||
sidebar_position: 15 | ||
description: A list of all analyzer diagnostics used by Mapperly and how to configure them. | ||
--- | ||
|
||
import AnalyzerRules from '@site/src/components/AnalyzerRules'; | ||
|
||
# Analyzer diagnostics | ||
|
||
Mapperly emits several diagnostics: | ||
|
||
<AnalyzerRules></AnalyzerRules> | ||
|
||
:::info | ||
Mapperly only emits updated source code on build. | ||
You won't see the updated mapper code or mapper diagnostics until you perform a build. | ||
|
||
This is done for performance reasons, | ||
otherwise the IDE could become laggy. | ||
::: | ||
|
||
## Editorconfig | ||
|
||
The severity of these diagnostics can be customized via an `.editorconfig` file: | ||
|
||
```editorconfig title=".editorconfig" | ||
[*.cs] | ||
dotnet_diagnostic.{RuleID}.severity = error | ||
dotnet_diagnostic.RMG020.severity = error | ||
``` | ||
|
||
## Suppress diagnostics | ||
|
||
See the Microsoft documentation on how to suppress diagnostics in C# [here](https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/suppress-warnings). | ||
In summary, you can use one of the following approaches: | ||
|
||
- Use the `.editorconfig` file (for an entire file, directory or project, depending on the editorconfig scope) | ||
`dotnet_diagnostic.RMG066.severity = none` | ||
- Use the `SuppressMessageAttribute` (for a method) | ||
`[SuppressMessage("Mapper", "RMG066:No members are mapped in an object mapping")]` | ||
- Use precompiler directives (for specific lines of code) | ||
`#pragma warning disable RMG066 // No members are mapped in an object mapping` | ||
`#pragma warning restore RMG066 // No members are mapped in an object mapping` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.