fix: reduce cyclomatic complexity and clean up Python scripts for production readiness#30
Open
57388sp wants to merge 3 commits into
Open
fix: reduce cyclomatic complexity and clean up Python scripts for production readiness#3057388sp wants to merge 3 commits into
57388sp wants to merge 3 commits into
Conversation
|
Test Report missing or unfilled. This PR touches This is a soft gate - your CI checks are unaffected - but reviewers will not approve until the report is filled in. |
- Remove phase narration comment blocks above logger.info phase headers - Remove redundant _env() inline doc comment across all scripts - Remove stale section decorators (#--- banners for Steps/Main) - Remove garbled mojibake chars from ENV dict inline comments (nfs_provision) - Fix bug in snapmirror_test_failover.py: logger.info() calls for phases A/B/C were embedded inside comment text and never executed - Preserve USER INPUTS banners, Steps banners, and version-specific field-set comments that carry non-obvious semantic meaning All scripts pass ruff check + ruff format --check.
5fd75e0 to
6676a3c
Compare
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.
This PR refactors Python scripts that had high cyclomatic complexity grades (C or D) as measured by radon. Functions with too many branches are hard to read, test, and maintain, so each large function was broken into smaller, focused helper functions.
The key improvements are in the NFS provision, SnapMirror cleanup, and SnapMirror destination-managed scripts, where the most complex functions dropped from grades C/D down to grade A or B. All functions across the codebase now grade A or B.
No behaviour was changed — the extracted helpers perform exactly the same logic as before. All scripts pass ruff check and ruff format --check with no issues.