-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #519 Prevent infinite loop when getting references from invalid range #521
Fix #519 Prevent infinite loop when getting references from invalid range #521
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be best to throw an exception here, because an invalid range means something is wrong and should be fixed "before" this method. Also could you please cover this with unit tests ?
I've updated to throw an exception on invalid range and amended the unit test to match. |
Try executing Regarding Scrutinizer I am not sure, but last time PowerKiki suggested to extract the added code into it's own method, maybe try that. :) Thx! |
In this case just your added code in |
I've run cs fixer but it's not changing anything, am I doing something wrong? This is the output:
But no files have been changed. I'll refactor the invalid range check – the whole class isn't too tidy, my code must have just tipped Scrutinizer over the fail threshold. |
I've also refactored the large I think much of the logic concerning cell ranges and references could be extracted to their own objects rather than dealing with range and reference arrays if you were open to cleaning up the class further. |
By personal preference I would have only extracted as much as is required to pass CI and included everything else in a additional PR. :) Could provide an additional PR for your suggested refactorings? Otherwise you could open an a feature request issue. Thanks for your contributions so far. :) |
Thanks ! The refactoring is always welcomed. The existing code tends to use way too big methods... |
Hi there, |
Ah, sorry I wasn't thorough enough with my tests then. I can re-submit with a better comparison function. |
It's been released as 1.3.1 |
Fixes #519
Didn't realise it was such an easy fix..! Currently it returns an empty array of references when passed an invalid range, not sure if an exception would be more suitable.