app/models/building.rb
Method has too many lines. [21/10] Open
Open
def query_gmap
url = URI.parse("http://maps.googleapis.com/maps/api/geocode/json?\
key=#{ENV['GOOGLE_API_KEY']}&
address=${name}%20Hall%20Berkeley")
req = Net::HTTP::Get.new(url.to_s)
- 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.
Assignment Branch Condition size for query_gmap is too high. [19.42/15] Open
Open
def query_gmap
url = URI.parse("http://maps.googleapis.com/maps/api/geocode/json?\
key=#{ENV['GOOGLE_API_KEY']}&
address=${name}%20Hall%20Berkeley")
req = Net::HTTP::Get.new(url.to_s)
- 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
Favor modifier if
usage when having a single-line body. Another good alternative is the usage of control flow &&
/||
. Open
Open
if lat && lng
- Read upRead up
- Exclude checks
Checks for if and unless statements that would fit on one line
if written as a modifier if/unless. The maximum line length is
configured in the Metrics/LineLength
cop.
Example:
# bad
if condition
do_stuff(bar)
end
unless qux.empty?
Foo.do_something
end
# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?