newmen/versatile-diamond

View on GitHub

Showing 197 of 197 total issues

Method produce_props has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def produce_props(other, &block)
        unit_props = UNIT_STATES.zip([atom_name, valence]).to_h
        all_lattices = [self, other].map(&:lattice).uniq
        any_unfixed = [self, other].any?(&:unfixed?)
        iterating_lattices =
Severity: Minor
Found in analyzer/lib/organizers/atom_properties.rb - About 35 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  module Generators
    module Code
      module Algorithm

        # Creates pure units for look around find algorithm
analyzer/lib/generators/code/algorithm/check_laterals_pure_factory.rb on lines 2..31

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 34.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  module Generators
    module Code
      module Algorithm

        # Creates pure units for check laterals find algorithm
analyzer/lib/generators/code/algorithm/look_around_pure_units_factory.rb on lines 2..31

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 34.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Method dept_spec has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def dept_spec(spec)
        result = ANALYS_SPEC_METHODS.reduce(nil) do |acc, method_name|
          acc || @analysis_result.public_send(method_name, spec.name)
        end

Severity: Minor
Found in analyzer/lib/generators/base.rb - About 25 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 outer_base_class_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def outer_base_class_name
          if !original_specie.specific? && !original_specie.sidepiece?
            'EmptyBase'
          elsif original_specie.specific? && original_specie.sidepiece?
            'EmptySpecificSidepiece'
Severity: Minor
Found in analyzer/lib/generators/code/empty_specie.rb - About 25 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 clear_excess_rels has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def clear_excess_rels(graph)
            all_nodes_lists = collect_nodes(graph)
            real_nodes = all_nodes_lists.reduce(:+).uniq.reject(&:none?)
            real_species = real_nodes.map(&:uniq_specie).uniq
            eq_nums = (real_nodes.size == real_species.size)
Severity: Minor
Found in analyzer/lib/generators/code/algorithm/specie_backbone.rb - About 25 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 amorph_counters has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def amorph_counters
            if amorph_relations.empty?
              []
            else
              result = [dict.amorph_counter]
Severity: Minor
Found in analyzer/lib/generators/code/algorithm/units/counters_unit.rb - About 25 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 species_array has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def species_array(species, type: nil, name: nil, value: nil, index: nil, **opts)
            if type || species.map(&:original).uniq.one?
              unless index
                name = fix_name(name || DEFAULT_SPECIE_NAME, plur: true, **opts)
              end

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

          def recharge(delta)
            if delta == 0
              raise ArgumentError, 'Cannot recharge with 0 delta'
            elsif delta.abs > instance.valence
              raise ArgumentError, 'Too large delta for atom recharging'

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

    def next_line
      @line = @content[@line_number]
      @line_number += 1
      return unless @line
      @line.sub!(/#.+\Z/, '') # drop comments
Severity: Minor
Found in analyzer/lib/analyzer.rb - About 25 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 multilinize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def multilinize(text, limit: 13)
        words = text.split(/\s+/)
        splitted_text = ['']
        until words.empty?
          splitted_text << '' if splitted_text.last.size > limit
Severity: Minor
Found in analyzer/lib/generators/species_graph_generator.rb - About 25 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

Function rename has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def rename(*freq_stats):
  names_mirror = {}
  total_stats = []
  mx = 0

Severity: Minor
Found in notebook/rates/analysis.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(spec, specific_atoms = {})
        spatoms = specific_atoms.map do |atom_keyname, specific_atom|
          atom = spec.atom(atom_keyname)
          unused_bonds = spec.external_bonds_for(atom) -
            specific_atom.actives - specific_atom.monovalents.size
Severity: Minor
Found in analyzer/lib/concepts/specific_spec.rb - About 25 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 reduced has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def reduced
        return unless extended?
        return @correct_reduced if @correct_reduced
        @correct_reduced = @reduced.dup

Severity: Minor
Found in analyzer/lib/concepts/specific_spec.rb - About 25 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 adsorb has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def adsorb(other, &block)
        duplicates = other.duplicate_atoms_with_keynames
        duplicates.each do |keyname, atom|
          current_keyname =
            if block_given?
Severity: Minor
Found in analyzer/lib/concepts/spec.rb - About 25 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 uniq_anchored? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def uniq_anchored?(nodes, lists_of_nodes)
            return false unless nodes.all?(&:anchor?)
            all_other_nodes = lists_of_nodes.flatten - nodes
            other_anchored_nodes = all_other_nodes.select(&:anchor?)
            return false if !all_other_nodes.empty? && other_anchored_nodes.empty?
Severity: Minor
Found in analyzer/lib/generators/code/algorithm/specie_backbone.rb - About 25 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 swap has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def swap(spec_atom, from, to)
        return spec_atom unless spec_atom[0] == from

        # TODO: move #specific? method from Organizers to swap_in_links in Concepts
        mirror =
Severity: Minor
Found in analyzer/lib/modules/spec_atom_swapper.rb - About 25 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 rest_links has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def rest_links(other, mirror, &block)
        pairs_from(mirror).each_with_object({}) do |(own_key, other_key), rest|
          if !other_key
            rest[own_key] = links[own_key] # <-- same as bottom
          elsif different_or_used?(other, own_key, other_key, mirror.keys)
Severity: Minor
Found in analyzer/lib/organizers/minuend.rb - About 25 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 smart_zip has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def smart_zip(other)
          oz = other.size
          if size == oz
            zip(other)
          elsif size < oz && one?
Severity: Minor
Found in analyzer/patches/rich_array.rb - About 25 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 setup_anchored_order has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def setup_anchored_order(graph, all_nodes_lists)
            through_sequence(graph, all_nodes_lists) do |acc, nodes, _|
              if acc[nodes]
                keep_anchored_rels(acc, nodes)
              else
Severity: Minor
Found in analyzer/lib/generators/code/algorithm/specie_backbone.rb - About 25 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

Severity
Category
Status
Source
Language