Skip to content

Conversation

@sosso
Copy link

@sosso sosso commented Oct 21, 2020

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.

end]
end

def collect_annotated_members

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

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

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

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

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}]

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}]

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

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

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

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]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant