newmen/versatile-diamond

View on GitHub

Showing 197 of 197 total issues

Method generate has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

      def generate(no_term_specs: false, no_base_specs: false, no_spec_specs: false, no_reactions: false)
        @atoms_format = '%25s | %5s | %10s | %4s | %s'
        puts @atoms_format % %w(Image Index Lattice Name Parents)
        print_atoms('Atoms', classifier.props)
        puts
Severity: Minor
Found in analyzer/lib/generators/overview.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 merge_props has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

      def merge_props(other, &block)
        same_unit_states = UNIT_STATES.all? { |mn| send(mn) == other.send(mn) }
        is_valid_lts = lattice == other.lattice ||
                  (!lattice && other.lattice) || (lattice && !other.lattice)

Severity: Minor
Found in analyzer/lib/organizers/atom_properties.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_grouped_nodes.rb has 260 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/base_grouped_nodes.rb - About 2 hrs to fix

    File atom_classifier.rb has 257 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module VersatileDiamond
      module Organizers
    
        # Classifies atoms in specs and associate each atom type with some value,
        # which will be used for detecting overlapping specs between each other
    Severity: Minor
    Found in analyzer/lib/organizers/atom_classifier.rb - About 2 hrs to fix

      Class DependentSpecificSpec has 21 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class DependentSpecificSpec < DependentWrappedSpec
            include Modules::GraphDupper
      
            def_delegators :spec, :reduced, :could_be_reduced?
      
      
      Severity: Minor
      Found in analyzer/lib/organizers/dependent_specific_spec.rb - About 2 hrs to fix

        Method collect_specific_specs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

              def collect_specific_specs
                cache = {}
                (all_reactions + [theres]).each do |dept_concepts|
                  dept_concepts.each do |dept_concept|
                    is_ubiquitous = ubiquitous_reactions.include?(dept_concept)
        Severity: Minor
        Found in analyzer/lib/organizers/analysis_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 latticed_relation_params_of has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

                  def latticed_relation_params_of(node)
                    neighbour_spec_atoms(node.product).each_with_object([]) do |sa, acc|
                      nbr = @prd_to_src_mirror[sa]
                      if nbr && nbr.lattice
                        prd_rel = relation_between_products(nbr, node)

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

              def contain_times(latticed_props, props)
                diff = latticed_props - props
                if diff
                  num = 1
                  if !diff.zero? && props.include?(diff)
        Severity: Minor
        Found in analyzer/lib/generators/engine_code.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 mapping_result.rb has 253 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module VersatileDiamond
          module Mcs
        
            # Contains reactants and mapping result (how change each atom of stuctures)
            class MappingResult
        Severity: Minor
        Found in analyzer/lib/mcs/mapping_result.rb - About 2 hrs to fix

          Method non_complete_groups has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

                    def non_complete_groups
                      flatten_face_grouped_nodes.each_with_object([]) do |group, acc|
                        next unless group.one?
                        rels = small_ungrouped_graph[group.first]
                        next unless rels.one?
          Severity: Minor
          Found in analyzer/lib/generators/code/algorithm/base_grouped_nodes.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 overlaps_for has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

                  def overlaps_for(atoms, complex_child: false)
                    @self_insec.each_with_object([]) do |intersec, all_overlaps|
                      overlap = {}
                      check_lambda = presented_in(overlap)
          
          
          Severity: Minor
          Found in analyzer/lib/generators/code/symmetries_detector.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 equation has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

                def equation(str)
                  sides = Matcher.equation(str)
                  syntax_error('.invalid') unless sides
          
                  names_and_specs = {}
          Severity: Minor
          Found in analyzer/lib/interpreter/reaction.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 make_gnuplot has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          def make_gnuplot(filename, title, xlabel, ylabel, &block)
            Gnuplot.open do |gp|
              Gnuplot::Plot.new(gp) do |plot|
                plot.output("#{config.filepath(filename)}")
          
          
          Severity: Minor
          Found in engine/slices_graphics_renderer.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 read_slices has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          def read_slices
            types, concs = nil
            File.open(config.filename) do |f|
              lines = f.readlines
              types = lines.shift.scan(/\d+/)
          Severity: Minor
          Found in engine/slices_graphics_renderer.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 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def initialize(g1, g2, comparer: nil, bonds_checker: nil, &block)
                  @g1, @g2 = g1, g2
          
                  comparer ||= -> _, _, v, w { v.same?(w) }
          
          
          Severity: Minor
          Found in analyzer/lib/mcs/assoc_graph.rb - About 1 hr to fix

            Method find_intersec has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                  def find_intersec
                    big_mapped_vertices, small_mapped_vertices = [], []
                    lattices_variants = nil
            
                    loop do
            Severity: Minor
            Found in analyzer/lib/mcs/many_to_one_algorithm.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 deep_find_positions has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                  def deep_find_positions(reaction, main_spec, main_atoms, position)
                    crystal = main_atoms.first.lattice.instance
                    return unless crystal.flatten?(position)
            
                    rel_groups = main_atoms.map do |a|
            Severity: Minor
            Found in analyzer/lib/mcs/mapping_result.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 [] has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                        def [](var, type: nil, value: nil, constructor_args: nil)
                          if !var.tin? && (var.const? || var.type? || var.assign?)
                            arg_err!("Cannot define not variable #{var.inspect}")
                          elsif type && !type.type?
                            arg_err!("Wrong type #{type.inspect} of defining variable")

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

                  def common_plus(other, total_props)
                    lattices_num = total_props[:nbr_lattices].select(&:last).size
                    total_unfixed = total_props[:relevants].include?(UNFIXED)
                    return if total_unfixed && lattices_num > 1
            
            
            Severity: Minor
            Found in analyzer/lib/organizers/atom_properties.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 replace_in_links has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                  def replace_in_links(from, to)
                    if links[from] && links[to]
                      exchange_targets_in_links do |sa|
                        if sa == to
                          from
            Severity: Minor
            Found in analyzer/lib/organizers/base_chunk.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

            Severity
            Category
            Status
            Source
            Language