refactor: burn down complexity hotspots across model, view, controller, events, global, seed - #3435
Merged
Merged
Conversation
Splits the per-column property/type/mapping setup into $initModelClassProcessColumn and the automatic validations block into $initModelClassApplyAutomaticValidations. Statements moved verbatim (programmatic equivalence check 90/90, 74/74, 16/16); helpers are public $-prefixed per the mixin integration invariant. Signed-off-by: Peter Amiri <peter@alurium.com>
… to 3) $generateTestDataByName holds the pre-type name-pattern checks, $generateTestDataByType holds the type-based branches in original order. seederSpec's 50 assertions pin every branch including ordering edges. Signed-off-by: Peter Amiri <peter@alurium.com>
…41 to 18) $renderWithNamedArgs derives extra named args from renderWith's own parameter metadata; $renderWithJsonContent applies the string/integer coercion directives and serializes. Data mutations propagate through struct/array pass-by-reference, matching the inline original. Signed-off-by: Peter Amiri <peter@alurium.com>
Dispatches to $runOnErrorSendEmail, $runOnErrorResolveWheelsError, $runOnErrorRenderWheelsError, $runOnErrorRenderException, and $runOnErrorRenderTemplate. The hardener source-scans now target the helpers that hold each invariant (frozen 404/403/500 map, swallowed $mail, raw exception serialization) — same live-code guarantees. Signed-off-by: Peter Amiri <peter@alurium.com>
Seven public $-prefixed global helpers (detect/promote/BoxLang-slash/ struct/number/boolean/datetime) in util.cfm. All branches moved verbatim; convertToStringSpec and GlobalSurfaceIdentitySpec cover the behavior and the global surface. Signed-off-by: Peter Amiri <peter@alurium.com>
…ct, $dateOrTimeSelect paginationLinks 55 to 23 ($paginationLinkPageArgs, $paginationAnchorLink, $paginationWindowMiddle); $optionsForSelect 45 to 9 ($optionsForSelectColumns, $optionsForSelectCell); $dateOrTimeSelect 43 to 5 ($dateOrTimeSelectNormalizeValue, $dateOrTimeSelectRender). View + security + formsdate specs stay green. Signed-off-by: Peter Amiri <peter@alurium.com>
The helper returns either {} or a cfcatch/exception object; Adobe 2023's
struct return-type validator rejects the latter (caught by the testing-env
smoke's unknown-route-404 probe). Untyped return matches the original inline
behavior exactly.
Signed-off-by: Peter Amiri <peter@alurium.com>
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
First burn-down wave on the framework's highest-complexity functions, using the tooling from #3431/#3433/#3434. Extract-method refactors only — no behavior change.
Before → after (cyclomatic complexity, measured by tools/code-quality/cfml-complexity.py)
$runOnError(events/EventMethods.cfc)paginationLinks(view/links.cfc)$initModelClass(Model.cfc)renderWith(controller/rendering.cfc)$convertToString(global/util.cfm)$optionsForSelect(view/formsobject.cfc)$dateOrTimeSelect(view/formsdate.cfc)$generateTestData(Seeder.cfc)Repo-wide: functions over complexity 50 drop 10 → 7; functions at 10 or under rise 2399 → 2416 (+17 small helpers). Every new helper is a public
$-prefixed mixin function (private mixins are not integrated on Lucee/Adobe — invariant 7).How it was done
Verification
No changelog fragment: pure internal refactor with no user-facing change.