chore: use switches instead and silent TibiaDataStringToInteger error#514
Merged
tobiasehlert merged 3 commits intomainfrom Sep 23, 2025
Merged
chore: use switches instead and silent TibiaDataStringToInteger error#514tobiasehlert merged 3 commits intomainfrom
tobiasehlert merged 3 commits intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request improves code maintainability by refactoring conditional statements to use switch statements and enhances error handling in the string-to-integer conversion utility function. The changes make the code more readable and provide better debugging capabilities.
- Refactored
if/else ifchains toswitchstatements across multiple files - Enhanced error handling in
TibiaDataStringToIntegerwith debug logging and safe default return - Fixed a minor URL inconsistency in the README badge
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/TibiaSpellsSpell.go | Converted conditional logic for spell section identification to switch statement |
| src/TibiaGuildsOverview.go | Refactored guild category and type assignment logic using switch statements |
| src/TibiaDataUtils.go | Improved error handling with debug logging and safe default return value |
| src/TibiaCharactersCharacter.go | Changed position assignment logic to use switch statement |
| README.md | Fixed URL casing in Codecov badge for consistency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
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.



This pull request refactors several conditional statements across the codebase to use
switchstatements for improved readability and maintainability. It also enhances error handling in the utility function for string-to-integer conversion by providing more informative debug logging and returning a safe default value.Refactoring conditional logic
if/else ifchains toswitchstatements insrc/TibiaGuildsOverview.go,src/TibiaSpellsSpell.go, andsrc/TibiaCharactersCharacter.goto make the code easier to read and extend. [1] [2] [3] [4]Error handling improvements
TibiaDataStringToIntegerinsrc/TibiaDataUtils.goby adding debug logging and returning0when conversion fails.Documentation
README.mdfor consistency.rel #453