File converter.rb
has 420 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'time'
require 'set'
require 'hashie/mash'
require 'hdo/storting_importer'
require 'childprocess'
Method parse_name_string
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def parse_name_string(str, person)
result = Hashie::Mash.new
orig = str
str = clean_name_string(str)
- 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_name_string
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_name_string(str, person)
result = Hashie::Mash.new
orig = str
str = clean_name_string(str)
Class Converter
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Converter
class << self
def parse(file, options = {})
case file
when /s(\d{2})(\d{2})(\d{2}).*\.xml$/i
Method parse_speech
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def parse_speech(node)
name_nodes = node.css('navn, Navn')
name_str = name_nodes.text
text = clean_text(text_from(node))
- 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_section
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def parse_section(node)
@current_node = node
section = case node.name.downcase
when 'innlegg', 'hovedinnlegg', 'replikk'
- 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_speech
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_speech(node)
name_nodes = node.css('navn, Navn')
name_str = name_nodes.text
text = clean_text(text_from(node))
Method extract_entities
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_entities(section)
r, w = IO.pipe
process = ChildProcess.build("python", NER_SCRIPT)
process.duplex = true
Method parse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse(file, options = {})
case file
when /s(\d{2})(\d{2})(\d{2}).*\.xml$/i
short_year = $1
month = $2.to_i
- 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"