Skip to content

Commit 2e8a9b8

Browse files
cstollmetameta-codesync[bot]
authored andcommitted
Reduce CCN in json_utils.cpp (parameterLimitsToJson/FromJson) (#1085)
Summary: Pull Request resolved: #1085 Refactored the `parameterLimitsToJson` and `parameterLimitsFromJson` functions to reduce their cyclomatic complexity (CCN) below the target of 20. Changes made: - Created per-type helper functions in an anonymous namespace for both serialization (toJson) and deserialization (fromJson) operations - Added helper functions: `minMaxToJson`, `minMaxJointToJson`, `linearToJson`, `linearJointToJson`, `halfPlaneToJson`, `ellipsoidToJson` for serialization - Added helper functions: `parseJointParameterIndex`, `minMaxFromJson`, `minMaxJointFromJson`, `linearFromJson`, `linearJointFromJson`, `halfPlaneFromJson`, `ellipsoidFromJson` for deserialization - The main `parameterLimitsToJson` and `parameterLimitsFromJson` functions now act as simple dispatchers calling the appropriate helper functions - Combined `MinMaxJoint` and `MinMaxJointPassive` handling using a shared helper with a type parameter - Combined `ellipsoid` and deprecated `elipsoid` (typo) handling using shared helper with key parameters - Preserved all existing comments, including the TODO for deprecated `elipsoid` type migration Reviewed By: cdtwigg Differential Revision: D95214692 fbshipit-source-id: 085397d11385d7d5a90a601e4d0a268d0803ed67
1 parent 6eb496f commit 2e8a9b8

File tree

1 file changed

+220
-177
lines changed

1 file changed

+220
-177
lines changed

0 commit comments

Comments
 (0)