newmen/versatile-diamond

View on GitHub

Showing 197 of 197 total issues

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

            def [](assign, cond, op, body)
              if !assign.assign?
                arg_err!("First argument of for loop should to be assing operation")
              elsif !cond.op?
                arg_err!("Second argument of for loop should to be condition")
Severity: Minor
Found in analyzer/lib/generators/code/algorithm/units/expressions/core/for.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 apply_relevants has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def apply_relevants(spec, old_atom, new_atom, to_reverse_too: true)
        is_source = source.include?(spec)

        if to_reverse_too
          os_s, os_old_a = mapping.other_side(spec, old_atom)
Severity: Minor
Found in analyzer/lib/concepts/reaction.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 collect_states has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def collect_states(atom, atom_method, state_method = nil)
        atom_keyname = keyname(atom)
        states = atom.send(atom_method)
        states.empty? ?
          [] :
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 check_reactions_for_duplicates has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def check_reactions_for_duplicates
        all_reactions.each do |reactions|
          reactions = reactions.dup
          until reactions.empty?
            reaction = reactions.pop
Severity: Minor
Found in analyzer/lib/organizers/analysis_result.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 used_iterators has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def used_iterators
          return @_used_iterators if @_used_iterators
          specs_atoms =
            if reaction.clean_links.empty?
              concretizable? ? lateral_chunks.targets.to_a : []
Severity: Minor
Found in analyzer/lib/generators/code/typical_reaction.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 purge_unused_extended_specs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def purge_unused_extended_specs(base_specs_cache, specific_specs_cache)
        extended_specs = specific_specs_cache.select do |_, spec|
          !spec.simple? && spec.could_be_reduced?
        end

Severity: Minor
Found in analyzer/lib/organizers/species_organizer.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 fix_instance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def fix_instance(instance, &block)
            if instance.is_a?(Array)
              if instance.one?
                instance.first
              else

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

      def swap_chunk(variants, from, to)
        swap_lambda = -> chunk { chunk == from ? to : chunk }
        variants.each_with_object({}) do |(cmb, chunk), acc|
          new_cmb = cmb.include?(from) ? cmb.map(&swap_lambda) : cmb
          acc[new_cmb] = swap_lambda[chunk]
Severity: Minor
Found in analyzer/lib/organizers/chunks_combiner.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 using has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

          def using(vars)
            if vars.include?(self)
              [name] + (@index ? @index.using(vars - [self]) : [])
            elsif @index # do not use #item? here
              holders = vars.select { |v| v.parent_arr?(self) }

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

      def swap_on(target, from, to, reverse_too: true)
        var = instance_variable_get(:"@#{target}")
        idx = var.index(from)
        var[idx] = to if idx

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

        def rate(reaction)
          temp = current_temperature(reaction.gases_num) # TODO: in engine always using
                                                         # the surface temperature
          arrenius = reaction.rate * (temp ** reaction.temp_power) *
            Math.exp(-reaction.activation / (Dimension::R * temp))
Severity: Minor
Found in analyzer/lib/tools/config.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 same? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def same?(other)
        return false unless links.size == other.links.size
        return false unless self.class == other.class && owner.same?(other.owner)

        intersec = mirror_to(other)
Severity: Minor
Found in analyzer/lib/organizers/spec_residual.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 atomic_dangling has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def atomic_dangling
        if @_atomic_dangling.nil?
          another_danglings = props.flat_map(&:danglings).uniq - [ACTIVE_BOND]
          @_atomic_dangling = another_danglings.one? ? another_danglings.first : false
        else
Severity: Minor
Found in analyzer/lib/organizers/atom_classifier.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

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

  module Generators
    module Code
      module Algorithm::Units::Expressions::Core

        # Get left increment operator statement
analyzer/lib/generators/code/algorithm/units/expressions/core/op_not.rb on lines 2..22

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 28.

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::Units::Expressions::Core

        # Boolean not operator statement
analyzer/lib/generators/code/algorithm/units/expressions/core/op_l_inc.rb on lines 2..26

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 28.

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

          def create_bond_calls
            @_create_bond_calls ||=
              neighbours_difference.flat_map do |node, (nbrs, _)|
                var = @dict.var_of(node.atom)
                nbrs.flat_map { |nbr| var.bond_with(@dict.var_of(nbr.atom)) }
analyzer/lib/generators/code/algorithm/units/atoms_change_unit.rb on lines 163..169

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 26.

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

          def drop_bond_calls
            @_drop_bond_calls ||=
              neighbours_difference.flat_map do |node, (_, nbrs)|
                var = @dict.var_of(node.atom)
                nbrs.flat_map { |nbr| var.unbond_from(@dict.var_of(nbr.atom)) }
analyzer/lib/generators/code/algorithm/units/atoms_change_unit.rb on lines 154..160

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 26.

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

Severity
Category
Status
Source
Language