Commit 4d75b982 authored by Nick Craver's avatar Nick Craver

Tests: make analyzers happy because why not

parent b5b65e60
...@@ -469,7 +469,7 @@ public void InsertWithCustomTableNameMapper() ...@@ -469,7 +469,7 @@ public void InsertWithCustomTableNameMapper()
var name = type.Name + "s"; var name = type.Name + "s";
if (type.IsInterface() && name.StartsWith("I")) if (type.IsInterface() && name.StartsWith("I"))
name = name.Substring(1); return name.Substring(1);
return name; return name;
} }
}; };
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
using System.Linq; using System.Linq;
using System.Text; using System.Text;
#pragma warning disable RCS1141 // Add parameter to documentation comment.
namespace Massive namespace Massive
{ {
public static class ObjectExtensions public static class ObjectExtensions
...@@ -115,7 +116,9 @@ public class DynamicModel ...@@ -115,7 +116,9 @@ public class DynamicModel
{ {
private readonly DbProviderFactory _factory; private readonly DbProviderFactory _factory;
#pragma warning disable 0649 #pragma warning disable 0649
#pragma warning disable RCS1169 // Mark field as read-only.
private string _connectionString; private string _connectionString;
#pragma warning restore RCS1169 // Mark field as read-only.
#pragma warning restore 0649 #pragma warning restore 0649
public DynamicModel(string connectionStringName = "", string tableName = "", string primaryKeyField = "") public DynamicModel(string connectionStringName = "", string tableName = "", string primaryKeyField = "")
...@@ -450,4 +453,5 @@ public virtual dynamic Single(object key, string columns = "*") ...@@ -450,4 +453,5 @@ public virtual dynamic Single(object key, string columns = "*")
} }
} }
} }
#pragma warning restore RCS1141 // Add parameter to documentation comment.
#endif #endif
\ No newline at end of file
...@@ -51,7 +51,7 @@ public void Add(Action<int> iteration, string name) ...@@ -51,7 +51,7 @@ public void Add(Action<int> iteration, string name)
Add(new Test(iteration, name)); Add(new Test(iteration, name));
} }
public void AddAsync(Func<int, Task> iterationAsync, string name) public void AsyncAdd(Func<int, Task> iterationAsync, string name)
{ {
Add(new Test(iterationAsync, name)); Add(new Test(iterationAsync, name));
} }
...@@ -230,7 +230,7 @@ public async Task RunAsync(int iterations) ...@@ -230,7 +230,7 @@ public async Task RunAsync(int iterations)
Try(() => Try(() =>
{ {
var query = new Belgrade.SqlClient.SqlDb.QueryMapper(ConnectionString); var query = new Belgrade.SqlClient.SqlDb.QueryMapper(ConnectionString);
tests.AddAsync(id => query.ExecuteReader("SELECT TOP 1 * FROM Posts WHERE Id = " + id, tests.AsyncAdd(id => query.ExecuteReader("SELECT TOP 1 * FROM Posts WHERE Id = " + id,
reader => reader =>
{ {
var post = new Post(); var post = new Post();
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
using System.Reflection; using System.Reflection;
using System.Reflection.Emit; using System.Reflection.Emit;
#pragma warning disable RCS1023 // Format empty block.
namespace PetaPoco namespace PetaPoco
{ {
// Poco's marked [Explicit] require all column properties to be marked // Poco's marked [Explicit] require all column properties to be marked
...@@ -37,8 +38,8 @@ public class Column : Attribute ...@@ -37,8 +38,8 @@ public class Column : Attribute
public class ResultColumn : Column public class ResultColumn : Column
{ {
public ResultColumn() { } public ResultColumn() { }
public ResultColumn(string name) : base(name) { } public ResultColumn(string name) : base(name) { }
} }
// Specify the table name of a poco // Specify the table name of a poco
[AttributeUsage(AttributeTargets.Class)] [AttributeUsage(AttributeTargets.Class)]
...@@ -1287,7 +1288,7 @@ public void Dispose() ...@@ -1287,7 +1288,7 @@ public void Dispose()
_db.CloseSharedConnection(); _db.CloseSharedConnection();
} }
} }
// Member variables // Member variables
private readonly string _connectionString; private readonly string _connectionString;
private readonly string _providerName; private readonly string _providerName;
...@@ -1441,4 +1442,5 @@ public void Build(StringBuilder sb, List<object> args, Sql lhs) ...@@ -1441,4 +1442,5 @@ public void Build(StringBuilder sb, List<object> args, Sql lhs)
} }
} }
} }
#pragma warning restore RCS1023 // Format empty block.
#endif #endif
\ No newline at end of file
...@@ -9,6 +9,6 @@ internal class SomaConfig : MsSqlConfig ...@@ -9,6 +9,6 @@ internal class SomaConfig : MsSqlConfig
public override Action<PreparedStatement> Logger => noOp; public override Action<PreparedStatement> Logger => noOp;
private static readonly Action<PreparedStatement> noOp = x => { }; private static readonly Action<PreparedStatement> noOp = x => { /* nope */ };
} }
} }
...@@ -791,7 +791,7 @@ public async Task Issue563_QueryAsyncShouldThrowException() ...@@ -791,7 +791,7 @@ public async Task Issue563_QueryAsyncShouldThrowException()
var data = (await connection.QueryAsync<int>("select 1 union all select 2; RAISERROR('after select', 16, 1);").ConfigureAwait(false)).ToList(); var data = (await connection.QueryAsync<int>("select 1 union all select 2; RAISERROR('after select', 16, 1);").ConfigureAwait(false)).ToList();
Assert.Fail(); Assert.Fail();
} }
catch (SqlException ex) when (ex.Message == "after select") { } catch (SqlException ex) when (ex.Message == "after select") { /* swallow only this */ }
} }
} }
} }
\ No newline at end of file
...@@ -90,7 +90,7 @@ private class _ExplicitConstructors ...@@ -90,7 +90,7 @@ private class _ExplicitConstructors
private readonly bool WentThroughProperConstructor; private readonly bool WentThroughProperConstructor;
public _ExplicitConstructors() { } public _ExplicitConstructors() { /* yep */ }
[ExplicitConstructor] [ExplicitConstructor]
public _ExplicitConstructors(string foo, int bar) public _ExplicitConstructors(string foo, int bar)
......
...@@ -471,7 +471,9 @@ private class TestFieldCaseAndPrivatesEntity ...@@ -471,7 +471,9 @@ private class TestFieldCaseAndPrivatesEntity
private int b { get; set; } private int b { get; set; }
public int GetB() { return b; } public int GetB() { return b; }
public int c = 0; public int c = 0;
#pragma warning disable RCS1169 // Mark field as read-only.
private int d = 0; private int d = 0;
#pragma warning restore RCS1169 // Mark field as read-only.
public int GetD() { return d; } public int GetD() { return d; }
public int e { get; set; } public int e { get; set; }
private string f private string f
......
...@@ -176,7 +176,7 @@ static FactMySqlAttribute() ...@@ -176,7 +176,7 @@ static FactMySqlAttribute()
{ {
try try
{ {
using (GetMySqlConnection(true)) { } using (GetMySqlConnection(true)) { /* just trying to see if it works */ }
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -71,7 +71,7 @@ static FactPostgresqlAttribute() ...@@ -71,7 +71,7 @@ static FactPostgresqlAttribute()
{ {
try try
{ {
using (GetOpenNpgsqlConnection()) { } using (GetOpenNpgsqlConnection()) { /* just trying to see if it works */ }
} }
catch (Exception ex) catch (Exception ex)
{ {
......
...@@ -69,7 +69,7 @@ public void Issue136_ValueTypeHandlers() ...@@ -69,7 +69,7 @@ public void Issue136_ValueTypeHandlers()
public class LocalDateHandler : SqlMapper.TypeHandler<LocalDate> public class LocalDateHandler : SqlMapper.TypeHandler<LocalDate>
{ {
private LocalDateHandler() { } private LocalDateHandler() { /* private constructor */ }
// Make the field type ITypeHandler to ensure it cannot be used with SqlMapper.AddTypeHandler<T>(TypeHandler<T>) // Make the field type ITypeHandler to ensure it cannot be used with SqlMapper.AddTypeHandler<T>(TypeHandler<T>)
// by mistake. // by mistake.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment