Skip to content

Commit

Permalink
Fix sonarcloud issues
Browse files Browse the repository at this point in the history
Annotate assembly as unsupported on ios
  • Loading branch information
Michael Ganss committed Nov 9, 2021
1 parent 6b1c92f commit 2ede85a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions XmlSchemaClassGenerator.Tests/MemoryOutputWriter.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System.CodeDom;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Versioning;

[assembly:UnsupportedOSPlatform("ios")]
namespace XmlSchemaClassGenerator.Tests
{
internal class MemoryOutputWriter : OutputWriter
Expand Down
5 changes: 3 additions & 2 deletions XmlSchemaClassGenerator/CodeUtilities.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml;
Expand Down Expand Up @@ -360,7 +361,7 @@ public static KeyValuePair<NamespaceKey, string> ParseNamespace(string nsArg, st
return new KeyValuePair<NamespaceKey, string>(new NamespaceKey(source, xmlNs), netNs);
}

public static readonly List<(string Namespace, Func<GeneratorConfiguration,bool> Condition)> UsingNamespaces = new() {
public static readonly ImmutableList<(string Namespace, Func<GeneratorConfiguration,bool> Condition)> UsingNamespaces = ImmutableList.Create<(string Namespace, Func<GeneratorConfiguration, bool> Condition)>(
("System", c => c.CompactTypeNames),
("System.CodeDom.Compiler", c => c.CompactTypeNames),
("System.Collections.Generic", c => c.CompactTypeNames),
Expand All @@ -372,7 +373,7 @@ public static KeyValuePair<NamespaceKey, string> ParseNamespace(string nsArg, st
("System.Xml", c => c.CompactTypeNames),
("System.Xml.Schema", c => c.CompactTypeNames),
("System.Xml.Serialization", c => c.CompactTypeNames)
};
);

public static bool IsUsingNamespace(Type t, GeneratorConfiguration conf) => UsingNamespaces.Any(n => n.Namespace == t.Namespace && n.Condition(conf));

Expand Down
1 change: 1 addition & 0 deletions XmlSchemaClassGenerator/XmlSchemaClassGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="System.Collections.Immutable" Version="6.0.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
Expand Down

0 comments on commit 2ede85a

Please sign in to comment.