Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,14 @@ public void Initialize(IncrementalGeneratorInitializationContext context)

private void Execute(SourceProductionContext context, AdditionalText operationInterfacesFile)
{
var operationInterfacesText = operationInterfacesFile.GetText(context.CancellationToken);
if (operationInterfacesText is null)
{
throw new InvalidOperationException("Failed to read OperationInterfaces.xml");
}

var operationInterfacesText = operationInterfacesFile.GetText(context.CancellationToken) ?? throw new InvalidOperationException("Failed to read OperationInterfaces.xml");
var operationInterfaces = XDocument.Parse(operationInterfacesText.ToString());
this.GenerateOperationInterfaces(in context, operationInterfaces);
}

private void GenerateOperationInterfaces(in SourceProductionContext context, XDocument operationInterfaces)
{
var tree = operationInterfaces.XPathSelectElement("/Tree");
if (tree is null)
{
throw new InvalidOperationException("Failed to find the IOperation root.");
}

var tree = operationInterfaces.XPathSelectElement("/Tree") ?? throw new InvalidOperationException("Failed to find the IOperation root.");
var documentData = new DocumentData(operationInterfaces);
foreach (var pair in documentData.Interfaces)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,7 @@ static void AddPublicTypesFromNamespace(INamespaceSymbol? namespaceSymbol, Immut

private void Execute(in SourceProductionContext context, CompilationData compilationData, AdditionalText syntaxFile)
{
var syntaxText = syntaxFile.GetText(context.CancellationToken);
if (syntaxText is null)
{
throw new InvalidOperationException("Failed to read Syntax.xml");
}

var syntaxText = syntaxFile.GetText(context.CancellationToken) ?? throw new InvalidOperationException("Failed to read Syntax.xml");
var syntaxData = new SyntaxData(compilationData, XDocument.Parse(syntaxText.ToString()));
this.GenerateSyntaxWrappers(in context, syntaxData);
this.GenerateSyntaxWrapperHelper(in context, syntaxData.Nodes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,7 @@ private void HandleDeclaration(SyntaxNodeAnalysisContext context, bool needsComm
}

XElement completeDocumentation = null;
var relevantXmlElement = documentation.Content.GetFirstXmlElement(XmlCommentHelper.SummaryXmlTag);
if (relevantXmlElement == null)
{
relevantXmlElement = documentation.Content.GetFirstXmlElement(XmlCommentHelper.ContentXmlTag);
}

var relevantXmlElement = documentation.Content.GetFirstXmlElement(XmlCommentHelper.SummaryXmlTag) ?? documentation.Content.GetFirstXmlElement(XmlCommentHelper.ContentXmlTag);
if (relevantXmlElement == null)
{
relevantXmlElement = documentation.Content.GetFirstXmlElement(XmlCommentHelper.IncludeXmlTag);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@ internal static IEnumerable<XElement> XPathSelectElements(this XNode node, strin

private static Type GetTypeFromEither(string contractName, string desktopName)
{
var type = TryGetType(contractName);

if (type == null)
{
type = TryGetType(desktopName);
}

var type = TryGetType(contractName) ?? TryGetType(desktopName);
return type;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private static void HandleOpenBraceToken(SyntaxTreeAnalysisContext context, Synt
// value is ({ P: 0 })
expectPrecedingSpace = false;
}
else if (prevToken is { RawKind: (int)SyntaxKind.OpenBracketToken, Parent: { RawKind: (int)SyntaxKindEx.ListPattern } })
else if (prevToken is { RawKind: (int)SyntaxKind.OpenBracketToken, Parent.RawKind: (int)SyntaxKindEx.ListPattern })
{
// value is [{ P: 0 }, { P: 0 }]
expectPrecedingSpace = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ internal class SA1024ColonsMustBeSpacedCorrectly : DiagnosticAnalyzer
public const string DiagnosticId = "SA1024";
private const string HelpLink = "https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1024.md";
private static readonly LocalizableString Title = new LocalizableResourceString(nameof(SpacingResources.SA1024Title), SpacingResources.ResourceManager, typeof(SpacingResources));
#pragma warning disable IDE0052 // Remove unread private members
private static readonly LocalizableString MessageFormat = new LocalizableResourceString(nameof(SpacingResources.SA1024MessageNotPreceded), SpacingResources.ResourceManager, typeof(SpacingResources));
#pragma warning restore IDE0052 // Remove unread private members
private static readonly LocalizableString Description = new LocalizableResourceString(nameof(SpacingResources.SA1024Description), SpacingResources.ResourceManager, typeof(SpacingResources));

private static readonly LocalizableString MessageNotPreceded = new LocalizableResourceString(nameof(SpacingResources.SA1024MessageNotPreceded), SpacingResources.ResourceManager, typeof(SpacingResources));
Expand Down