Skip to content

Commit

Permalink
Update documentation on relevant parts and fix sonar complaint from t…
Browse files Browse the repository at this point in the history
…ests
  • Loading branch information
sakari-malkki committed Sep 11, 2024
1 parent de923cb commit 1d2485b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public async Task CancelReadDoubleDataValuesAsyncValidIntegersIsCancelled()
DataIndexer indexer = new(testMeta, matrixMap);

using CancellationTokenSource cts = new();
cts.Cancel();
await cts.CancelAsync();
CancellationToken cToken = cts.Token;

async Task call() => await reader.ReadDoubleDataValuesAsync(targetBuffer, 0, indexer, cToken);
Expand Down Expand Up @@ -224,7 +224,7 @@ public async Task CancelReadAddDecimalDataValuesAsyncValidIntegersIsCancelled()
DataIndexer indexer = new(testMeta, matrixMap);

using CancellationTokenSource cts = new();
cts.Cancel();
await cts.CancelAsync();
CancellationToken cToken = cts.Token;

async Task call() => await reader.ReadDecimalDataValuesAsync(targetBuffer, 0, indexer, cToken);
Expand Down Expand Up @@ -283,7 +283,7 @@ public async Task CancelReadUnsafeDoubleValuesAsyncValidIntegersIsCancelled()
DataIndexer indexer = new(testMeta, matrixMap);

using CancellationTokenSource cts = new();
cts.Cancel();
await cts.CancelAsync();
CancellationToken cToken = cts.Token;

// Act and Assert
Expand Down
8 changes: 4 additions & 4 deletions Px.Utils/Validation/DataValidation/DataValidatorFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class DataStringValidator : IDataValidator
/// <param name="encoding">Encoding format of the Px file.</param>
/// <param name="lineNumber">Line number for the validation item.</param>
/// <param name="charPos">Represents the position relative to the line for the validation item.</param>
/// <returns><see cref="ValidationFeedback"/> object if the entry is not a missing value string sequence, otherwise null.</returns>
/// <returns>Key value pair containing information about the rule violation if the entry is not a missing value string sequence, otherwise null.</returns>
public KeyValuePair<ValidationFeedbackKey, ValidationFeedbackValue>? Validate(List<byte> entry, EntryType entryType, Encoding encoding, int lineNumber, int charPos, string filename)
{
string value = encoding.GetString(entry.ToArray());
Expand Down Expand Up @@ -56,7 +56,7 @@ public class DataNumberValidator : IDataValidator
/// <param name="encoding">Encoding format of the Px file.</param>
/// <param name="lineNumber">Line number for the validation item.</param>
/// <param name="charPos">Represents the position relative to the line for the validation item.</param>
/// <returns><see cref="ValidationFeedback"/> object if the entry is not a valid number, otherwise null.</returns>
/// <returns>Key value pair containing information about the rule violation if the entry is not a valid number, otherwise null.</returns>
public KeyValuePair<ValidationFeedbackKey, ValidationFeedbackValue>? Validate(List<byte> entry, EntryType entryType, Encoding encoding, int lineNumber, int charPos, string filename)
{
if (entry.Count >= MaxLength && !decimal.TryParse(entry.ToArray(), out _))
Expand Down Expand Up @@ -138,7 +138,7 @@ public class DataSeparatorValidator : IDataValidator
/// <param name="encoding">Encoding format of the Px file.</param>
/// <param name="lineNumber">Line number for the validation item.</param>
/// <param name="charPos">Represents the position relative to the line for the validation item.</param>
/// <returns><see cref="ValidationFeedback"/> object if the entry is not a valid item separator, otherwise null.</returns>
/// <returns>Key value pair containing information about the rule violation if the entry is not a valid item separator, otherwise null.</returns>
public KeyValuePair<ValidationFeedbackKey, ValidationFeedbackValue>? Validate(List<byte> entry, EntryType entryType, Encoding encoding, int lineNumber, int charPos, string filename)
{
if (_separator == entry[0])
Expand Down Expand Up @@ -182,7 +182,7 @@ public class DataStructureValidator : IDataValidator
/// <param name="lineNumber">Line number for the validation item.</param>
/// <param name="charPos">Represents the position relative to the line for the validation item.</param>
/// <param name="feedbacks">Reference to a list of feedback items to which any validation feedback is added to.</param>
/// <returns><see cref="ValidationFeedback"/> object if the entry sequence is invalid. Otherwise null.</returns>
/// <returns>Key value pair containing information about the rule violation if the entry sequence is invalid. Otherwise null.</returns>
public KeyValuePair<ValidationFeedbackKey, ValidationFeedbackValue>? Validate(List<byte> entry, EntryType entryType, Encoding encoding, int lineNumber, int charPos, string filename)
{
if (_allowedPreviousTokens[entryType].Contains(_previousTokenType))
Expand Down

0 comments on commit 1d2485b

Please sign in to comment.