Showing 43 of 67 total issues
Method xml_0_5_1
has a Cognitive Complexity of 106 (exceeds 5 allowed). Consider refactoring. Open
def xml_0_5_1(options={})
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.eeml(_eeml_0_5_1) do |eeml|
eeml.environment(:updated => updated.iso8601(6), :created => created.iso8601(6), :id => id, :creator => creator) do |environment|
environment.title title unless title.blank?
- 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 xml_5
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
def xml_5(options={})
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.eeml(_eeml_5) do |eeml|
eeml.environment(:updated => updated.iso8601, :id => id, :creator => "http://www.haque.co.uk") do |environment|
environment.title title unless title.blank?
- 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 xml_0_5_1
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
def xml_0_5_1
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.eeml(_eeml_0_5_1.merge({"xmlns:opensearch" => "http://a9.com/-/spec/opensearch/1.1/"})) do |eeml|
eeml['opensearch'].totalResults totalResults
eeml['opensearch'].startIndex startIndex
- 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 xml_5
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def xml_5
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.eeml(_eeml_5.merge({"xmlns:opensearch" => "http://a9.com/-/spec/opensearch/1.1/"})) do |eeml|
eeml['opensearch'].totalResults totalResults
eeml['opensearch'].startIndex startIndex
- 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 xml_0_5_1
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def xml_0_5_1(options={})
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.eeml(_eeml_0_5_1) do |eeml|
eeml.environment(:updated => updated.iso8601(6), :id => feed_id, :creator => feed_creator) do |environment|
environment.data(:id => id) do |data|
- 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 from_csv
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def from_csv(csv, csv_version = nil)
begin
rows = Xively::CSV.parse(csv.strip)
rescue Exception => e
# this might be a FasterCSV or CSV exception depending on whether
- 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 valid?
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def valid?
pass = true
[:id].each do |attr|
if self.send(attr).blank?
errors[attr] = ["can't be blank"]
- 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_tag_string
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def parse_tag_string(string)
return [] if string.blank?
string = string.join(',') if string.is_a?(Array)
tags = []
quoted_mode = false
- 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 xml_0_5_1
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def xml_0_5_1
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.eeml(_eeml_0_5_1.merge({"xmlns:opensearch" => "http://a9.com/-/spec/opensearch/1.1/"})) do |eeml|
eeml['opensearch'].totalResults totalResults
eeml['opensearch'].startIndex startIndex
Method xml_0_5_1
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def xml_0_5_1(options={})
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.eeml(_eeml_0_5_1) do |eeml|
eeml.environment(:updated => updated.iso8601(6), :created => created.iso8601(6), :id => id, :creator => creator) do |environment|
environment.title title unless title.blank?
Method extract_datastreams
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def extract_datastreams(rows)
row_sizes = rows.collect { |row| row.size }.uniq
row_ids = rows.collect { |row| row.first.to_s.strip }.uniq
raise InvalidCSVError, "CSV is invalid. Incorrect number of fields" if row_sizes.max > 3 || row_sizes.min <= 1
- 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 valid?
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def valid?
pass = true
[:id].each do |attr|
if self.send(attr).blank?
errors[attr] = ["can't be blank"]
Method xml_5
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def xml_5
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.eeml(_eeml_5.merge({"xmlns:opensearch" => "http://a9.com/-/spec/opensearch/1.1/"})) do |eeml|
eeml['opensearch'].totalResults totalResults
eeml['opensearch'].startIndex startIndex
Method transform_1_0_0
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def transform_1_0_0(hash)
hash["updated"] = hash["updated"]
hash["created"] = hash["created"]
hash["status"] = hash["status"]
hash["tags"] = join_tags(hash["tags"])
Method transform_0_6_alpha
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def transform_0_6_alpha(hash)
hash["retrieved_at"] = hash["updated"]
hash["state"] = hash["status"]
if hash["datastreams"]
hash["datastreams"] = hash["datastreams"].collect do |datastream|
Method from_xml
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def from_xml(xml)
begin
xml = Nokogiri::XML(xml) do |config|
config.strict.nonet
end
Method xml_5
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def xml_5(options={})
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.eeml(_eeml_5) do |eeml|
eeml.environment(:updated => updated.iso8601, :id => id, :creator => "http://www.haque.co.uk") do |environment|
environment.title title unless title.blank?
Method initialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def initialize(input = {}, csv_version = nil, format = nil)
raise InvalidFormatError, "Unknown format specified, currently we can only parse JSON, XML or CSV." unless [nil,:json,:xml,:csv].include?(format)
if input.is_a?(Hash)
self.attributes = input
elsif format == :json || (format.nil? && input.strip[0...1].to_s == "{")
- 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 xml_5
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def xml_5(options={})
builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
xml.eeml(_eeml_5) do |eeml|
eeml.environment(:updated => updated.iso8601, :id => feed_id, :creator => "http://www.haque.co.uk") do |environment|
environment.data(:id => id) do |data|
- 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_tag_string
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_tag_string(string)
return [] if string.blank?
string = string.join(',') if string.is_a?(Array)
tags = []
quoted_mode = false