diff --git a/.editorconfig b/.editorconfig index c66b6901..d6840cf5 100644 --- a/.editorconfig +++ b/.editorconfig @@ -191,6 +191,9 @@ dotnet_diagnostic.RCS1194.severity = none # RCS1163: Unused parameter. dotnet_diagnostic.RCS1163.severity = silent +# RCS1097: Remove redundant 'ToString' call +dotnet_diagnostic.RCS1097.severity = silent + # RCS1239: Use 'for' statement instead of 'while' statement. dotnet_diagnostic.RCS1239.severity = silent csharp_style_prefer_primary_constructors = true:suggestion diff --git a/EtLast.AdoNet.MsSql/Scopes/ResilientSqlScope/ResilientSqlScope.cs b/EtLast.AdoNet.MsSql/Scopes/ResilientSqlScope/ResilientSqlScope.cs index 9cf8b380..c052c785 100644 --- a/EtLast.AdoNet.MsSql/Scopes/ResilientSqlScope/ResilientSqlScope.cs +++ b/EtLast.AdoNet.MsSql/Scopes/ResilientSqlScope/ResilientSqlScope.cs @@ -280,7 +280,6 @@ private class TableWithOrder } } - [EditorBrowsable(EditorBrowsableState.Never)] public static class ResilientSqlScopeFluent { diff --git a/EtLast.AdoNet/Mutators/MergeToSql/MergeToSqlMutator.cs b/EtLast.AdoNet/Mutators/MergeToSql/MergeToSqlMutator.cs index d3266719..db802a63 100644 --- a/EtLast.AdoNet/Mutators/MergeToSql/MergeToSqlMutator.cs +++ b/EtLast.AdoNet/Mutators/MergeToSql/MergeToSqlMutator.cs @@ -207,7 +207,6 @@ private void ExecuteStatements() _command = null; _statements.Clear(); } - } [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/EtLast.Hosting/Logging/EtlContextIoToFileLogger.cs b/EtLast.Hosting/Logging/EtlContextIoToFileLogger.cs index 915f05e5..86d8505e 100644 --- a/EtLast.Hosting/Logging/EtlContextIoToFileLogger.cs +++ b/EtLast.Hosting/Logging/EtlContextIoToFileLogger.cs @@ -155,7 +155,6 @@ public override Stream OnFileOpened(string path, Stream underlyingStream, Encodi writer.Flush(); underlyingStream.Flush(); } - } return base.OnFileOpened(path, underlyingStream, encoding); diff --git a/EtLast/Mutators/Aggregation/Memory/MemoryAggregationMutator.cs b/EtLast/Mutators/Aggregation/Memory/MemoryAggregationMutator.cs index 7b154da1..2995bce4 100644 --- a/EtLast/Mutators/Aggregation/Memory/MemoryAggregationMutator.cs +++ b/EtLast/Mutators/Aggregation/Memory/MemoryAggregationMutator.cs @@ -130,7 +130,7 @@ protected override IEnumerable EvaluateImpl(Stopwatch netTimeStopwatch) } foreach (var row in groupRows) - (row as IRow).SetOwner(null); + (row as IRow)?.SetOwner(null); foreach (var aggregate in aggregates) { diff --git a/EtLast/Mutators/Aggregation/Memory/SortedMemoryAggregationMutator.cs b/EtLast/Mutators/Aggregation/Memory/SortedMemoryAggregationMutator.cs index ddf4d0c2..4f6b87d1 100644 --- a/EtLast/Mutators/Aggregation/Memory/SortedMemoryAggregationMutator.cs +++ b/EtLast/Mutators/Aggregation/Memory/SortedMemoryAggregationMutator.cs @@ -125,7 +125,7 @@ protected override IEnumerable EvaluateImpl(Stopwatch netTimeStopwatch) } foreach (var groupRow in groupRows) - (groupRow as IRow).SetOwner(null); + (groupRow as IRow)?.SetOwner(null); groupRows.Clear(); @@ -175,7 +175,7 @@ protected override IEnumerable EvaluateImpl(Stopwatch netTimeStopwatch) } foreach (var groupRow in groupRows) - (groupRow as IRow).SetOwner(null); + (groupRow as IRow)?.SetOwner(null); groupRows.Clear(); diff --git a/EtLast/Processes/Abstracts/AbstractProcess.cs b/EtLast/Processes/Abstracts/AbstractProcess.cs index de24ffec..11a40bee 100644 --- a/EtLast/Processes/Abstracts/AbstractProcess.cs +++ b/EtLast/Processes/Abstracts/AbstractProcess.cs @@ -150,7 +150,7 @@ protected void BeginExecution(ICaller caller, FlowState flowState, bool overwrit .ToHashSet(); var properties = GetType().GetProperties(BindingFlags.Instance | BindingFlags.SetProperty | BindingFlags.Public) - .Where(p => p.SetMethod != null && p.SetMethod.IsPrivate != true && !baseProperties.Contains(p.Name) && p.GetIndexParameters().Length == 0) + .Where(p => p.SetMethod?.IsPrivate == false && !baseProperties.Contains(p.Name) && p.GetIndexParameters().Length == 0) .ToList(); foreach (var property in properties) @@ -178,7 +178,7 @@ public void ValidateParameterAnnotations() public static void ValidateParameterAnnotations(IProcess process, object instance) { var properties = instance.GetType().GetProperties(BindingFlags.Instance | BindingFlags.SetProperty | BindingFlags.Public) - .Where(p => p.SetMethod != null && p.SetMethod.IsPrivate != true && p.GetIndexParameters().Length == 0) + .Where(p => p.SetMethod?.IsPrivate == false && p.GetIndexParameters().Length == 0) .ToList(); foreach (var property in properties) diff --git a/EtLast/Processes/Delimited/WriteToDelimitedMutator.cs b/EtLast/Processes/Delimited/WriteToDelimitedMutator.cs index 65ef835d..f7cefac5 100644 --- a/EtLast/Processes/Delimited/WriteToDelimitedMutator.cs +++ b/EtLast/Processes/Delimited/WriteToDelimitedMutator.cs @@ -241,7 +241,6 @@ private class SinkEntry public required MemoryStream Buffer { get; init; } public int RowCount = 0; } - } [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/EtLast/Processes/Json/JsonArrayReader.cs b/EtLast/Processes/Json/JsonArrayReader.cs index 94591961..cb2004ab 100644 --- a/EtLast/Processes/Json/JsonArrayReader.cs +++ b/EtLast/Processes/Json/JsonArrayReader.cs @@ -77,6 +77,7 @@ protected override IEnumerable Produce() } var entry = enumerator.Current; + entryIndex++; resultCount++; initialValues[ColumnName] = entry; diff --git a/EtLast/Rows/Row.cs b/EtLast/Rows/Row.cs index 61058018..4c7d9c6e 100644 --- a/EtLast/Rows/Row.cs +++ b/EtLast/Rows/Row.cs @@ -5,7 +5,7 @@ public sealed class Row(IEtlContext context, IProcess process, long id, IEnumerable> initialValues) : IRow { public IProcess Owner { get; private set; } = process; - public long Id { get; private set; } = id; + public long Id { get; } = id; public IEnumerable> Values => _values; public int ValueCount => _values.Count; diff --git a/EtLast/TypeConverters/DoubleConverter.cs b/EtLast/TypeConverters/DoubleConverter.cs index cafc8c73..a4b09bba 100644 --- a/EtLast/TypeConverters/DoubleConverter.cs +++ b/EtLast/TypeConverters/DoubleConverter.cs @@ -87,5 +87,4 @@ public static class DoubleConverterFluent public static ReaderColumn AsDouble(this ReaderColumn column) => column.WithTypeConverter(new DoubleConverter()); public static TextReaderColumn AsDouble(this TextReaderColumn column) => column.WithTypeConverter(new DoubleConverter()); public static IConvertMutatorBuilder_NullStrategy ToDouble(this IConvertMutatorBuilder_WithTypeConverter builder) => builder.WithTypeConverter(new DoubleConverter()); - } \ No newline at end of file diff --git a/Tests/EtLast.Tests.Unit/Tests/Rows/RowTests.cs b/Tests/EtLast.Tests.Unit/Tests/Rows/RowTests.cs index e4f5c677..63ef0f7a 100644 --- a/Tests/EtLast.Tests.Unit/Tests/Rows/RowTests.cs +++ b/Tests/EtLast.Tests.Unit/Tests/Rows/RowTests.cs @@ -35,7 +35,6 @@ public void KeyCaseIgnored() Assert.AreEqual(new DateTime(2020, 02, 20, 12, 12, 0, 666), result); } - [TestMethod] public void SingleNullColumnResultsNullKey() {