File parser.rb
has 345 lines of code (exceeds 250 allowed). Consider refactoring. Open
%w(survey survey_translation survey_section question_group question dependency dependency_condition answer validation validation_condition).each {|model| require model }
require 'yaml'
module Surveyor
Method parse_and_build
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def parse_and_build(context, args, original_method, reference_identifier)
# clear context
[ :question,
:dependency,
:dependency_condition,
- 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 method_missing
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(missing_method, *args, &block)
method_name, reference_identifier = missing_method.to_s.split("_", 2)
type = full(method_name)
Surveyor::Parser.raise_error( "\"#{type}\" is not a surveyor method." )if !%w(survey survey_translation survey_section question_group question dependency dependency_condition answer validation validation_condition).include?(type)
- 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_and_build
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def parse_and_build(context, args, original_method, reference_identifier)
# clear context
[ :answer,
:validation,
:validation_condition ].each{|k| context.delete k}
- 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_and_build
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_and_build(context, args, original_method, reference_identifier)
# clear context
[ :question,
:dependency,
:dependency_condition,
Method method_missing
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def method_missing(missing_method, *args, &block)
method_name, reference_identifier = missing_method.to_s.split("_", 2)
type = full(method_name)
Surveyor::Parser.raise_error( "\"#{type}\" is not a surveyor method." )if !%w(survey survey_translation survey_section question_group question dependency dependency_condition answer validation validation_condition).include?(type)
Method resolve_dependency_condition_references
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def resolve_dependency_condition_references
self.context[:dependency_conditions].each do |dc|
# Looking up references to questions and answers for linking the dependency objects
self.context[:bad_references].push "q_#{dc.question_reference}" unless (dc.question = self.context[:question_references][dc.question_reference])
self.context[:answer_references][dc.question_reference] ||= {}
- 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"