File tree Expand file tree Collapse file tree 14 files changed +34
-8
lines changed Expand file tree Collapse file tree 14 files changed +34
-8
lines changed Original file line number Diff line number Diff line change @@ -67,6 +67,20 @@ csharp_space_between_method_call_parameter_list_parentheses = false
67
67
csharp_space_between_parentheses = false
68
68
csharp_preserve_single_line_blocks = true
69
69
70
+ dotnet_diagnostic.CA1002.severity = none # Do not expose generic lists.
71
+ dotnet_diagnostic.CA1003.severity = none # Use generic event handler instances.
72
+ dotnet_diagnostic.CA1008.severity = none # Enums should have zero value.
73
+ dotnet_diagnostic.CA1014.severity = none # Mark assemblies with CLSCompliantAttribute.
74
+ dotnet_diagnostic.CA1031.severity = none # Do not catch general exception types.
75
+ dotnet_diagnostic.CA1032.severity = none # Implement standard exception constructors.
76
+ dotnet_diagnostic.CA1062.severity = silent # Validate arguments of public methods.
77
+ dotnet_diagnostic.CA1307.severity = silent # Specify StringComparison for clarity.
78
+ dotnet_diagnostic.CA1508.severity = silent # Avoid dead conditional code.
79
+ dotnet_diagnostic.CA1849.severity = none # Call async methods when in an async method.
80
+ dotnet_diagnostic.CA2000.severity = none # Use recommended Dispose pattern.
81
+ dotnet_diagnostic.CA2100.severity = none # Review SQL queries for security vulnerabilities.
82
+ dotnet_diagnostic.CA2213.severity = silent # Disposable fields should be disposed.
83
+ dotnet_diagnostic.CA5398.severity = none # Avoid hardcoded SslProtocols values.
70
84
dotnet_diagnostic.SA1003.severity = none # Operator must not be followed by whitespace.
71
85
dotnet_diagnostic.SA1008.severity = none # Opening parenthesis must not be preceded by a space.
72
86
dotnet_diagnostic.SA1009.severity = none # Closing parenthesis must not be followed by a space.
Original file line number Diff line number Diff line change 14
14
<RepositoryUrl >https://github.com/mysql-net/MySqlConnector.git</RepositoryUrl >
15
15
<DebugType >embedded</DebugType >
16
16
<LangVersion >preview</LangVersion >
17
- <AnalysisLevel >latest-recommended </AnalysisLevel >
17
+ <AnalysisLevel >latest-all </AnalysisLevel >
18
18
<PublishRepositoryUrl >true</PublishRepositoryUrl >
19
19
<EmbedUntrackedSources >true</EmbedUntrackedSources >
20
20
<GenerateDocumentationFile >true</GenerateDocumentationFile >
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ public ConnectionSettings(MySqlConnectionStringBuilder csb)
84
84
throw new NotSupportedException ( "All specified TLS versions are incompatible with this platform." ) ;
85
85
}
86
86
87
- if ( csb . TlsCipherSuites != "" )
87
+ if ( csb . TlsCipherSuites . Length != 0 )
88
88
{
89
89
#if NETCOREAPP3_0_OR_GREATER
90
90
var tlsCipherSuites = new List < TlsCipherSuite > ( ) ;
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ internal sealed class RandomLoadBalancer : ILoadBalancer
26
26
27
27
public IEnumerable < string > LoadBalance ( IReadOnlyList < string > hosts )
28
28
{
29
+ #pragma warning disable CA5394 // Do not use insecure randomness
29
30
// from https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm
30
31
var shuffled = new List < string > ( hosts ) ;
31
32
for ( var i = hosts . Count - 1 ; i >= 1 ; i -- )
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ internal sealed class NormalizedSchema
6
6
{
7
7
private const string ReQuoted = @"`((?:[^`]|``)+)`" ;
8
8
private const string ReUnQuoted = @"([^\.`]+)" ;
9
- private static readonly string ReEither = $@ "(?:{ ReQuoted } |{ ReUnQuoted } )";
9
+ private const string ReEither = $@ "(?:{ ReQuoted } |{ ReUnQuoted } )";
10
10
11
11
private static readonly Regex NameRe = new (
12
12
$@ "^\s*{ ReEither } \s*(?:\.\s*{ ReEither } \s*)?$",
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ public static class MySqlConnectorLogManager
9
9
/// Allows the <see cref="IMySqlConnectorLoggerProvider"/> to be set for this library. <see cref="Provider"/> can
10
10
/// be set once, and must be set before any other library methods are used.
11
11
/// </summary>
12
+ #pragma warning disable CA1044 // Properties should not be write only
12
13
public static IMySqlConnectorLoggerProvider Provider
13
14
{
14
15
internal get
Original file line number Diff line number Diff line change @@ -49,6 +49,9 @@ namespace MySqlConnector;
49
49
/// </code>
50
50
/// </summary>
51
51
/// <remarks>The proposed ADO.NET API that <see cref="MySqlBatch"/> is based on is not finalized. This API is experimental and may change in the future.</remarks>
52
+ #if NET6_0_OR_GREATER
53
+ #pragma warning disable CA1063 // Implement IDisposable Correctly
54
+ #endif
52
55
public sealed class MySqlBatch :
53
56
#if NET6_0_OR_GREATER
54
57
DbBatch ,
@@ -120,7 +123,7 @@ public MySqlDataReader ExecuteReader(CommandBehavior commandBehavior = CommandBe
120
123
#else
121
124
public async Task < MySqlDataReader > ExecuteReaderAsync ( CancellationToken cancellationToken = default ) =>
122
125
#endif
123
- ( MySqlDataReader ) await ExecuteDbDataReaderAsync ( CommandBehavior . Default , cancellationToken ) ;
126
+ ( MySqlDataReader ) await ExecuteDbDataReaderAsync ( CommandBehavior . Default , cancellationToken ) . ConfigureAwait ( false ) ;
124
127
125
128
//// TODO: new ExecuteReaderAsync(CommandBehavior)
126
129
@@ -340,7 +343,7 @@ private bool NeedsPrepare(out Exception? exception)
340
343
exception = new InvalidOperationException( "Connection must be Open; current state is {0}" . FormatInvariant ( Connection . State ) ) ;
341
344
else if ( BatchCommands . Count == 0 )
342
345
exception = new InvalidOperationException( "BatchCommands must contain a command" ) ;
343
- else if ( Connection ? . HasActiveReader ?? false )
346
+ else if ( Connection . HasActiveReader )
344
347
exception = new InvalidOperationException( "Cannot call Prepare when there is an open DataReader for this command; it must be closed first." ) ;
345
348
else
346
349
exception = GetExceptionForInvalidCommands( ) ;
Original file line number Diff line number Diff line change @@ -446,8 +446,6 @@ private bool IsValid([NotNullWhen(false)] out Exception? exception)
446
446
MySqlParameterCollection ? IMySqlCommand . OutParameters { get ; set ; }
447
447
MySqlParameter ? IMySqlCommand . ReturnParameter { get ; set ; }
448
448
449
- private static readonly IMySqlConnectorLogger Log = MySqlConnectorLogManager . CreateLogger ( nameof ( MySqlCommand ) ) ;
450
-
451
449
private readonly int m_commandId ;
452
450
private bool m_isDisposed ;
453
451
private MySqlConnection ? m_connection ;
Original file line number Diff line number Diff line change 1
1
namespace MySqlConnector ;
2
2
3
+ #pragma warning disable CA1027 // Mark enums with FlagsAttribute
3
4
#pragma warning disable CA1069 // Enum values should not be duplicated
4
5
/// <summary>
5
6
/// Specifies the type of connection to make to the server.
Original file line number Diff line number Diff line change @@ -962,6 +962,8 @@ private static void AddOption(MySqlConnectionStringOption option)
962
962
s_options . Add ( key , option ) ;
963
963
}
964
964
965
+ #pragma warning disable CA1065 // Do not raise exceptions in unexpected locations
966
+ #pragma warning disable CA1810 // Initialize reference type static fields inline
965
967
static MySqlConnectionStringOption ( )
966
968
{
967
969
s_options = new ( StringComparer . OrdinalIgnoreCase ) ;
You can’t perform that action at this time.
0 commit comments