-
Notifications
You must be signed in to change notification settings - Fork 293
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
Refactored complex methods #263
Conversation
Thanks! I should have time to review this tomorrow. |
0fa5cbd
to
998cac1
Compare
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.
Great work here, thanks! Just those small changes and it's good to be merged.
|
||
mccabe: | ||
options: | ||
max-complexity: 9 |
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.
There should be a new line here.
if len(eik) == 13 and not check_eik_extra(eik): | ||
raise ValidationError(error_message) | ||
eik_validator = EIKValidator() | ||
egn_validator = EGNValidator() |
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.
What do you think about deprecating the *_validator versions? I suppose there's no real harm in keeping them around but it would be nice to provide just the class version. Users can always make their own version of the callable if they want to use it that way. Consider this optional and only do it if you agree.
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.
Yes I was thinking to deprecate them. There is no point in callable, because usually logic is complex so you have to split into several methods. And even for simple cases think is better to stick to class validators conventionally.
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.
""" | ||
Check Bulgarian unique citizenship number (EGN) for validity. | ||
|
||
More details https://en.wikipedia.org/wiki/Unique_citizenship_number | ||
Full information in Bulgarian about algorithm is available here | ||
http://www.grao.bg/esgraon.html#section2 | ||
""" | ||
def check_checksum(egn): | ||
|
||
def check_checksum(self, egn): |
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.
Can you mark new methods as private (prefixed with _)? This applies to all of the methods that you've created on the forms. I want to be clear that these are internal and not public. Please to this for data fields on the form as well.
998cac1
to
9c35233
Compare
Thanks for review, have created 265. |
- Complexity 9 - Moved function validators to Validator classes - Changed Indonesian Numbers
9c35233
to
910333d
Compare
Thanks @vladimirnani! |
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.
777
Specified complexity level for prospector.
Refactored methods that raised complexity exceptions. (max-complexity 9)
Fixes #261