Showing 8 of 24 total issues
File poi_record.rb
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class PoiRecord < Record
# Load poi data from external source
# and save it to local attribute 'xml_data'
#
Class PoiRecord
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class PoiRecord < Record
# Load poi data from external source
# and save it to local attribute 'xml_data'
#
Function exports
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Method weekday
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.weekday(day)
return "" if day.blank?
case day
when "monday"
Method get_request
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_request(content_type_xml = false, pem = nil, password = nil)
uri = Addressable::URI.parse(@uri.strip).normalize
uri.query = [uri.query, URI.encode_www_form(@params)].join("&") if @params && @params.any?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method parse_media_content
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def parse_media_content(event)
image_data = []
if event.at_xpath("IMAGELINK_XL").try(:text).present?
image_data << {
Method get_request
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def get_request(content_type_xml = false, pem = nil, password = nil)
uri = Addressable::URI.parse(@uri.strip).normalize
uri.query = [uri.query, URI.encode_www_form(@params)].join("&") if @params && @params.any?
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def initialize(uri, login = nil, password = nil, params = {}, headers = {})