Fix #12: Add score normalization for AniList formats - #14
Merged
Conversation
- Add GetUserScoreFormat() to retrieve user's AniList score format - Change Score type from float64 to int (always stored as 0-10) - Implement normalizeScoreForMAL() to convert AniList scores to 0-10 - Implement denormalizeScoreForAniList() to convert back to user's format - Support all 5 AniList formats: POINT_100, POINT_10_DECIMAL, POINT_10, POINT_5, POINT_3 - Add comprehensive tests for normalization/denormalization functions - Apply same changes to both anime and manga This fixes MAL API rejecting scores > 10 with '400 invalid score bad_request'
- Exclude dupl linter for test files in .golangci.yml - Remove unused nolint:dupl directives from app.go
There was a problem hiding this comment.
Pull request overview
Addresses MAL API rejecting scores exceeding 10 by normalizing AniList scores to 0-10 format and denormalizing when writing back to AniList.
- Changed Score type from float64 to int and stored internally as normalized 0-10 format
- Added normalization/denormalization functions supporting all 5 AniList score formats (POINT_100, POINT_10_DECIMAL, POINT_10, POINT_5, POINT_3)
- Integrated score format retrieval at startup and applied transformations across the sync pipeline
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| app.go | Retrieves user's AniList score format at startup; passes it to data fetching functions; denormalizes scores when writing to AniList |
| anime.go | Changes Score field to int; adds normalization/denormalization functions; updates format strings from %f to %d |
| anime_test.go | Comprehensive tests for anime score normalization/denormalization and round-trip conversions |
| manga.go | Changes Score field to int; adds normalization/denormalization functions; updates format strings from %f to %d |
| manga_test.go | Comprehensive tests for manga score normalization/denormalization and round-trip conversions |
| anilist.go | Adds GetUserScoreFormat() to retrieve user's score format preference from AniList API |
| Makefile | Adds fmt target for code formatting with gofumpt |
| CLAUDE.md | Documents the new score normalization architecture and development workflows |
| .golangci.yml | Excludes dupl linter for test files to allow identical test structures |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Move score normalization functions to score.go - Move score normalization tests to score_test.go - Add detailed comments explaining intentional code duplication - Remove duplicate code from anime.go and manga.go - Remove duplicate tests from anime_test.go and manga_test.go Addresses Copilot review comments about documenting intentional duplication in fetch functions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
bigspawn
commented
Jan 5, 2026
bigspawn
left a comment
Owner
Author
There was a problem hiding this comment.
All Copilot review comments have been addressed:
- Added detailed comments explaining intentional code duplication in both fetch functions
- Refactored score normalization code into separate files (score.go and score_test.go)
- All tests passing ✅
- Linter checks passing ✅
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.
Fixes #12
This fixes MAL API rejecting scores > 10 with '400 invalid score bad_request'