Assignment Branch Condition size for order_xml is too high. [33/15] Open
def order_xml(order, xml)
xml.Order(orderID: order.id) do
xml.Warehouse(warehouseid: order.warehouse_id)
xml.ShipMethod order.ship_method
xml.InfoLine order.info_line
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Assignment Branch Condition size for customer_xml is too high. [25/15] Open
def customer_xml(customer, xml)
xml.CustomerInfo do
xml.Company customer.company
xml.FirstName customer.first_name
xml.LastName customer.last_name
- Read upRead up
- Exclude checks
This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric
Method has too many lines. [19/10] Open
def order_xml(order, xml)
xml.Order(orderID: order.id) do
xml.Warehouse(warehouseid: order.warehouse_id)
xml.ShipMethod order.ship_method
xml.InfoLine order.info_line
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Method has too many lines. [14/10] Open
def customer_xml(customer, xml)
xml.CustomerInfo do
xml.Company customer.company
xml.FirstName customer.first_name
xml.LastName customer.last_name
- Read upRead up
- Exclude checks
This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.
Use a guard clause instead of wrapping the code inside a conditional expression. Open
unless order.order_date.nil?
- Read upRead up
- Exclude checks
Use a guard clause instead of wrapping the code inside a conditional expression
Example:
# bad
def test
if something
work
end
end
# good
def test
return unless something
work
end
# also good
def test
work if something
end
# bad
if something
raise 'exception'
else
ok
end
# good
raise 'exception' if something
ok