Reduce cyclomatic complexity in raw-stream hotspots and consolidate utilities under src/utils#318
Conversation
albe
left a comment
There was a problem hiding this comment.
@copilot We do not aim towards single digit complexity per function, but rather a low two digit value (20-30 is okayish) with occasional functions especially in the hot path being allowed to go higher. So avoid extracting methods from methods that are already low in complexity, unless it allows to extract logic into a generic util.
| function isPlainObject(value) { | ||
| return value !== null && typeof value === 'object' && !Array.isArray(value); | ||
| } |
There was a problem hiding this comment.
| function isPlainObject(value) { | |
| return value !== null && typeof value === 'object' && !Array.isArray(value); | |
| } |
|
@copilot resolve the merge conflicts in this pull request |
Merge conflicts are resolved in commit |
Co-authored-by: Alexander Berl <a.berl@outlook.com>
|
@copilot where is the -0.04% coverage coming from? |
It’s mainly from |
Recent raw stream support increased complexity in core storage/event modules, creating maintainability hotspots (notably
metadataUtil,EventStore, and partition/storage writers). This change set reduces branch-heavy logic where it adds value and centralizes reusable utilities undersrc/utils.Utility module consolidation
src/*Util.js/src/util.jstosrc/utils/*.metadataUtilrefinementsArray.some(...)where dedicated helpers did not improve clarity.src/utils/jsonUtil.js.EventStorebranch simplificationpredicate/rawargument normalization into a shared helper used by stream-access APIs.preCommit/preRead) into shared delegation methods to remove duplicated conditional branches.WritableStorage/ partition refactorsWritableStorage: extracted partition id/config/directory creation paths and streamlined secondary-index add paths to keepindex.add(...)explicit without unnecessary delegation.ReadablePartition: extracted iteration position resolution, reader selection, and header output assignment helpers.WritablePartition: extracted write metadata/argument normalization and unbuffered-write threshold decision.