You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2021/05/28 16:02:12 UTC

[lucenenet] branch master updated (67c0c6b -> b03b936)

This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git.


    from 67c0c6b  Added needed using statement.
     new a525c9b  Fix SonarQube's "Any() should be used to test for emptiness" / Code Smell
     new b03b936  Lucene.Net.Grouping: Added comments to change !Any() to .Count when IEnumerable<T> is factored out

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs | 2 +-
 src/Lucene.Net.Grouping/SearchGroup.cs                         | 2 +-
 src/dotnet/tools/Lucene.Net.Tests.Cli/EnumerableExtensions.cs  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

[lucenenet] 02/02: Lucene.Net.Grouping: Added comments to change !Any() to .Count when IEnumerable is factored out

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit b03b93683c4d3a7128e54692525cb7d1315637f5
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Fri May 28 21:58:34 2021 +0700

    Lucene.Net.Grouping: Added comments to change !Any() to .Count when IEnumerable<T> is factored out
---
 src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs | 2 +-
 src/Lucene.Net.Grouping/SearchGroup.cs                         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs b/src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs
index ea35fb2..7d4d8f5 100644
--- a/src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs
+++ b/src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs
@@ -54,7 +54,7 @@ namespace Lucene.Net.Search.Grouping
         {
 
             //System.out.println("SP init");
-            if (!groups.Any())
+            if (!groups.Any()) // LUCENENET TODO: Change back to .Count if/when IEnumerable<T> is changed to ICollection<T> or IReadOnlyCollection<T>
             {
                 throw new ArgumentException("no groups to collect (groups.Count is 0)");
             }
diff --git a/src/Lucene.Net.Grouping/SearchGroup.cs b/src/Lucene.Net.Grouping/SearchGroup.cs
index 27ae921..580ed50 100644
--- a/src/Lucene.Net.Grouping/SearchGroup.cs
+++ b/src/Lucene.Net.Grouping/SearchGroup.cs
@@ -402,7 +402,7 @@ namespace Lucene.Net.Search.Grouping
                 for (int shardIDX = 0; shardIDX < shards.Count; shardIDX++)
                 {
                     IEnumerable<ISearchGroup<T>> shard = shards[shardIDX];
-                    if (shard.Any())
+                    if (shard.Any()) // LUCENENET TODO: Change back to .Count if/when IEnumerable<T> is changed to ICollection<T> or IReadOnlyCollection<T>
                     {
                         //System.out.println("  insert shard=" + shardIDX);
                         UpdateNextGroup(maxQueueSize, new ShardIter<T>(shard, shardIDX));

[lucenenet] 01/02: Fix SonarQube's "Any() should be used to test for emptiness" / Code Smell

Posted by ni...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git

commit a525c9b8d9c573f130a86d2db9dd570a05df20b8
Author: marodev <mo...@tuta.io>
AuthorDate: Wed May 12 22:43:03 2021 +0200

    Fix SonarQube's "Any() should be used to test for emptiness" / Code Smell
---
 src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs | 2 +-
 src/dotnet/tools/Lucene.Net.Tests.Cli/EnumerableExtensions.cs  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs b/src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs
index d498795..ea35fb2 100644
--- a/src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs
+++ b/src/Lucene.Net.Grouping/AbstractSecondPassGroupingCollector.cs
@@ -54,7 +54,7 @@ namespace Lucene.Net.Search.Grouping
         {
 
             //System.out.println("SP init");
-            if (groups.Count() == 0)
+            if (!groups.Any())
             {
                 throw new ArgumentException("no groups to collect (groups.Count is 0)");
             }
diff --git a/src/dotnet/tools/Lucene.Net.Tests.Cli/EnumerableExtensions.cs b/src/dotnet/tools/Lucene.Net.Tests.Cli/EnumerableExtensions.cs
index ac5bb01..a506646 100644
--- a/src/dotnet/tools/Lucene.Net.Tests.Cli/EnumerableExtensions.cs
+++ b/src/dotnet/tools/Lucene.Net.Tests.Cli/EnumerableExtensions.cs
@@ -25,7 +25,7 @@ namespace Lucene.Net.Cli
     {
         public static IEnumerable<IEnumerable<T>> OptionalParameters<T>(this IEnumerable<IEnumerable<T>> input)
         {
-            if (input.Count() == 0)
+            if (!input.Any())
                 yield break;
             else
             {