Setup Rosyln code analyzers (#2052)
This commit is contained in:
@@ -121,7 +121,7 @@ namespace Newtonsoft.Json
|
|||||||
hashCode -= hashCode >> 5;
|
hashCode -= hashCode >> 5;
|
||||||
for (Entry entry = _entries[hashCode & _mask]; entry != null; entry = entry.Next)
|
for (Entry entry = _entries[hashCode & _mask]; entry != null; entry = entry.Next)
|
||||||
{
|
{
|
||||||
if (entry.HashCode == hashCode && entry.Value.Equals(key))
|
if (entry.HashCode == hashCode && entry.Value.Equals(key, StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
return entry.Value;
|
return entry.Value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,9 @@ namespace Newtonsoft.Json
|
|||||||
public partial class JsonTextReader : JsonReader, IJsonLineInfo
|
public partial class JsonTextReader : JsonReader, IJsonLineInfo
|
||||||
{
|
{
|
||||||
private const char UnicodeReplacementChar = '\uFFFD';
|
private const char UnicodeReplacementChar = '\uFFFD';
|
||||||
|
#if HAVE_BIG_INTEGER
|
||||||
private const int MaximumJavascriptIntegerCharacterLength = 380;
|
private const int MaximumJavascriptIntegerCharacterLength = 380;
|
||||||
|
#endif
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
internal int LargeBufferLength { get; set; } = int.MaxValue / 2;
|
internal int LargeBufferLength { get; set; } = int.MaxValue / 2;
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await reader.SkipAsync();
|
await reader.SkipAsync().ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -859,7 +859,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
|
|
||||||
JObject parentObject = (JObject)parent;
|
JObject parentObject = (JObject)parent;
|
||||||
string propertyName = r.Value.ToString();
|
string propertyName = r.Value.ToString();
|
||||||
JProperty existingPropertyWithName = parentObject.Property(propertyName);
|
JProperty existingPropertyWithName = parentObject.Property(propertyName, StringComparison.Ordinal);
|
||||||
if (existingPropertyWithName != null)
|
if (existingPropertyWithName != null)
|
||||||
{
|
{
|
||||||
if (duplicatePropertyNameHandling == DuplicatePropertyNameHandling.Ignore)
|
if (duplicatePropertyNameHandling == DuplicatePropertyNameHandling.Ignore)
|
||||||
|
|||||||
@@ -352,13 +352,13 @@ namespace Newtonsoft.Json.Linq
|
|||||||
{
|
{
|
||||||
ValidationUtils.ArgumentNotNull(propertyName, nameof(propertyName));
|
ValidationUtils.ArgumentNotNull(propertyName, nameof(propertyName));
|
||||||
|
|
||||||
JProperty property = Property(propertyName);
|
JProperty property = Property(propertyName, StringComparison.Ordinal);
|
||||||
|
|
||||||
return property?.Value;
|
return property?.Value;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
JProperty property = Property(propertyName);
|
JProperty property = Property(propertyName, StringComparison.Ordinal);
|
||||||
if (property != null)
|
if (property != null)
|
||||||
{
|
{
|
||||||
property.Value = value;
|
property.Value = value;
|
||||||
@@ -591,7 +591,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <returns><c>true</c> if item was successfully removed; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if item was successfully removed; otherwise, <c>false</c>.</returns>
|
||||||
public bool Remove(string propertyName)
|
public bool Remove(string propertyName)
|
||||||
{
|
{
|
||||||
JProperty property = Property(propertyName);
|
JProperty property = Property(propertyName, StringComparison.Ordinal);
|
||||||
if (property == null)
|
if (property == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -609,7 +609,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
/// <returns><c>true</c> if a value was successfully retrieved; otherwise, <c>false</c>.</returns>
|
/// <returns><c>true</c> if a value was successfully retrieved; otherwise, <c>false</c>.</returns>
|
||||||
public bool TryGetValue(string propertyName, out JToken value)
|
public bool TryGetValue(string propertyName, out JToken value)
|
||||||
{
|
{
|
||||||
JProperty property = Property(propertyName);
|
JProperty property = Property(propertyName, StringComparison.Ordinal);
|
||||||
if (property == null)
|
if (property == null)
|
||||||
{
|
{
|
||||||
value = null;
|
value = null;
|
||||||
@@ -637,7 +637,7 @@ namespace Newtonsoft.Json.Linq
|
|||||||
|
|
||||||
bool ICollection<KeyValuePair<string, JToken>>.Contains(KeyValuePair<string, JToken> item)
|
bool ICollection<KeyValuePair<string, JToken>>.Contains(KeyValuePair<string, JToken> item)
|
||||||
{
|
{
|
||||||
JProperty property = Property(item.Key);
|
JProperty property = Property(item.Key, StringComparison.Ordinal);
|
||||||
if (property == null)
|
if (property == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -28,12 +28,14 @@
|
|||||||
<MinClientVersion>2.12</MinClientVersion>
|
<MinClientVersion>2.12</MinClientVersion>
|
||||||
<IncludeSymbols>true</IncludeSymbols>
|
<IncludeSymbols>true</IncludeSymbols>
|
||||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||||
|
<CodeAnalysisRuleset>Newtonsoft.Json.ruleset</CodeAnalysisRuleset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="**\*.orig" />
|
<None Remove="**\*.orig" />
|
||||||
<None Include="..\..\LICENSE.md" Pack="true" PackagePath="LICENSE.md" />
|
<None Include="..\..\LICENSE.md" Pack="true" PackagePath="LICENSE.md" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.2" PrivateAssets="All" />
|
||||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Condition="'$(TargetFramework)'=='net45'">
|
<PropertyGroup Condition="'$(TargetFramework)'=='net45'">
|
||||||
|
|||||||
@@ -1,15 +1,199 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0"?>
|
||||||
<RuleSet Name="Newtonsoft.Json.ruleset" ToolsVersion="12.0">
|
<RuleSet Name="All Rules Disabled" Description="All Rules are disabled." ToolsVersion="15.0">
|
||||||
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
|
<Rules AnalyzerId="Microsoft.CodeAnalysis.VersionCheckAnalyzer" RuleNamespace="Microsoft.CodeAnalysis.VersionCheckAnalyzer">
|
||||||
<Rule Id="CA1304" Action="Error" />
|
<Rule Id="CA9999" Action="None" /> <!-- Analyzer version mismatch -->
|
||||||
<Rule Id="CA1305" Action="Error" />
|
</Rules>
|
||||||
<Rule Id="CA1307" Action="Error" />
|
<Rules AnalyzerId="Microsoft.CodeQuality.Analyzers" RuleNamespace="Microsoft.CodeQuality.Analyzers">
|
||||||
<Rule Id="CA1308" Action="Error" />
|
<Rule Id="CA1000" Action="None" /> <!-- Do not declare static members on generic types -->
|
||||||
<Rule Id="CA1309" Action="Error" />
|
<Rule Id="CA1008" Action="None" /> <!-- Enums should have zero value -->
|
||||||
<Rule Id="CA1804" Action="Warning" />
|
<Rule Id="CA1010" Action="None" /> <!-- Collections should implement generic interface -->
|
||||||
<Rule Id="CA1811" Action="Warning" />
|
<Rule Id="CA1012" Action="None" /> <!-- Abstract types should not have constructors -->
|
||||||
<Rule Id="CA1812" Action="Warning" />
|
<Rule Id="CA1014" Action="None" /> <!-- Mark assemblies with CLSCompliant -->
|
||||||
<Rule Id="CA1823" Action="Warning" />
|
<Rule Id="CA1016" Action="None" /> <!-- Mark assemblies with assembly version -->
|
||||||
<Rule Id="CA1903" Action="Error" />
|
<Rule Id="CA1017" Action="None" /> <!-- Mark assemblies with ComVisible -->
|
||||||
</Rules>
|
<Rule Id="CA1018" Action="None" /> <!-- Mark attributes with AttributeUsageAttribute -->
|
||||||
</RuleSet>
|
<Rule Id="CA1024" Action="None" /> <!-- Use properties where appropriate -->
|
||||||
|
<Rule Id="CA1027" Action="None" /> <!-- Mark enums with FlagsAttribute -->
|
||||||
|
<Rule Id="CA1028" Action="None" /> <!-- Enum Storage should be Int32 -->
|
||||||
|
<Rule Id="CA1030" Action="None" /> <!-- Use events where appropriate -->
|
||||||
|
<Rule Id="CA1031" Action="None" /> <!-- Do not catch general exception types -->
|
||||||
|
<Rule Id="CA1033" Action="None" /> <!-- Interface methods should be callable by child types -->
|
||||||
|
<Rule Id="CA1034" Action="None" /> <!-- Nested types should not be visible -->
|
||||||
|
<Rule Id="CA1036" Action="None" /> <!-- Override methods on comparable types -->
|
||||||
|
<Rule Id="CA1040" Action="None" /> <!-- Avoid empty interfaces -->
|
||||||
|
<Rule Id="CA1041" Action="None" /> <!-- Provide ObsoleteAttribute message -->
|
||||||
|
<Rule Id="CA1043" Action="None" /> <!-- Use Integral Or String Argument For Indexers -->
|
||||||
|
<Rule Id="CA1044" Action="None" /> <!-- Properties should not be write only -->
|
||||||
|
<Rule Id="CA1050" Action="None" /> <!-- Declare types in namespaces -->
|
||||||
|
<Rule Id="CA1051" Action="None" /> <!-- Do not declare visible instance fields -->
|
||||||
|
<Rule Id="CA1052" Action="None" /> <!-- Static holder types should be Static or NotInheritable -->
|
||||||
|
<Rule Id="CA1054" Action="None" /> <!-- Uri parameters should not be strings -->
|
||||||
|
<Rule Id="CA1055" Action="None" /> <!-- Uri return values should not be strings -->
|
||||||
|
<Rule Id="CA1056" Action="None" /> <!-- Uri properties should not be strings -->
|
||||||
|
<Rule Id="CA1060" Action="None" /> <!-- Move pinvokes to native methods class -->
|
||||||
|
<Rule Id="CA1061" Action="None" /> <!-- Do not hide base class methods -->
|
||||||
|
<Rule Id="CA1062" Action="None" /> <!-- Validate arguments of public methods -->
|
||||||
|
<Rule Id="CA1063" Action="None" /> <!-- Implement IDisposable Correctly -->
|
||||||
|
<Rule Id="CA1064" Action="None" /> <!-- Exceptions should be public -->
|
||||||
|
<Rule Id="CA1066" Action="None" /> <!-- Type {0} should implement IEquatable<T> because it overrides Equals -->
|
||||||
|
<Rule Id="CA1067" Action="None" /> <!-- Override Object.Equals(object) when implementing IEquatable<T> -->
|
||||||
|
<Rule Id="CA1068" Action="None" /> <!-- CancellationToken parameters must come last -->
|
||||||
|
<Rule Id="CA1501" Action="None" /> <!-- Avoid excessive inheritance -->
|
||||||
|
<Rule Id="CA1502" Action="None" /> <!-- Avoid excessive complexity -->
|
||||||
|
<Rule Id="CA1505" Action="None" /> <!-- Avoid unmaintainable code -->
|
||||||
|
<Rule Id="CA1506" Action="None" /> <!-- Avoid excessive class coupling -->
|
||||||
|
<Rule Id="CA1508" Action="None" /> <!-- Avoid dead conditional code -->
|
||||||
|
<Rule Id="CA1509" Action="None" /> <!-- Invalid entry in code metrics rule specification file -->
|
||||||
|
<Rule Id="CA1707" Action="None" /> <!-- Identifiers should not contain underscores -->
|
||||||
|
<Rule Id="CA1708" Action="None" /> <!-- Identifiers should differ by more than case -->
|
||||||
|
<Rule Id="CA1710" Action="None" /> <!-- Identifiers should have correct suffix -->
|
||||||
|
<Rule Id="CA1711" Action="None" /> <!-- Identifiers should not have incorrect suffix -->
|
||||||
|
<Rule Id="CA1712" Action="None" /> <!-- Do not prefix enum values with type name -->
|
||||||
|
<Rule Id="CA1714" Action="None" /> <!-- Flags enums should have plural names -->
|
||||||
|
<Rule Id="CA1715" Action="None" /> <!-- Identifiers should have correct prefix -->
|
||||||
|
<Rule Id="CA1716" Action="None" /> <!-- Identifiers should not match keywords -->
|
||||||
|
<Rule Id="CA1717" Action="None" /> <!-- Only FlagsAttribute enums should have plural names -->
|
||||||
|
<Rule Id="CA1720" Action="None" /> <!-- Identifier contains type name -->
|
||||||
|
<Rule Id="CA1721" Action="None" /> <!-- Property names should not match get methods -->
|
||||||
|
<Rule Id="CA1724" Action="None" /> <!-- Type names should not match namespaces -->
|
||||||
|
<Rule Id="CA1725" Action="None" /> <!-- Parameter names should match base declaration -->
|
||||||
|
<Rule Id="CA1801" Action="None" /> <!-- Review unused parameters -->
|
||||||
|
<Rule Id="CA1802" Action="None" /> <!-- Use literals where appropriate -->
|
||||||
|
<Rule Id="CA1806" Action="None" /> <!-- Do not ignore method results -->
|
||||||
|
<Rule Id="CA1812" Action="Warning" /> <!-- Avoid uninstantiated internal classes -->
|
||||||
|
<Rule Id="CA1814" Action="None" /> <!-- Prefer jagged arrays over multidimensional -->
|
||||||
|
<Rule Id="CA1815" Action="None" /> <!-- Override equals and operator equals on value types -->
|
||||||
|
<Rule Id="CA1819" Action="None" /> <!-- Properties should not return arrays -->
|
||||||
|
<Rule Id="CA1822" Action="None" /> <!-- Mark members as static -->
|
||||||
|
<Rule Id="CA1823" Action="Warning" /> <!-- Avoid unused private fields -->
|
||||||
|
<Rule Id="CA2007" Action="Error" /> <!-- Do not directly await a Task -->
|
||||||
|
<Rule Id="CA2119" Action="None" /> <!-- Seal methods that satisfy private interfaces -->
|
||||||
|
<Rule Id="CA2211" Action="None" /> <!-- Non-constant fields should not be visible -->
|
||||||
|
<Rule Id="CA2214" Action="None" /> <!-- Do not call overridable methods in constructors -->
|
||||||
|
<Rule Id="CA2217" Action="None" /> <!-- Do not mark enums with FlagsAttribute -->
|
||||||
|
<Rule Id="CA2219" Action="None" /> <!-- Do not raise exceptions in finally clauses -->
|
||||||
|
<Rule Id="CA2225" Action="None" /> <!-- Operator overloads have named alternates -->
|
||||||
|
<Rule Id="CA2226" Action="None" /> <!-- Operators should have symmetrical overloads -->
|
||||||
|
<Rule Id="CA2227" Action="None" /> <!-- Collection properties should be read only -->
|
||||||
|
<Rule Id="CA2231" Action="None" /> <!-- Overload operator equals on overriding value type Equals -->
|
||||||
|
<Rule Id="CA2244" Action="None" /> <!-- Do not duplicate indexed element initializations -->
|
||||||
|
</Rules>
|
||||||
|
<Rules AnalyzerId="Microsoft.CodeQuality.CSharp.Analyzers" RuleNamespace="Microsoft.CodeQuality.CSharp.Analyzers">
|
||||||
|
<Rule Id="CA1001" Action="None" /> <!-- Types that own disposable fields should be disposable -->
|
||||||
|
<Rule Id="CA1003" Action="None" /> <!-- Use generic event handler instances -->
|
||||||
|
<Rule Id="CA1019" Action="None" /> <!-- Define accessors for attribute arguments -->
|
||||||
|
<Rule Id="CA1032" Action="None" /> <!-- Implement standard exception constructors -->
|
||||||
|
<Rule Id="CA1065" Action="None" /> <!-- Do not raise exceptions in unexpected locations -->
|
||||||
|
<Rule Id="CA1200" Action="None" /> <!-- Avoid using cref tags with a prefix -->
|
||||||
|
<Rule Id="CA1507" Action="None" /> <!-- Use nameof to express symbol names -->
|
||||||
|
<Rule Id="CA1821" Action="None" /> <!-- Remove empty Finalizers -->
|
||||||
|
<Rule Id="CA2200" Action="None" /> <!-- Rethrow to preserve stack details. -->
|
||||||
|
<Rule Id="CA2234" Action="None" /> <!-- Pass system uri objects instead of strings -->
|
||||||
|
</Rules>
|
||||||
|
<Rules AnalyzerId="Microsoft.CodeQuality.VisualBasic.Analyzers" RuleNamespace="Microsoft.CodeQuality.VisualBasic.Analyzers">
|
||||||
|
<Rule Id="CA1001" Action="None" /> <!-- Types that own disposable fields should be disposable -->
|
||||||
|
<Rule Id="CA1003" Action="None" /> <!-- Use generic event handler instances -->
|
||||||
|
<Rule Id="CA1019" Action="None" /> <!-- Define accessors for attribute arguments -->
|
||||||
|
<Rule Id="CA1032" Action="None" /> <!-- Implement standard exception constructors -->
|
||||||
|
<Rule Id="CA1065" Action="None" /> <!-- Do not raise exceptions in unexpected locations -->
|
||||||
|
<Rule Id="CA1200" Action="None" /> <!-- Avoid using cref tags with a prefix -->
|
||||||
|
<Rule Id="CA1507" Action="None" /> <!-- Use nameof to express symbol names -->
|
||||||
|
<Rule Id="CA1821" Action="None" /> <!-- Remove empty Finalizers -->
|
||||||
|
<Rule Id="CA2200" Action="None" /> <!-- Rethrow to preserve stack details. -->
|
||||||
|
<Rule Id="CA2218" Action="None" /> <!-- Override GetHashCode on overriding Equals -->
|
||||||
|
<Rule Id="CA2224" Action="None" /> <!-- Override Equals on overloading operator equals -->
|
||||||
|
<Rule Id="CA2234" Action="None" /> <!-- Pass system uri objects instead of strings -->
|
||||||
|
</Rules>
|
||||||
|
<Rules AnalyzerId="Microsoft.NetCore.Analyzers" RuleNamespace="Microsoft.NetCore.Analyzers">
|
||||||
|
<Rule Id="CA1303" Action="None" /> <!-- Do not pass literals as localized parameters -->
|
||||||
|
<Rule Id="CA1304" Action="Error" /> <!-- Specify CultureInfo -->
|
||||||
|
<Rule Id="CA1305" Action="Error" /> <!-- Specify IFormatProvider -->
|
||||||
|
<Rule Id="CA1307" Action="Error" /> <!-- Specify StringComparison -->
|
||||||
|
<Rule Id="CA1308" Action="None" /> <!-- Normalize strings to uppercase -->
|
||||||
|
<Rule Id="CA1401" Action="None" /> <!-- P/Invokes should not be visible -->
|
||||||
|
<Rule Id="CA1813" Action="None" /> <!-- Avoid unsealed attributes -->
|
||||||
|
<Rule Id="CA1816" Action="None" /> <!-- Dispose methods should call SuppressFinalize -->
|
||||||
|
<Rule Id="CA1820" Action="None" /> <!-- Test for empty strings using string length -->
|
||||||
|
<Rule Id="CA1826" Action="None" /> <!-- Do not use Enumerable methods on indexable collections. Instead use the collection directly -->
|
||||||
|
<Rule Id="CA2000" Action="None" /> <!-- Dispose objects before losing scope -->
|
||||||
|
<Rule Id="CA2002" Action="None" /> <!-- Do not lock on objects with weak identity -->
|
||||||
|
<Rule Id="CA2008" Action="None" /> <!-- Do not create tasks without passing a TaskScheduler -->
|
||||||
|
<Rule Id="CA2009" Action="None" /> <!-- Do not call ToImmutableCollection on an ImmutableCollection value -->
|
||||||
|
<Rule Id="CA2100" Action="None" /> <!-- Review SQL queries for security vulnerabilities -->
|
||||||
|
<Rule Id="CA2101" Action="None" /> <!-- Specify marshaling for P/Invoke string arguments -->
|
||||||
|
<Rule Id="CA2208" Action="None" /> <!-- Instantiate argument exceptions correctly -->
|
||||||
|
<Rule Id="CA2213" Action="None" /> <!-- Disposable fields should be disposed -->
|
||||||
|
<Rule Id="CA2216" Action="None" /> <!-- Disposable types should declare finalizer -->
|
||||||
|
<Rule Id="CA2229" Action="None" /> <!-- Implement serialization constructors -->
|
||||||
|
<Rule Id="CA2235" Action="None" /> <!-- Mark all non-serializable fields -->
|
||||||
|
<Rule Id="CA2237" Action="None" /> <!-- Mark ISerializable types with serializable -->
|
||||||
|
<Rule Id="CA2241" Action="None" /> <!-- Provide correct arguments to formatting methods -->
|
||||||
|
<Rule Id="CA2242" Action="None" /> <!-- Test for NaN correctly -->
|
||||||
|
<Rule Id="CA2243" Action="None" /> <!-- Attribute string literals should parse correctly -->
|
||||||
|
<Rule Id="CA2300" Action="None" /> <!-- Do not use insecure deserializer BinaryFormatter -->
|
||||||
|
<Rule Id="CA2301" Action="None" /> <!-- Do not call BinaryFormatter.Deserialize without first setting BinaryFormatter.Binder -->
|
||||||
|
<Rule Id="CA2302" Action="None" /> <!-- Ensure BinaryFormatter.Binder is set before calling BinaryFormatter.Deserialize -->
|
||||||
|
<Rule Id="CA2305" Action="None" /> <!-- Do not use insecure deserializer LosFormatter -->
|
||||||
|
<Rule Id="CA2310" Action="None" /> <!-- Do not use insecure deserializer NetDataContractSerializer -->
|
||||||
|
<Rule Id="CA2311" Action="None" /> <!-- Do not deserialize without first setting NetDataContractSerializer.Binder -->
|
||||||
|
<Rule Id="CA2312" Action="None" /> <!-- Ensure NetDataContractSerializer.Binder is set before deserializing -->
|
||||||
|
<Rule Id="CA2315" Action="None" /> <!-- Do not use insecure deserializer ObjectStateFormatter -->
|
||||||
|
<Rule Id="CA3001" Action="None" /> <!-- Review code for SQL injection vulnerabilities -->
|
||||||
|
<Rule Id="CA3002" Action="None" /> <!-- Review code for XSS vulnerabilities -->
|
||||||
|
<Rule Id="CA3003" Action="None" /> <!-- Review code for file path injection vulnerabilities -->
|
||||||
|
<Rule Id="CA3004" Action="None" /> <!-- Review code for information disclosure vulnerabilities -->
|
||||||
|
<Rule Id="CA3005" Action="None" /> <!-- Review code for LDAP injection vulnerabilities -->
|
||||||
|
<Rule Id="CA3006" Action="None" /> <!-- Review code for process command injection vulnerabilities -->
|
||||||
|
<Rule Id="CA3007" Action="None" /> <!-- Review code for open redirect vulnerabilities -->
|
||||||
|
<Rule Id="CA3008" Action="None" /> <!-- Review code for XPath injection vulnerabilities -->
|
||||||
|
<Rule Id="CA3009" Action="None" /> <!-- Review code for XML injection vulnerabilities -->
|
||||||
|
<Rule Id="CA3010" Action="None" /> <!-- Review code for XAML injection vulnerabilities -->
|
||||||
|
<Rule Id="CA3011" Action="None" /> <!-- Review code for DLL injection vulnerabilities -->
|
||||||
|
<Rule Id="CA3012" Action="None" /> <!-- Review code for regex injection vulnerabilities -->
|
||||||
|
<Rule Id="CA3061" Action="None" /> <!-- Do Not Add Schema By URL -->
|
||||||
|
<Rule Id="CA5350" Action="None" /> <!-- Do Not Use Weak Cryptographic Algorithms -->
|
||||||
|
<Rule Id="CA5351" Action="None" /> <!-- Do Not Use Broken Cryptographic Algorithms -->
|
||||||
|
<Rule Id="CA5358" Action="None" /> <!-- Do Not Use Unsafe Cipher Modes -->
|
||||||
|
<Rule Id="CA5359" Action="None" /> <!-- Do Not Disable Certificate Validation -->
|
||||||
|
<Rule Id="CA5360" Action="None" /> <!-- Do Not Call Dangerous Methods In Deserialization -->
|
||||||
|
<Rule Id="CA5361" Action="None" /> <!-- Do Not Disable SChannel Use of Strong Crypto -->
|
||||||
|
<Rule Id="CA5362" Action="None" /> <!-- Do Not Refer Self In Serializable Class -->
|
||||||
|
<Rule Id="CA5363" Action="None" /> <!-- Do Not Disable Request Validation -->
|
||||||
|
<Rule Id="CA5364" Action="None" /> <!-- Do Not Use Deprecated Security Protocols -->
|
||||||
|
<Rule Id="CA5365" Action="None" /> <!-- Do Not Disable HTTP Header Checking -->
|
||||||
|
<Rule Id="CA5367" Action="None" /> <!-- Do Not Serialize Types With Pointer Fields -->
|
||||||
|
<Rule Id="CA5368" Action="None" /> <!-- Set ViewStateUserKey For Classes Derived From Page -->
|
||||||
|
</Rules>
|
||||||
|
<Rules AnalyzerId="Microsoft.NetCore.CSharp.Analyzers" RuleNamespace="Microsoft.NetCore.CSharp.Analyzers">
|
||||||
|
<Rule Id="CA1309" Action="Error" /> <!-- Use ordinal stringcomparison -->
|
||||||
|
<Rule Id="CA1810" Action="None" /> <!-- Initialize reference type static fields inline -->
|
||||||
|
<Rule Id="CA1824" Action="None" /> <!-- Mark assemblies with NeutralResourcesLanguageAttribute -->
|
||||||
|
<Rule Id="CA1825" Action="Warning" /> <!-- Avoid zero-length array allocations. -->
|
||||||
|
<Rule Id="CA2010" Action="None" /> <!-- Always consume the value returned by methods marked with PreserveSigAttribute -->
|
||||||
|
<Rule Id="CA2201" Action="None" /> <!-- Do not raise reserved exception types -->
|
||||||
|
<Rule Id="CA2207" Action="None" /> <!-- Initialize value type static fields inline -->
|
||||||
|
</Rules>
|
||||||
|
<Rules AnalyzerId="Microsoft.NetCore.VisualBasic.Analyzers" RuleNamespace="Microsoft.NetCore.VisualBasic.Analyzers">
|
||||||
|
<Rule Id="CA1309" Action="Error" /> <!-- Use ordinal stringcomparison -->
|
||||||
|
<Rule Id="CA1810" Action="None" /> <!-- Initialize reference type static fields inline -->
|
||||||
|
<Rule Id="CA1824" Action="None" /> <!-- Mark assemblies with NeutralResourcesLanguageAttribute -->
|
||||||
|
<Rule Id="CA1825" Action="Warning" /> <!-- Avoid zero-length array allocations. -->
|
||||||
|
<Rule Id="CA2010" Action="None" /> <!-- Always consume the value returned by methods marked with PreserveSigAttribute -->
|
||||||
|
<Rule Id="CA2201" Action="None" /> <!-- Do not raise reserved exception types -->
|
||||||
|
<Rule Id="CA2207" Action="None" /> <!-- Initialize value type static fields inline -->
|
||||||
|
</Rules>
|
||||||
|
<Rules AnalyzerId="Microsoft.NetFramework.Analyzers" RuleNamespace="Microsoft.NetFramework.Analyzers">
|
||||||
|
<Rule Id="CA1058" Action="None" /> <!-- Types should not extend certain base types -->
|
||||||
|
<Rule Id="CA2153" Action="None" /> <!-- Do Not Catch Corrupted State Exceptions -->
|
||||||
|
<Rule Id="CA3075" Action="None" /> <!-- Insecure DTD processing in XML -->
|
||||||
|
<Rule Id="CA3147" Action="None" /> <!-- Mark Verb Handlers With Validate Antiforgery Token -->
|
||||||
|
</Rules>
|
||||||
|
<Rules AnalyzerId="Microsoft.NetFramework.CSharp.Analyzers" RuleNamespace="Microsoft.NetFramework.CSharp.Analyzers">
|
||||||
|
<Rule Id="CA3076" Action="None" /> <!-- Insecure XSLT script processing. -->
|
||||||
|
<Rule Id="CA3077" Action="None" /> <!-- Insecure Processing in API Design, XmlDocument and XmlTextReader -->
|
||||||
|
</Rules>
|
||||||
|
<Rules AnalyzerId="Microsoft.NetFramework.VisualBasic.Analyzers" RuleNamespace="Microsoft.NetFramework.VisualBasic.Analyzers">
|
||||||
|
<Rule Id="CA3076" Action="None" /> <!-- Insecure XSLT script processing. -->
|
||||||
|
<Rule Id="CA3077" Action="None" /> <!-- Insecure Processing in API Design, XmlDocument and XmlTextReader -->
|
||||||
|
</Rules>
|
||||||
|
</RuleSet>
|
||||||
|
|||||||
@@ -241,7 +241,9 @@ namespace Newtonsoft.Json.Schema
|
|||||||
|
|
||||||
internal string Location { get; set; }
|
internal string Location { get; set; }
|
||||||
|
|
||||||
|
#pragma warning disable CA1305 // Specify IFormatProvider
|
||||||
private readonly string _internalId = Guid.NewGuid().ToString("N");
|
private readonly string _internalId = Guid.NewGuid().ToString("N");
|
||||||
|
#pragma warning restore CA1305 // Specify IFormatProvider
|
||||||
|
|
||||||
internal string InternalId => _internalId;
|
internal string InternalId => _internalId;
|
||||||
|
|
||||||
|
|||||||
@@ -383,7 +383,9 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
// Defensively guard against a version of Linq where Enumerable.Empty<T> doesn't
|
// Defensively guard against a version of Linq where Enumerable.Empty<T> doesn't
|
||||||
// return an array, but throw in debug versions so a better strategy can be
|
// return an array, but throw in debug versions so a better strategy can be
|
||||||
// used if that ever happens.
|
// used if that ever happens.
|
||||||
|
#pragma warning disable CA1825 // Avoid zero-length array allocations.
|
||||||
return array ?? new T[0];
|
return array ?? new T[0];
|
||||||
|
#pragma warning restore CA1825 // Avoid zero-length array allocations.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ namespace Newtonsoft.Json.Utilities
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isEscapedUnicodeText = string.Equals(escapedValue, EscapedUnicodeText);
|
bool isEscapedUnicodeText = string.Equals(escapedValue, EscapedUnicodeText, StringComparison.Ordinal);
|
||||||
|
|
||||||
if (i > lastWritePosition)
|
if (i > lastWritePosition)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user