Add the grams force unit#1655
Conversation
Code ReviewSummaryAdds Conversion formulasThe formulas are correct but can be simplified to match the project style (prefer scientific notation directly): "FromUnitToBaseFunc": "({x} * 9.80665) / 1e3",
"FromBaseToUnitFunc": "({x} / 9.80665) * 1e3",Consider writing these as: "FromUnitToBaseFunc": "{x} * 9.80665e-3",
"FromBaseToUnitFunc": "{x} / 9.80665e-3",This also matches the multiplication/division convention described in CLAUDE.md (use multiplication for Missing documentationOther force units ( "XmlDocSummary": "The gram-force is a unit of force equal to the magnitude of force exerted by a gram of mass in standard gravity (9.80665 m/s²). It is equal to 9.80665 × 10⁻³ N.",
"XmlDocRemarks": "https://en.wikipedia.org/wiki/Kilogram-force"TestsNo tests were added for the new unit. The project generates tests automatically from the JSON definitions, but a quick sanity check in the test project (e.g., asserting OverallLooks good with the above minor tweaks. The unit is clearly defined, the conversion is correct, and it slots naturally alongside the existing mass-force units. |
Code ReviewOverview: Adds ✅ What's good
🔧 Suggestions1. Missing XML documentation — "XmlDocSummary": "The gram-force is equal to the magnitude of the force exerted on one gram of mass in a standard gravitational field (9.80665 m/s²). One gram-force equals 9.80665 mN.",
"XmlDocRemarks": "https://en.wikipedia.org/wiki/Gram-force"2. Conversion formula style — The codebase prefers scientific notation for constants. Simplify to avoid parentheses: "FromUnitToBaseFunc": "{x} * 9.80665e-3",
"FromBaseToUnitFunc": "{x} / 9.80665e-3"This is equivalent to 3. Test coverage — Only one line was added to OverallThis is a straightforward addition of a well-known unit. With the XML doc and formula style fixes, this is ready to merge. |
Code ReviewOverviewAdds Correctness
Criteria CheckGram-force is a well-documented unit (NIST, Wikipedia) used in chemistry, materials science, and everyday scale readings. It completes the force-of-gravity family alongside Generated CodeLooks correct and consistent with other additive units. The SummaryGood addition. No issues. |
Code ReviewAdding GramForce to Force — gram-force is a legitimate, well-known unit (used in scale calibration, spring constants, surface tension, etc.) and fits naturally next to KilogramForce. Looks good
Minor issues
Otherwise looks ready to merge once the remark is added. |
Code ReviewOverviewAdds Correctness ✅
IssuesMissing XML documentation — all other units in "XmlDocSummary": "The kilogram-force, or kilopond, is equal to...",
"XmlDocRemarks": "https://en.wikipedia.org/wiki/Kilogram-force"Please add something like: "XmlDocSummary": "The gram-force is a unit of force equal to the gravitational force exerted on one gram of mass in a 9.80665 m/s² gravitational field (standard gravity). One gram-force is equal to 9.80665 × 10⁻³ newtons.",
"XmlDocRemarks": "https://en.wikipedia.org/wiki/Gram-force"Minor: conversion formula style — SummarySolid addition overall. Please add |
PR Review: Add the grams force unitOverview: Adds Positive
Conversion function style"FromUnitToBaseFunc": "({x} * 9.80665) / 1e3",
"FromBaseToUnitFunc": "({x} / 9.80665) * 1e3",The project convention is to prefer a single multiplication for "FromUnitToBaseFunc": "{x} * 9.80665e-3",
"FromBaseToUnitFunc": "{x} / 9.80665e-3",This matches the style of neighboring units ( Units criteria ✅
Overall: Good addition. Please simplify the conversion functions to single |
I was unable to locate this issue. It appears to already be between Otherwise, I believe I addressed all of the comments and issues raised. |
Add the grams force unit