-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Nullable context incorporation + config (#13)
Add nullable annotation context directive Add config options for nullable context Some refactoring Add config options for nullable context Some refactoring
- Loading branch information
1 parent
2c44a05
commit f5df472
Showing
93 changed files
with
713 additions
and
210 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace Ossendorf.Csla.DataPortalExtensionGenerator; | ||
|
||
internal static class ConfigConstants { | ||
public const string MethodPrefix = "DataPortalExtensionGen_MethodPrefix"; | ||
public const string MethodSuffix = "DataPortalExtensionGen_MethodSuffix"; | ||
public const string NullableContext = "DataPortalExtensionGen_NullableContext"; | ||
public const string SuppressWarningCS8669 = "DataPortalExtensionGen_SuppressWarningCS8669"; | ||
} |
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
15 changes: 15 additions & 0 deletions
15
src/Csla.DataPortalExtensionGenerator/Diagnostics/DiagnosticId.cs
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,15 @@ | ||
using NetEscapades.EnumGenerators; | ||
|
||
namespace Ossendorf.Csla.DataPortalExtensionGenerator.Diagnostics; | ||
|
||
[EnumExtensions] | ||
internal enum DiagnosticId { | ||
// NotPartialDiagnostic | ||
DPEGEN001, | ||
// PrivateClassCanNotBeAParameterDiagnostic | ||
DPEGEN002, | ||
// NullableContextValueDiagnostic | ||
DPEGEN003, | ||
// SuppressWarningCS8669ValueDiagnostic | ||
DPEGEN004, | ||
} |
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
12 changes: 12 additions & 0 deletions
12
src/Csla.DataPortalExtensionGenerator/Diagnostics/NullableContextValueDiagnostic.cs
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,12 @@ | ||
using Microsoft.CodeAnalysis; | ||
using System.Globalization; | ||
|
||
namespace Ossendorf.Csla.DataPortalExtensionGenerator.Diagnostics; | ||
|
||
internal static class NullableContextValueDiagnostic { | ||
internal const string Message = $"The value '{{0}}' for setting '{ConfigConstants.NullableContext}' is not known. Only 'Enable' and 'Disable' are allowed. Default of 'Enable' is used."; | ||
internal const string Title = "Nullable context value unknown"; | ||
|
||
public static DiagnosticInfo Create(string configValue) | ||
=> new(new DiagnosticDescriptor(DiagnosticId.DPEGEN003.ToStringFast(), Title, string.Format(CultureInfo.InvariantCulture, Message, configValue), "Usage", defaultSeverity: DiagnosticSeverity.Warning, isEnabledByDefault: true), null); | ||
} |
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
12 changes: 12 additions & 0 deletions
12
src/Csla.DataPortalExtensionGenerator/Diagnostics/SuppressWarningCS8669ValueDiagnostic.cs
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,12 @@ | ||
using Microsoft.CodeAnalysis; | ||
using System.Globalization; | ||
|
||
namespace Ossendorf.Csla.DataPortalExtensionGenerator.Diagnostics; | ||
|
||
internal static class SuppressWarningCS8669ValueDiagnostic { | ||
internal const string Message = $"The value '{{0}}' for setting '{ConfigConstants.SuppressWarningCS8669}' is not parseable to boolean. Default of false is used."; | ||
internal const string Title = "CS8669 value unknown"; | ||
|
||
public static DiagnosticInfo Create(string configValue) | ||
=> new(new DiagnosticDescriptor(DiagnosticId.DPEGEN004.ToStringFast(), Title, string.Format(CultureInfo.InvariantCulture, Message, configValue), "Usage", defaultSeverity: DiagnosticSeverity.Warning, isEnabledByDefault: true), null); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
namespace Ossendorf.Csla.DataPortalExtensionGenerator; | ||
using Microsoft.CodeAnalysis; | ||
|
||
namespace Ossendorf.Csla.DataPortalExtensionGenerator; | ||
|
||
internal readonly record struct GeneratorOptions { | ||
public readonly string MethodPrefix; | ||
public readonly string MethodSuffix; | ||
public readonly NullableContextOptions NullableContextOptions; | ||
public readonly bool SuppressWarningCS8669; | ||
|
||
public GeneratorOptions(string methodPrefix, string methodSuffix) { | ||
public GeneratorOptions(string methodPrefix, string methodSuffix, NullableContextOptions nullableContextOptions, bool suppressWarningCS8669) { | ||
MethodPrefix = methodPrefix; | ||
MethodSuffix = methodSuffix; | ||
NullableContextOptions = nullableContextOptions; | ||
SuppressWarningCS8669 = suppressWarningCS8669; | ||
} | ||
} |
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.