Skip to content

Conversation

@trietmnj
Copy link
Contributor

No description provided.

@trietmnj trietmnj requested a review from Copilot May 29, 2025 18:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors Init to centralize JSON unmarshalling with error handling and introduces named constants for stability criteria keys.

  • Extracted JSON parsing into a helper with error returns
  • Added log.Fatalf on curve initialization errors
  • Defined WoodUnanchoredKey, WoodAnchoredKey, and MasonryConcreteBrickKey as constants and refactored the stability map
Comments suppressed due to low confidence (1)

lifeloss/lifeloss.go:40

  • The new helper createLethalityCurve introduces an error path that isn't covered by existing tests. Add unit tests for both successful and failing JSON inputs to verify its behavior.
createLethalityCurve := func(data []byte) (LethalityCurve, error) {

}
high, err := createLethalityCurve(DefaultHighLethalityBytes)
if err != nil {
log.Fatalf("Failed to initialize high lethality curve: %v", err)
Copy link

Copilot AI May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Calling log.Fatalf will terminate the entire application on JSON errors. Consider changing Init to return an error so callers can handle initialization failures more gracefully.

Copilot uses AI. Check for mistakes.
@trietmnj trietmnj requested a review from HenryGeorgist May 29, 2025 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants