Fix: remove duplicate Fabric version validation (_verifyFabricVersion is dead code)#764
Open
zyzzmohit wants to merge 1 commit into
Open
Conversation
… is dead code) _validateFabricVersion() (line 118) already checks fabricVersion >= 2.0.0 and exits with process.exit(1) via CRITICAL error type. The later _verifyFabricVersion() (line 150) checks the same condition but only adds a regular ERROR — making it unreachable dead code since the process already exits before it runs. Remove the redundant _verifyFabricVersion method and its call. Fixes hyperledger-labs#763 Signed-off-by: zyzzmohit <mohitray949@gmail.com>
Contributor
Author
|
CI Note: The 2 failing checks ( This PR only removes 8 lines of dead code from a validation file ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the redundant
_verifyFabricVersion()method and its call insrc/commands/validate/index.ts.Problem
Two separate methods check the exact same condition — whether
fabricVersion >= 2.0.0:_validateFabricVersion()(line 153) — emits aCRITICALerror → callsprocess.exit(1)immediately_verifyFabricVersion()(line 562) — emits a regularERROR→ just adds to error listSince
_validateFabricVersionis called first (line 118) and exits the process on failure,_verifyFabricVersion(called at line 150) is unreachable dead code when the version check fails.Fix
Remove the redundant
_verifyFabricVersionmethod (lines 562-567) and its call (line 150). The existing_validateFabricVersionalready handles this correctly with a CRITICAL exit.Testing
npm run test:unit— 34/34 tests passnpm run lint— 0 errors, 23 warnings (same as baseline minus 1 removed warning from dead code)npm run build— compiles successfullyFixes #763