Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version updated #86

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/RulesEngine/Actions/ActionBase.cs
Original file line number Diff line number Diff line change
@@ -4,7 +4,6 @@
using RulesEngine.Models;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace RulesEngine.Actions
2 changes: 0 additions & 2 deletions src/RulesEngine/Actions/EvaluateRuleAction.cs
Original file line number Diff line number Diff line change
@@ -3,10 +3,8 @@

using RulesEngine.ExpressionBuilders;
using RulesEngine.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace RulesEngine.Actions
1 change: 0 additions & 1 deletion src/RulesEngine/Actions/ExpressionOutputAction.cs
Original file line number Diff line number Diff line change
@@ -3,7 +3,6 @@

using RulesEngine.ExpressionBuilders;
using RulesEngine.Models;
using System.Threading;
using System.Threading.Tasks;

namespace RulesEngine.Actions
2 changes: 0 additions & 2 deletions src/RulesEngine/Exceptions/ExpressionParserException.cs
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Text;

namespace RulesEngine.Exceptions
{
2 changes: 0 additions & 2 deletions src/RulesEngine/Exceptions/RuleException.cs
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Text;

namespace RulesEngine.Exceptions
{
2 changes: 0 additions & 2 deletions src/RulesEngine/Exceptions/ScopedParamException.cs
Original file line number Diff line number Diff line change
@@ -2,8 +2,6 @@
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Text;

namespace RulesEngine.Exceptions
{
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@
using RulesEngine.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Dynamic.Core.Exceptions;
using System.Linq.Expressions;

1 change: 0 additions & 1 deletion src/RulesEngine/ExpressionBuilders/RuleExpressionParser.cs
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
// Licensed under the MIT License.

using FastExpressionCompiler;
using RulesEngine.HelperFunctions;
using RulesEngine.Models;
using System;
using System.Collections.Generic;
3 changes: 0 additions & 3 deletions src/RulesEngine/Extensions/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RulesEngine.Extensions
{
Original file line number Diff line number Diff line change
@@ -5,7 +5,6 @@
using System.Collections.Generic;
using System.Linq;


namespace RulesEngine.Extensions
{
public static class ListofRuleResultTreeExtension
1 change: 0 additions & 1 deletion src/RulesEngine/HelperFunctions/ExpressionUtils.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Linq;

namespace RulesEngine.HelperFunctions
1 change: 0 additions & 1 deletion src/RulesEngine/HelperFunctions/Helpers.cs
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

namespace RulesEngine.HelperFunctions
{
1 change: 0 additions & 1 deletion src/RulesEngine/HelperFunctions/MemCache.cs
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
// Licensed under the MIT License.

using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;

8 changes: 0 additions & 8 deletions src/RulesEngine/Models/ImplicitObject.cs
Original file line number Diff line number Diff line change
@@ -4,16 +4,11 @@

using System.Diagnostics.CodeAnalysis;

using System.Diagnostics.CodeAnalysis;

namespace RulesEngine.Models
{
[ExcludeFromCodeCoverage]
public class ImplicitObject
{

#region Implicit Operators
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not want region blocks?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the region wraps one block of code. in my opinion, it isn't necessary


public static implicit operator ImplicitObject(bool value) => default;

public static implicit operator ImplicitObject(bool? value) => default;
@@ -35,8 +30,5 @@ public class ImplicitObject
public static implicit operator ImplicitObject(float value) => default;

public static implicit operator ImplicitObject(float? value) => default;

#endregion

}
}
1 change: 0 additions & 1 deletion src/RulesEngine/Models/RuleExpressionParameter.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq.Expressions;

1 change: 0 additions & 1 deletion src/RulesEngine/Models/RuleParameter.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using FastExpressionCompiler;
using RulesEngine.HelperFunctions;
using System;
using System.Linq;
2 changes: 0 additions & 2 deletions src/RulesEngine/Models/RuleResultTree.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using RulesEngine.HelperFunctions;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;

10 changes: 6 additions & 4 deletions src/RulesEngine/RulesEngine.cs
Original file line number Diff line number Diff line change
@@ -459,10 +459,12 @@ private static string UpdateErrorMessage(string errorMessage, IDictionary<string

if (model != null)
{
using var jDoc = JsonSerializer.SerializeToDocument(model);
errorMessage = jDoc.RootElement.TryGetProperty(propertyName, out var jElement) ?
errorMessage.Replace($"$({property})", jElement.GetRawText() ?? $"({property})") :
errorMessage.Replace($"$({property})", $"({property})");
using (var jDoc = JsonSerializer.SerializeToDocument(model))
{
errorMessage = jDoc.RootElement.TryGetProperty(propertyName, out var jElement) ?
errorMessage.Replace($"$({property})", jElement.GetRawText() ?? $"({property})") :
errorMessage.Replace($"$({property})", $"({property})");
}
}

return errorMessage;
4 changes: 2 additions & 2 deletions src/RulesEngine/RulesEngine.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<Nullable>disable</Nullable>
<Version>6.0.5</Version>
<Version>6.0.6</Version>
<PackageId>RulesEngineEx</PackageId>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://github.com/asulwer/RulesEngine</PackageProjectUrl>

Unchanged files with check annotations Beta

Assert.All(andResults,
c => {
Assert.Equal(c.IsSuccess, c.ChildResults.Last().IsSuccess);
Assert.Single(c.ChildResults.Where(d => c.IsSuccess == d.IsSuccess));

Check warning on line 47 in test/RulesEngine.UnitTest/NestedRulesTest.cs

GitHub Actions / build

Do not use a Where clause to filter before calling Assert.Single. Use the overload of Assert.Single that accepts a filtering function. (https://xunit.net/xunit.analyzers/rules/xUnit2031)

Check warning on line 47 in test/RulesEngine.UnitTest/NestedRulesTest.cs

GitHub Actions / build

Do not use a Where clause to filter before calling Assert.Single. Use the overload of Assert.Single that accepts a filtering function. (https://xunit.net/xunit.analyzers/rules/xUnit2031)
Assert.True(c.ChildResults.SkipLast(1).All(d => d.IsSuccess == true));
});
Assert.All(orResults,
c => {
Assert.Equal(c.IsSuccess, c.ChildResults.Last().IsSuccess);
Assert.Single(c.ChildResults.Where(d => c.IsSuccess == d.IsSuccess));

Check warning on line 54 in test/RulesEngine.UnitTest/NestedRulesTest.cs

GitHub Actions / build

Do not use a Where clause to filter before calling Assert.Single. Use the overload of Assert.Single that accepts a filtering function. (https://xunit.net/xunit.analyzers/rules/xUnit2031)

Check warning on line 54 in test/RulesEngine.UnitTest/NestedRulesTest.cs

GitHub Actions / build

Do not use a Where clause to filter before calling Assert.Single. Use the overload of Assert.Single that accepts a filtering function. (https://xunit.net/xunit.analyzers/rules/xUnit2031)
Assert.True(c.ChildResults.SkipLast(1).All(d => d.IsSuccess == false));
});
}
Assert.All(andResults,
c => {
Assert.Equal(c.IsSuccess, c.ChildResults.Last().IsSuccess);
Assert.Single(c.ChildResults.Where(d => c.IsSuccess == d.IsSuccess));

Check warning on line 243 in test/RulesEngine.UnitTest/NestedRulesTest.cs

GitHub Actions / build

Do not use a Where clause to filter before calling Assert.Single. Use the overload of Assert.Single that accepts a filtering function. (https://xunit.net/xunit.analyzers/rules/xUnit2031)

Check warning on line 243 in test/RulesEngine.UnitTest/NestedRulesTest.cs

GitHub Actions / build

Do not use a Where clause to filter before calling Assert.Single. Use the overload of Assert.Single that accepts a filtering function. (https://xunit.net/xunit.analyzers/rules/xUnit2031)
Assert.True(c.ChildResults.SkipLast(1).All(d => d.IsSuccess == true));
});
Assert.All(orResults,
c => {
Assert.Equal(c.IsSuccess, c.ChildResults.Last().IsSuccess);
Assert.Single(c.ChildResults.Where(d => c.IsSuccess == d.IsSuccess));

Check warning on line 250 in test/RulesEngine.UnitTest/NestedRulesTest.cs

GitHub Actions / build

Do not use a Where clause to filter before calling Assert.Single. Use the overload of Assert.Single that accepts a filtering function. (https://xunit.net/xunit.analyzers/rules/xUnit2031)

Check warning on line 250 in test/RulesEngine.UnitTest/NestedRulesTest.cs

GitHub Actions / build

Do not use a Where clause to filter before calling Assert.Single. Use the overload of Assert.Single that accepts a filtering function. (https://xunit.net/xunit.analyzers/rules/xUnit2031)
Assert.True(c.ChildResults.SkipLast(1).All(d => d.IsSuccess == false));
});
}