shikhalev/rdot

View on GitHub

Showing 20 of 28 total issues

File rdot.rb has 628 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'is/monkey/sandbox'
require 'is/monkey/namespace'
require 'rdot-common'

# @private
Severity: Major
Found in lib/rdot.rb - About 1 day to fix

    Method add_method has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_method acc, mod, scope, visibility, name, opts
          m = get_method_object mod, scope, name
          src = m.source_location
          obj = {}
          nm = name.to_s
    Severity: Minor
    Found in lib/rdot.rb - About 4 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 diff_module has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        def diff_module base, other, opts
          if ! other
            return base.merge :new => true
          end
          if opts[:show_preloaded]
    Severity: Minor
    Found in lib/rdot.rb - About 4 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 get_module has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_module mod, opts
          result = {}
          result[:module] = mod
          incs = mod.included_modules - [mod]
          exts = mod.singleton_class.included_modules - Module.included_modules
    Severity: Minor
    Found in lib/rdot.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 dot_scope has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def dot_scope m, scope, opts
          result = []
          if m[scope]
            if m[scope][:public]
              if m[scope][:public][:attributes]
    Severity: Minor
    Found in lib/rdot.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 add_module has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_module acc, mod, opts
          if opts[:exclude_classes]
            opts[:exclude_classes].each do |c|
              return nil if mod <= c
            end
    Severity: Minor
    Found in lib/rdot.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 dot_scope has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def dot_scope m, scope, opts
          result = []
          if m[scope]
            if m[scope][:public]
              if m[scope][:public][:attributes]
    Severity: Major
    Found in lib/rdot.rb - About 2 hrs to fix

      Method add_method has 67 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def add_method acc, mod, scope, visibility, name, opts
            m = get_method_object mod, scope, name
            src = m.source_location
            obj = {}
            nm = name.to_s
      Severity: Major
      Found in lib/rdot.rb - About 2 hrs to fix

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

            def dot space, opts = {}
              opts = defaults.merge opts
              result = []
              result << 'digraph graph_RDot{'
              result << '  graph['
        Severity: Major
        Found in lib/rdot.rb - About 2 hrs to fix

          Method get_module has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def get_module mod, opts
                result = {}
                result[:module] = mod
                incs = mod.included_modules - [mod]
                exts = mod.singleton_class.included_modules - Module.included_modules
          Severity: Major
          Found in lib/rdot.rb - About 2 hrs to fix

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

                def dot_module space, name, m, opts
                  if m == nil
                    # $stderr.puts "Warning: nil module by name \"#{name}\"!"
                    # return nil
                    m = get_module eval(name), no_scan: true
            Severity: Minor
            Found in lib/rdot.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 diff_module has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def diff_module base, other, opts
                  if ! other
                    return base.merge :new => true
                  end
                  if opts[:show_preloaded]
            Severity: Major
            Found in lib/rdot.rb - About 2 hrs to fix

              Method dot_module has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def dot_module space, name, m, opts
                    if m == nil
                      # $stderr.puts "Warning: nil module by name \"#{name}\"!"
                      # return nil
                      m = get_module eval(name), no_scan: true
              Severity: Minor
              Found in lib/rdot.rb - About 1 hr to fix

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

                    def node_color m, opts
                      mod = m[:module]
                      stg = module_stage m
                      if Class === mod
                        if mod <= Exception
                Severity: Minor
                Found in lib/rdot.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 node_color has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def node_color m, opts
                      mod = m[:module]
                      stg = module_stage m
                      if Class === mod
                        if mod <= Exception
                Severity: Minor
                Found in lib/rdot.rb - About 1 hr to fix

                  Method add_method has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def add_method acc, mod, scope, visibility, name, opts
                  Severity: Minor
                  Found in lib/rdot.rb - About 45 mins to fix

                    Consider simplifying this complex logical expression.
                    Open

                                    unless other[s] && other[s][v] && other[s][v][k] &&
                                        other[s][v][k][n] &&
                                        other[s][v][k][n][:file] == m[:file] &&
                                        other[s][v][k][n][:line] == m[:line]
                                      result[s] ||= {}
                    Severity: Major
                    Found in lib/rdot.rb - About 40 mins to fix

                      Method register_attribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def register_attribute mod, scope, names, access, source
                      Severity: Minor
                      Found in lib/rdot.rb - About 35 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                return nil unless mod.global?
                        Severity: Major
                        Found in lib/rdot.rb - About 30 mins to fix

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

                            def parse_caller clr
                              clr.each do |s|
                                if s.include?('`<module:') || s.include?('`<class:') ||
                                    s.include?("`singletonclass'") || s.include?('`block in <')
                                  a = s.split(':')
                          Severity: Minor
                          Found in lib/rdot.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