Skip to content
Merged
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
13 changes: 7 additions & 6 deletions ReqIFSharp/ReqIFDeserializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@

return result;
}
catch (Exception ex) when (!(ex is OperationCanceledException))

Check warning on line 167 in ReqIFSharp/ReqIFDeserializer.cs

View workflow job for this annotation

GitHub Actions / Build

Either log this exception and handle it, or rethrow it with some contextual information.

Check warning on line 167 in ReqIFSharp/ReqIFDeserializer.cs

View workflow job for this annotation

GitHub Actions / Build

Either log this exception and handle it, or rethrow it with some contextual information.
{
this.logger.LogError(ex, "An error occurred while deserializing file {Path}", fileUri);
throw;
Expand Down Expand Up @@ -269,7 +269,7 @@
/// <returns>
/// Fully de-referenced <see cref="IEnumerable{ReqIF}"/> object graphs
/// </returns>
private IEnumerable<ReqIF> DeserializeReqIF(Stream stream, SupportedFileExtensionKind fileExtensionKind, bool validate = false, ValidationEventHandler validationEventHandler = null)

Check warning on line 272 in ReqIFSharp/ReqIFDeserializer.cs

View workflow job for this annotation

GitHub Actions / Build

Refactor this method to reduce its Cognitive Complexity from 19 to the 15 allowed.

Check warning on line 272 in ReqIFSharp/ReqIFDeserializer.cs

View workflow job for this annotation

GitHub Actions / Build

Refactor this method to reduce its Cognitive Complexity from 19 to the 15 allowed.
{
XmlReader xmlReader;

Expand All @@ -293,7 +293,7 @@

while (xmlReader.Read())
{
if ((xmlReader.NodeType == XmlNodeType.Element) && (xmlReader.Name == "REQ-IF"))

Check warning on line 296 in ReqIFSharp/ReqIFDeserializer.cs

View workflow job for this annotation

GitHub Actions / Build

Define a constant instead of using this literal 'REQ-IF' 4 times.

Check warning on line 296 in ReqIFSharp/ReqIFDeserializer.cs

View workflow job for this annotation

GitHub Actions / Build

Define a constant instead of using this literal 'REQ-IF' 4 times.
{
var reqif = new ReqIF(this.loggerFactory);
reqif.ReadXml(xmlReader);
Expand All @@ -301,7 +301,7 @@
}
}

this.logger.LogTrace("xml read in {Time}", sw.ElapsedMilliseconds);

Check warning on line 304 in ReqIFSharp/ReqIFDeserializer.cs

View workflow job for this annotation

GitHub Actions / Build

Define a constant instead of using this literal 'xml read in {Time}' 4 times.

Check warning on line 304 in ReqIFSharp/ReqIFDeserializer.cs

View workflow job for this annotation

GitHub Actions / Build

Define a constant instead of using this literal 'xml read in {Time}' 4 times.
sw.Stop();

return reqifs;
Expand Down Expand Up @@ -377,7 +377,7 @@
/// <returns>
/// Fully de-referenced <see cref="IEnumerable{ReqIF}"/> object graphs
/// </returns>
private async Task<IEnumerable<ReqIF>> DeserializeReqIFAsync(Stream stream, SupportedFileExtensionKind fileExtensionKind, CancellationToken token, bool validate = false, ValidationEventHandler validationEventHandler = null)

Check warning on line 380 in ReqIFSharp/ReqIFDeserializer.cs

View workflow job for this annotation

GitHub Actions / Build

Refactor this method to reduce its Cognitive Complexity from 19 to the 15 allowed.

Check warning on line 380 in ReqIFSharp/ReqIFDeserializer.cs

View workflow job for this annotation

GitHub Actions / Build

Refactor this method to reduce its Cognitive Complexity from 19 to the 15 allowed.
{
XmlReader xmlReader;

Expand Down Expand Up @@ -538,14 +538,15 @@
var @namespace = type.Namespace;
var reqifSchemaResourceName = $"{@namespace}.Resources.{resourceName}";

var stream = a.GetManifestResourceStream(reqifSchemaResourceName);

if (stream == null)
using (var stream = a.GetManifestResourceStream(reqifSchemaResourceName))
{
throw new MissingManifestResourceException($"The {reqifSchemaResourceName} resource could not be found");
if (stream == null)
{
throw new MissingManifestResourceException($"The {reqifSchemaResourceName} resource could not be found");
}

return XmlSchema.Read(stream, validationEventHandler);
}

return XmlSchema.Read(stream, validationEventHandler);
}
}
}
Loading