Repository navigation
Refactor repeated checks in colspace internal fcts - #263
Merged
Merged
Conversation
Bisaloo
force-pushed
the
check-function-colspace
branch
from
July 31, 2025 20:04
5d99549 to
cbc71e0
Compare
Bisaloo
marked this pull request as ready for review
July 31, 2025 20:05
Bisaloo
force-pushed
the
check-function-colspace
branch
from
August 1, 2025 10:16
cbc71e0 to
9592c0d
Compare
Since space2 is always of length 1
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request refactors colorspace internal functions to eliminate duplicated validation logic and standardizes error messages. The main change introduces a new helper function check_data_for_colspace that consolidates repeated data validation checks across multiple colorspace functions.
Key changes:
- Introduces
check_data_for_colspacehelper function to centralize data validation - Updates error/warning messages for consistency (e.g., "three" → "3", "tetrachromatic" → "tetrachromat")
- Refactors 7 colorspace functions to use the new helper instead of duplicated validation code
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| R/check_data_for_colspace.R | New helper function that consolidates data validation logic for colorspace functions |
| R/trispace.R | Refactored to use new helper function, removing 50+ lines of duplicated validation code |
| R/tcspace.R | Refactored to use new helper function, removing 50+ lines of duplicated validation code |
| R/segspace.R | Refactored to use new helper function, removing 40+ lines of duplicated validation code |
| R/hexagon.R | Refactored to use new helper function, removing 40+ lines of duplicated validation code |
| R/dispace.R | Refactored to use new helper function, removing 60+ lines of duplicated validation code |
| R/colspace.R | Minor improvements to error handling and relative quantum catch detection |
| R/coc.R | Refactored to use new helper function, removing 50+ lines of duplicated validation code |
| R/categorical.R | Refactored to use new helper function, removing 40+ lines of duplicated validation code |
| R/sensmodel.R | Added missing call. = FALSE to error message |
| R/getimg.R | Improved file extension checking logic |
| tests/testthat/test-colspace.R | Updated test expectations to match new standardized error messages |
| .lintr | Updated linter configuration |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Collaborator
|
Woah! This is awesome - thanks. I’ve had a poke around locally and not found anything of note - happy to merge when you’re satisfied. Also the copilot reviews are very cool, that’s new to me. |
thomased
approved these changes
Aug 1, 2025
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 #102, fixes #192
Prepares for #208 & #179