File dif_transformer.rb
has 529 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "hashie"
require "uuidtools"
require "uri"
require "gcmd"
Class DifTransformer
has 56 methods (exceeds 20 allowed). Consider refactoring. Open
class DifTransformer
include ::Npolar::Api
BASE = "http://api.npolar.no/dataset/"
Method activity
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def activity
periods = []
object.Temporal_Coverage.each do | period |
start = ""
- 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 links
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def links
links = []
# 1. Related_URL
if dif.Related_URL?
Method links
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def links
links = []
# 1. Related_URL
if dif.Related_URL?
- 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 person_from_personnel
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.person_from_personnel(p)
first_name = p.First_Name
if p.Middle_Name? and p.Middle_Name.size >= 1
first_name += " " + p.Middle_Name
- 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 guess_topic_from_parameter
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def guess_topic_from_parameter(parameter)
if parameter.Variable_Level_1 =~ /FISHERIES/i
["biology", "marine"]
elsif parameter.Term =~ /VEGETATION/i
["biology", "vegetation"]
- 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 organisations
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def organisations
orgs = []
if dif.Data_Center? and dif.Data_Center.any?
Method normalize_iso_topics
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def normalize_iso_topics(dif_iso_topic)
step1 = dif_iso_topic.downcase.gsub(/(\s|\/)/, "")
iso_topic = case step1
when "geoscientificinformation"
"geoscientificInformation"
Method organisations
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def organisations
orgs = []
if dif.Data_Center? and dif.Data_Center.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 guess_country_code_from_location
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def guess_country_code_from_location(location)
if location.Location_Subregion2 =~ /SVALBARD AND JAN MAYEN/i
"NO"
elsif location.Location_Subregion2 =~ /Norway/i
"NO"
- 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
Consider simplifying this complex logical expression. Open
if (topics||[]).include? "oceanography" or (topics||[]).include? "seaice" or (iso_topics||[]).include? "oceans"
sets << "NMDC"
end
Method guess_topic_from_title
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def guess_topic_from_title(title)
if title =~ /geology|geological/i
"geology"
elsif title =~ /bird|reindeer|fauna|ecology|faeces|fox|seal|walrus|vegetation|population dynamics|lichen/i
"biology"
- 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"