newmen/versatile-diamond

View on GitHub

Showing 197 of 197 total issues

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

      def setup_by_other(target, other, own, foreign)
        return own if target.gas?

        original_own = own
        own = SpecificAtom.new(own) unless own.specific?
Severity: Minor
Found in analyzer/lib/mcs/mapping_result.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

File dependent_wrapped_spec.rb has 302 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module VersatileDiamond
  using Patches::RichArray

  module Organizers

Severity: Minor
Found in analyzer/lib/organizers/dependent_wrapped_spec.rb - About 3 hrs to fix

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

              def inspect
                sis = species.map(&:inspect)
                nas = nodes.uniq(&:atom)
                spops = nas.map(&:sub_properties).map(&:inspect)
                pkns = nas.map do |n|
    analyzer/lib/generators/code/algorithm/units/specie_pure_methods.rb on lines 75..91

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

    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

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

              def inspect
                sis = species.map(&:inspect)
                nas = nodes.uniq(&:atom)
                spops = nas.map(&:sub_properties).map(&:inspect)
                pkns = nas.map do |n|
    analyzer/lib/generators/code/algorithm/units/base_pure_unit.rb on lines 150..166

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

    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

    Class AtomVariable has 26 methods (exceeds 20 allowed). Consider refactoring.
    Open

            class AtomVariable < Core::Variable
              include LatticePositionReference
    
              # @param [Instances::SpecieInstance] specie
              # @return [Core::OpCall]

      Method swap_atom has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

            def swap_atom(spec, from, to, reverse_too: true)
              is_source = @source.include?(spec)
      
              @result.each do |_, mapping|
                mapping.each do |specs, atoms|
      Severity: Minor
      Found in analyzer/lib/mcs/mapping_result.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 position has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

            def position(*atom_strs, **options)
              target, spec, atom, used_atom_str = nil
      
              atom_strs.each do |atom_str|
                atom_sym = atom_str.to_sym
      Severity: Minor
      Found in analyzer/lib/interpreter/where.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

      File base_context_provider.rb has 287 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module VersatileDiamond
        using Patches::RichArray
      
        module Generators
          module Code
      Severity: Minor
      Found in analyzer/lib/generators/code/algorithm/units/base_context_provider.rb - About 2 hrs to fix

        Class Graph has 25 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class Graph
              include Modules::ExcessPositionChecker
              include Concepts::AtomsSwapper
              extend Forwardable
        
        
        Severity: Minor
        Found in analyzer/lib/mcs/graph.rb - About 2 hrs to fix

          Class SpecieBackbone has 24 methods (exceeds 20 allowed). Consider refactoring.
          Open

                  class SpecieBackbone < BaseBackbone
                    extend Forwardable
          
                    # Initializes backbone by specie and grouped nodes of it
                    # @param [EngineCode] generator the major engine code generator
          Severity: Minor
          Found in analyzer/lib/generators/code/algorithm/specie_backbone.rb - About 2 hrs to fix

            Method extends_if_possible has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                  def extends_if_possible(type, source, products, bonds_sum_limit, deep, &block)
                    specs = eval(type.to_s)
                    combinations(specs).each do |combination|
                      bonds_sum = specs.reduce(0) do |acc, spec|
                        acc +
            Severity: Minor
            Found in analyzer/lib/interpreter/reaction.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 find_positions_for has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                  def find_positions_for(reaction)
                    return if complex_source.one? || complex_source.size == complex_products.size
            
                    main_spec, idx =
                      complex_source.one? ? [complex_source.first, 0] : [complex_products.first, 1]
            Severity: Minor
            Found in analyzer/lib/mcs/mapping_result.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

            File specie.rb has 273 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module VersatileDiamond
              using Patches::RichString
            
              module Generators
                module Code
            Severity: Minor
            Found in analyzer/lib/generators/code/specie.rb - About 2 hrs to fix

              Method convert_rate has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def convert_rate(value, gases_num, dimension = nil)
                        return 0 if value == 0
              
                        dimension ||= @rate
                        syntax_error('.is_not_set') unless dimension
              Severity: Major
              Found in analyzer/lib/tools/dimension.rb - About 2 hrs to fix

                Class AtomsChangeUnit has 23 methods (exceeds 20 allowed). Consider refactoring.
                Open

                        class AtomsChangeUnit
                          include Modules::ProcsReducer
                
                          # @param [Expressions::TargetsDictionary] dict
                          # @param [ChangesContextProvider] context
                Severity: Minor
                Found in analyzer/lib/generators/code/algorithm/units/atoms_change_unit.rb - About 2 hrs to fix

                  Method build_sequence_from has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                            def build_sequence_from(graph, nodes, visited)
                              result = []
                              nodes_queue = nodes.dup
                  
                              until nodes_queue.empty?
                  Severity: Minor
                  Found in analyzer/lib/generators/code/algorithm/base_backbone.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

                  Class SymmetriesDetector has 22 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                        class SymmetriesDetector
                          include Modules::ListsComparer
                          include SymmetryHelper
                          extend Forwardable
                  
                  
                  Severity: Minor
                  Found in analyzer/lib/generators/code/symmetries_detector.rb - About 2 hrs to fix

                    Class TypicalReaction has 22 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                          class TypicalReaction < SpeciesReaction
                    
                            # Initializes typical reaction class code generator
                            def initialize(*)
                              super
                    Severity: Minor
                    Found in analyzer/lib/generators/code/typical_reaction.rb - About 2 hrs to fix

                      Class MappingResult has 22 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          class MappingResult
                      
                            attr_reader :source, :products, :reaction_type
                      
                            # Recombines passed mapping result to list where each item is two spec_atom
                      Severity: Minor
                      Found in analyzer/lib/mcs/mapping_result.rb - About 2 hrs to fix

                        Method to_s has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              def to_s
                                return @_to_s if @_to_s
                        
                                name = atom_name.to_s
                        
                        
                        Severity: Major
                        Found in analyzer/lib/organizers/atom_properties.rb - About 2 hrs to fix
                          Severity
                          Category
                          Status
                          Source
                          Language