-
Notifications
You must be signed in to change notification settings - Fork 31
Annotated EnumType Members #13
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
base: master
Are you sure you want to change the base?
Conversation
| end] | ||
| end | ||
|
|
||
| def collect_annotated_members |
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.
Complex method FrOData::Schema::EnumType#collect_annotated_members (35.9)
|
|
||
| def collect_annotated_members | ||
| Hash[type_definition.xpath('./Member').map.with_index do |member_xml, index| | ||
| member_name = member_xml.attributes['Name'].value |
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.
FrOData::Schema::EnumType#collect_annotated_members calls 'member_xml.attributes' 2 times
| member_name = member_xml.attributes['Name'].value | ||
| member_value = member_xml.attributes['Value'].andand.value.andand.to_i | ||
| annotation = nil | ||
| if member_xml.element_children.count > 0 |
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.
FrOData::Schema::EnumType#collect_annotated_members calls 'member_xml.element_children' 2 times
|
|
||
| def collect_annotated_members | ||
| Hash[type_definition.xpath('./Member').map.with_index do |member_xml, index| | ||
| member_name = member_xml.attributes['Name'].value |
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.
FrOData::Schema::EnumType#collect_annotated_members refers to 'member_xml' more than self (maybe move it to another class?)
| end] | ||
| end | ||
|
|
||
| def collect_annotated_members |
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.
FrOData::Schema::EnumType#collect_annotated_members has approx 6 statements
| if member_xml.element_children.count > 0 | ||
| annotation = member_xml.element_children.last.attribute('String').value | ||
| end | ||
| [member_value || index, {name: member_name, annotation: annotation}] |
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.
Space inside { missing.
| if member_xml.element_children.count > 0 | ||
| annotation = member_xml.element_children.last.attribute('String').value | ||
| end | ||
| [member_value || index, {name: member_name, annotation: annotation}] |
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.
Space inside } missing.
| # @return [Hash] | ||
| def members | ||
| @members ||= collect_members | ||
| end |
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.
end at 49, 8 is not aligned with def at 47, 6.
| member_value = member_xml.attributes['Value'].andand.value.andand.to_i | ||
| [member_value || index, member_name] | ||
| end] | ||
| end |
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.
end at 97, 8 is not aligned with def at 91, 6.
| end] | ||
| end | ||
|
|
||
| def collect_annotated_members |
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.
Assignment Branch Condition size for collect_annotated_members is too high. [21.47/15]
Hi,
We're also doing a lot more with RESO Web APIs these days, and we needed Annotations surfaced so I whipped this up. I couldn't get Ruby 2.2 installed locally because it's EOL, so let me know how you want to handle that part of this PR; I don't need any higher ruby version functionality from what I added. I also fixed what appeared to be a broken spec as part of the Shared Examples file.