Repository Analysis

microsoft/garnet

Garnet is a remote cache-store from Microsoft Research that offers strong performance (throughput and latency), scalability, storage, recovery, cluster sharding, key migration, and replication features. Garnet can work with existing Redis clients.

3.4 Likely human-written View on GitHub
3.4
Adjusted Score
3.4
Raw Score
100%
Time Factor
2026-05-30
Last Push
11,846
Stars
C#
Language
410,769
Lines of Code
1453
Files
1342
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 3HIGH 0MEDIUM 22LOW 1317

Pattern Findings

1342 matches across 11 categories. Click a row to expand file-level details.

Over-Commented Block1261 hits · 1208 pts
SeverityFileLineSnippet
LOWbenchmark/BDN.benchmark/Operations/ScriptOperations.cs181 /// Batch size per method invocation
LOWbenchmark/BDN.benchmark/Operations/OperationsBase.cs41 /// <summary>
LOW…chmark/BDN.benchmark/Embedded/EmbeddedNetworkSender.cs21 /// <summary>
LOWbenchmark/Resp.benchmark/OfflineBench/RespPerfBench.cs261 swatch.Stop();
LOW…k/Resp.benchmark/OfflineBench/AOFBench/AofBenchType.cs1// Copyright (c) Microsoft Corporation.
LOW…k/Resp.benchmark/OfflineBench/AOFBench/AofBenchType.cs21 /// Simulate AOF replay (skipping resp parsing)
LOW….benchmark/OfflineBench/AOFBench/TsavoriteExtension.cs21 HeaderSizeField = type.GetField("headerSize", flags);
LOWbenchmark/Device.benchmark/Program.cs21
LOWmetrics/HdrHistogram/HistogramExtensions.cs61 /// <summary>
LOWmetrics/HdrHistogram/HistogramExtensions.cs81 targetHistogram.Reset();
LOWmetrics/HdrHistogram/HistogramExtensions.cs101 public static IEnumerable<HistogramIterationValue> Percentiles(this HistogramBase histogram, int percentileTicks
LOWmetrics/HdrHistogram/HistogramExtensions.cs121 /// seconds or other appropriate unit.
LOWmetrics/HdrHistogram/HistogramExtensions.cs141 /// {
LOWmetrics/HdrHistogram/HistogramExtensions.cs161 /// Records the elapsed time till the returned token is disposed.
LOWmetrics/HdrHistogram/HistogramBase.cs21 /// Base class for High Dynamic Range (HDR) Histograms
LOWmetrics/HdrHistogram/HistogramBase.cs61 public long HighestTrackableValue { get; }
LOWmetrics/HdrHistogram/HistogramBase.cs101
LOWmetrics/HdrHistogram/HistogramBase.cs121 /// </summary>
LOWmetrics/HdrHistogram/HistogramBase.cs141 /// </param>
LOWmetrics/HdrHistogram/HistogramBase.cs161 /// Construct a histogram given the lowest and highest values to be tracked and a number of significant decimal
LOWmetrics/HdrHistogram/HistogramBase.cs221 /// <summary>
LOWmetrics/HdrHistogram/HistogramBase.cs241 var subBucketIndex = GetSubBucketIndex(value, bucketIndex);
LOWmetrics/HdrHistogram/HistogramBase.cs341 /// Get a value that lies in the middle (rounded up) of the range of values equivalent the given value.
LOWmetrics/HdrHistogram/HistogramBase.cs481
LOWmetrics/HdrHistogram/HistogramBase.cs501
LOWmetrics/HdrHistogram/IRecorder.cs1namespace HdrHistogram
LOWmetrics/HdrHistogram/IRecorder.cs21 void RecordValueWithCount(long value, long count);
LOWmetrics/HdrHistogram/LongHistogram.cs21 /// over value quantization behavior across the value range and the subsequent value resolution at any given level.
LOWmetrics/HdrHistogram/LongHistogram.cs41 /// The histogram will be constructed to implicitly track(distinguish from 0) values as low as 1.
LOWmetrics/HdrHistogram/LongHistogram.cs61 /// </param>
LOWmetrics/HdrHistogram/LongHistogram.cs81 /// </param>
LOWmetrics/HdrHistogram/LongHistogram.cs101 }
LOWmetrics/HdrHistogram/LongConcurrentHistogram.cs1using System;
LOWmetrics/HdrHistogram/LongConcurrentHistogram.cs21 {
LOWmetrics/HdrHistogram/LongConcurrentHistogram.cs41 : base(lowestTrackableValue, highestTrackableValue, numberOfSignificantValueDigits)
LOWmetrics/HdrHistogram/LongConcurrentHistogram.cs121 }
LOWmetrics/HdrHistogram/LongConcurrentHistogram.cs141 // Debug.Assert(CountsArrayLength == _inactiveCounts.Length);
LOWmetrics/HdrHistogram/Utilities/AtomicLongArray.cs61 // The guarantee that the lazySet provides is that the data will be made visible in the correct order. I.e.
LOWmetrics/HdrHistogram/Utilities/AtomicLongArray.cs81 // From http://msdn.microsoft.com/en-us/magazine/jj863136.aspx
LOWmetrics/HdrHistogram/Utilities/WriterReaderPhaser.cs21 /// While a<see cref="WriterReaderPhaser"/> can be useful in multiple scenarios, a specific and common use case is t
LOWmetrics/HdrHistogram/Utilities/WriterReaderPhaser.cs61 }
LOWmetrics/HdrHistogram/Utilities/WriterReaderPhaser.cs81 /// </para>
LOWmetrics/HdrHistogram/Utilities/WriterReaderPhaser.cs121 /// Exit from a critical section containing a read operation(relinquishes mutual exclusion against other <see cr
LOWmetrics/HdrHistogram/Utilities/WriterReaderPhaser.cs201 /// <para>
LOW…rics/HdrHistogram/Iteration/HistogramIterationValue.cs21 public long ValueIteratedTo { get; private set; }
LOW…rics/HdrHistogram/Iteration/HistogramIterationValue.cs41 public long TotalCountToThisValue { get; private set; }
LOW…eplicationTests/ClusterReplicationDisklessSyncTests.cs181 // Re-attach sync session
LOW…rnet.test.cluster.migrate/RedirectTests/BaseCommand.cs41 public abstract bool ArrayResponse { get; }
LOW…rnet.test.cluster.migrate/RedirectTests/BaseCommand.cs81 /// <summary>
LOW…rnet.test.cluster.migrate/RedirectTests/BaseCommand.cs101 /// <summary>
LOW…/cluster/Garnet.test.cluster/ClusterManagementTests.cs641 // * connected to node 3 (master <-> replica)
LOW…/cluster/Garnet.test.cluster/ClusterManagementTests.cs1221 {
LOWtest/cluster/Garnet.test.cluster/ClientClusterConfig.cs161 /// Gets the endpoint of the current node.
LOWtest/cluster/Garnet.test.cluster/ClientClusterConfig.cs181 /// <summary>
LOWtest/cluster/Garnet.test.cluster/ClientClusterConfig.cs301 // 3. <flags> //TODO: hostname
LOW…st/cluster/Garnet.test.cluster/ClusterNegativeTests.cs781 // Verify primary owns all slots before failover
LOWtest/cluster/Garnet.test.cluster/ClusterTestContext.cs221 foreach (var node in nodes)
LOWtest/cluster/Garnet.test.cluster/ClusterTestContext.cs241 /// <param name="CommitFrequencyMs"></param>
LOWtest/cluster/Garnet.test.cluster/ClusterTestContext.cs261 /// <param name="deviceType"></param>
LOWtest/cluster/Garnet.test.cluster/ClusterTestContext.cs401 /// <param name="cleanClusterConfig"></param>
1201 more matches not shown…
Verbosity Indicators42 hits · 68 pts
SeverityFileLineSnippet
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1044 // Step 1: Clean up and create source HLL
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1051 // Step 2: Dump the HLL
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1055 // Step 3: Corrupt the dump by flipping a bit (avoiding the last 8 bytes which are CRC)
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1063 // Step 6: Verify key was not created
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1079 // Step 1: Clean up and create source HLL
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1086 // Step 2: Dump the HLL
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1090 // Step 3: Zero out the last 8 bytes (CRC64 checksum)
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1097 // Step 6: Verify key was not created
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1113 // Step 1: Clean up and create sparse HLL
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1120 // Step 2: Dump and parse the structure
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1124 // Step 3: Extract and corrupt the HLL value
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1131 // Step 4: Reconstruct the dump with RDB encoding
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1165 // Step 1: Clean up and create sparse HLL
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1171 // Step 2: Dump and parse the structure
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1175 // Step 3: Extract the HLL value and verify it's sparse
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1179 // Step 4: Corrupt the sparse stream length (bytes 16-17) to exceed actual size
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1202 // Step 1: Clean up and create minimal sparse HLL
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1208 // Step 2: Dump and parse the structure
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1212 // Step 3: Extract the HLL value and verify it's sparse
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1216 // Step 4: Corrupt the first RLE opcode (offset 18) to create coverage gap
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1248 // Step 2: Clean up and create sparse HLL
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1256 // Step 3: Dump and parse the structure
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1260 // Step 4: Extract and corrupt the sparse stream length
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1265 // Step 5: Reconstruct the dump with RDB encoding (CRC will be zeros)
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1298 // Step 1: Create sparse HLL with minimal elements
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1305 // Step 2: Dump and verify sparse encoding (type byte = 0 at offset 3)
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1310 // Step 3: Create dense HLL by adding elements until sparse->dense conversion
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1351 // Step 1: Test 6-bit encoding
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1358 // Step 2: Test 14-bit encoding
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1366 // Step 3: Test 32-bit encoding
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1150 // Step 7: Verify key was not created
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1326 // Step 4: Verify dense encoding (type byte = 1 at offset 3)
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1330 // Step 5: Verify dense representation is larger
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1400 // Step 1: Create valid sparse HLL and test data
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1410 // Step 2: Dump and corrupt the SparseRLESize field
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1425 // Step 3: Reconstruct dump with valid CRC using Garnet.common.Crc64
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1449 // Step 4: RESTORE should succeed (CRC is valid, basic validation passes)
LOW…andalone/Garnet.test.complexstring/HyperLogLogTests.cs1453 // Step 5: Verify operations fail due to structural validation
LOW…ge/Tsavorite/cs/test/test.recovery/LargeObjectTests.cs39 // Step 1: Create and populate store.
LOW…ge/Tsavorite/cs/test/test.recovery/LargeObjectTests.cs64 // Step 1: Create and recover store.
LOW…ge/Tsavorite/cs/test/test.recovery/LargeObjectTests.cs127 // Step 1: Create and populate store.
LOW…ge/Tsavorite/cs/test/test.recovery/LargeObjectTests.cs153 // Step 1: Create and recover store.
Decorative Section Separators18 hits · 54 pts
SeverityFileLineSnippet
MEDIUMtest/docker-tests/validate_docker_images.py38# ---------------------------------------------------------------------------
MEDIUMtest/docker-tests/validate_docker_images.py40# ---------------------------------------------------------------------------
MEDIUMtest/docker-tests/validate_docker_images.py63# ---------------------------------------------------------------------------
MEDIUMtest/docker-tests/validate_docker_images.py65# ---------------------------------------------------------------------------
MEDIUMtest/docker-tests/validate_docker_images.py176# ---------------------------------------------------------------------------
MEDIUMtest/docker-tests/validate_docker_images.py178# ---------------------------------------------------------------------------
MEDIUMtest/docker-tests/validate_docker_images.py506# ---------------------------------------------------------------------------
MEDIUMtest/docker-tests/validate_docker_images.py508# ---------------------------------------------------------------------------
MEDIUMlibs/server/Resp/Vector/VectorFilterExpression.cs116 /// └────┴────┴────┴────────────────────────────┴───────────────────────────────────┘
MEDIUMlibs/server/Resp/Vector/VectorFilterExpression.cs117 /// ◄─── header (8 bytes) ──────────────────────►◄─── payload (8 bytes) ───────────►
MEDIUMlibs/server/Resp/Vector/VectorFilterExpression.cs177 // ── Union payload at offset 8 (8 bytes) ─────────────────────────
MEDIUMlibs/server/Resp/Vector/VectorFilterExpression.cs194 // ── Flags helpers ────────────────────────────────────────────────
MEDIUMlibs/server/Resp/Vector/VectorFilterExpression.cs209 // ── Discriminator helpers ────────────────────────────────────────
MEDIUMlibs/server/Resp/Vector/VectorFilterExpression.cs214 // ── Factory methods ──────────────────────────────────────────────
MEDIUMlibs/server/Resp/Vector/VectorManager.Filter.cs15 // ── Buffer size constants ────────────────────────────────────────
MEDIUMlibs/server/Resp/Vector/VectorManager.Filter.cs36 // ──────────────── ─────── ────── ─────────────────────────────────
MEDIUMlibs/server/Resp/Vector/VectorManager.Filter.cs129 // ── Compile ────────────────────────────────────────────────
MEDIUMlibs/server/Resp/Vector/VectorManager.Filter.cs148 // ── Collect unique selectors ──────────────────────────────
Hallucination Indicators3 hits · 30 pts
SeverityFileLineSnippet
CRITICAL…ication/PrimaryOps/AofOperations/AofSyncDriverStore.cs28 var truncateUntilAddress = store.clusterProvider.storeWrapper.appendOnlyFile.Log.UnsafeGetReadOnlyAddres
CRITICALlibs/server/Servers/MetricsApi.cs87 return provider.StoreWrapper.monitor.GlobalMetrics.globalLatencyMetrics.GetLatencyMetrics(latencyMetricsType
CRITICALlibs/storage/Tsavorite/cs/test/test.hlog/LogTests.cs152 ClassicAssert.IsTrue(asyncMemoryOwnerIter.Current.entry.Memory.Span.ToArray().Take(expectedData.Leng
Slop Phrases3 hits · 8 pts
SeverityFileLineSnippet
MEDIUMmetrics/HdrHistogram/Utilities/AtomicLongArray.cs15 /// This is a basic implementation/port, of just the methods that are required internally.
MEDIUM.github/workflows/codeql.yml51 # If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
LOW.azure/pipelines/azure-pipelines-mirror.yml43 # Push the updated main branch to Azure DevOps - make sure to get the config files each push so compliant with sec
AI Slop Vocabulary2 hits · 5 pts
SeverityFileLineSnippet
MEDIUMtest/standalone/Garnet.test/RespGetLowMemoryTests.cs70 [TestCase(3_000)] // Definitely completes async
MEDIUMlibs/server/Objects/SortedSetGeo/GeoHash.cs185 // check we can (as of .NET 8) to allow largest possible set of CPUs to utilize accelerated PDEP and PEXT co
Deep Nesting5 hits · 5 pts
SeverityFileLineSnippet
LOWtest/docker-tests/validate_docker_images.py124
LOWtest/docker-tests/validate_docker_images.py201
LOWtest/docker-tests/validate_docker_images.py237
LOWtest/docker-tests/validate_docker_images.py286
LOWtest/docker-tests/validate_docker_images.py351
Excessive Try-Catch Wrapping4 hits · 4 pts
SeverityFileLineSnippet
LOWtest/docker-tests/validate_docker_images.py233 except Exception as e:
LOWtest/docker-tests/validate_docker_images.py282 except Exception as e:
LOWtest/docker-tests/validate_docker_images.py345 except Exception as e:
LOWtest/docker-tests/validate_docker_images.py411 except Exception as e:
Fake / Example Data2 hits · 2 pts
SeverityFileLineSnippet
LOWsamples/ETag/Caching.cs182 const string loremIpsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incidi
LOWsamples/ETag/Caching.cs182 const string loremIpsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incidi
Example Usage Blocks1 hit · 2 pts
SeverityFileLineSnippet
LOWbenchmark/Device.benchmark/Program.cs14 /// Example usage:
Unused Imports1 hit · 1 pts
SeverityFileLineSnippet
LOWtest/docker-tests/validate_docker_images.py34