refactor: extract helpers to reduce pylint complexity#834
Conversation
|
Hi, I’m Jit, a friendly security platform designed to help developers build secure applications from day zero with an MVS (Minimal viable security) mindset. In case there are security findings, they will be communicated to you as a comment inside the PR. Hope you’ll enjoy using Jit. Questions? Comments? Want to learn more? Get in touch with us. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit b80c1a6. Configure here.
| monitor=monitor, | ||
| errors=[], | ||
| dry_run=True, | ||
| ) |
There was a problem hiding this comment.
Dry-run result now includes extra success_rate field
Low Severity
The dry-run path now returns a success_rate key in its result dictionary that wasn't present before the refactoring. The original dry-run result contained only applied_count, total_migrations, performance_stats, errors, and dry_run. By routing both the dry-run and normal paths through _build_monitoring_result, the dry-run result now also includes success_rate, changing the API contract.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b80c1a6. Configure here.


What does this change do?
Refactors the
too-many-statementsviolations reported by Pylint in large methods across the codebase by extracting parts of the logic into smaller private helpers.Why is this needed?
The affected methods were handling too many responsibilities in a single block, which made them harder to read, test, and maintain. Splitting the logic into smaller helpers reduces complexity while keeping the external behavior unchanged.
What changed?
How was it tested?
Notes for reviewers
Note
Medium Risk
Touches RediSearch query building and model metaclass/schema paths where regressions would affect all queries and indexing, though the PR is refactor-only and claims unchanged behavior.
Overview
This PR splits oversized methods into private helpers to satisfy Pylint complexity limits, without changing intended behavior.
In
datetime_migration, HashModel processing is refactored so key scanning, byte normalization, and per-key datetime conversion live in_collect_hash_keys,_normalize_hash_data, and_process_hash_key, with_process_hash_modelonly batching and delegating.DataMigrator.run_migrations_with_monitoringnow uses_log_pending_migrations,_build_monitoring_result, and_log_monitoring_summaryfor listing, result dict assembly, and verbose output (including dry-run).In
model.py,resolve_valuedelegates to type-specific_resolve_*helpers; queryexecuteis split into_build_execute_args,_execute_command, and_parse_execute_results;ModelMeta.__new__and JSON indexschema_for_typerecursion are broken into static/instance helpers with the same orchestration flow.Reviewed by Cursor Bugbot for commit b80c1a6. Bugbot is set up for automated code reviews on this repo. Configure here.