beattyml1/codgen

View on GitHub

Showing 12 of 12 total issues

Method map_object has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def self.map_object(json_data, json_map_data)
      if json_data != nil && json_data.is_a?(Array)
        json_data.each do |item|
          map_object(item, json_map_data)
        end
Severity: Minor
Found in lib/codgen/mapping.rb - About 3 hrs to fix

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 accumulate has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def accumulate(before, child, operator, get_val)
      if operator == nil && child.is_a?(Statement)
        accumulate(before, child, child.operator, get_val)
      else
        value = child.is_a?(String) ? get_val.call(child) : child.evaluate(get_val)
Severity: Minor
Found in lib/codgen/statement.rb - About 2 hrs to fix

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 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def parse(text)
      count = -1
      text.each_char do |current_char|
        count+=1
        if current_char == ' '
Severity: Minor
Found in lib/codgen/statement.rb - About 1 hr to fix

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 expand_two_sided has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def expand_two_sided(operator, regex)
      new_words = Array.new
      index = -1
      skip = false
      @words.each do |word|
Severity: Minor
Found in lib/codgen/statement.rb - About 1 hr to fix

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 style has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def self.style(json_object)
      if json_object.is_a?(Array)
        json_object.each { |child| style(child) }
      end

Severity: Minor
Found in lib/codgen/auto_style.rb - About 1 hr to fix

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 map_object has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.map_object(json_data, json_map_data)
      if json_data != nil && json_data.is_a?(Array)
        json_data.each do |item|
          map_object(item, json_map_data)
        end
Severity: Minor
Found in lib/codgen/mapping.rb - About 1 hr to fix

Method expand_not has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def expand_not
      new_words = Array.new
      @words.each do |word|
        if word.is_a?(Statement)
          new_words.push(word)
Severity: Minor
Found in lib/codgen/statement.rb - About 1 hr to fix

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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(arguments)
    if arguments.count < 1
      @input_directory = '.'
      @json_config = 'config.json'
    end
Severity: Minor
Found in bin/codgen.rb - About 55 mins to fix

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 get_data_if_not_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def self.get_data_if_not_data(filepath_or_data)
    if filepath_or_data != nil
      if filepath_or_data.is_a?(String)
        if /https?:\/\//.match(filepath_or_data)
          resp = Net::HTTP.get_response(URI.parse(filepath_or_data))
Severity: Minor
Found in lib/codgen.rb - About 55 mins to fix

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 add_property_group has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def self.add_property_group(json_object, key, value, translate, explicit_postfix)
      should_translate_val = value != nil && value.is_a?(String) && key.index('@')
      is_plural = key.index('#plural')

      new_key = translate.call(key.gsub('#plural', ''))
Severity: Minor
Found in lib/codgen/auto_style.rb - About 55 mins to fix

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 initialize has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(package_info)
      if package_info.is_a?(String)
        @input_path = package_info
      elsif package_info.is_a?(Hash)
        @input_path = package_info['path']
Severity: Minor
Found in lib/codgen/package.rb - About 45 mins to fix

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 add_property_group has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def self.add_property_group(json_object, key, value, translate, explicit_postfix)
Severity: Minor
Found in lib/codgen/auto_style.rb - About 35 mins to fix
Severity
Category
Status
Source
Language