shikhalev/rdot

View on GitHub

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

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

            if m[scope][:protected]
              if m[scope][:protected][:attributes]
                m[scope][:protected][:attributes].sort.each do |n, a|
                  result << '<TD BGCOLOR="' + opts[:color_protected] +
                      '" ALIGN="LEFT">' + escape(a[:signature]) +
    Severity: Major
    Found in lib/rdot.rb and 1 other location - About 3 hrs to fix
    lib/rdot.rb on lines 552..570

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

    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

            if m[scope][:private]
              if m[scope][:private][:attributes]
                m[scope][:private][:attributes].sort.each do |n, a|
                  result << '<TD BGCOLOR="' + opts[:color_private] +
                      '" ALIGN="LEFT">' + escape(a[:signature]) +
    Severity: Major
    Found in lib/rdot.rb and 1 other location - About 3 hrs to fix
    lib/rdot.rb on lines 530..548

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

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

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

                            if m[scope][:public][:methods]
                              m[scope][:public][:methods].sort.each do |n, a|
                                result << '<TD ALIGN="LEFT">' + escape(a[:signature]) +
                                    '</TD><TD ALIGN="RIGHT">' + escape(a[:file].to_s) +
                                    '</TD><TD ALIGN="RIGHT">' + a[:line].to_s + '</TD>'
                  Severity: Minor
                  Found in lib/rdot.rb and 1 other location - About 55 mins to fix
                  lib/rdot.rb on lines 515..519

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

                  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

                            if m[scope][:public][:attributes]
                              m[scope][:public][:attributes].sort.each do |n, a|
                                result << '<TD ALIGN="LEFT">' + escape(a[:signature]) +
                                    '</TD><TD ALIGN="RIGHT">' + escape(a[:file].to_s) +
                                    '</TD><TD ALIGN="RIGHT">' + a[:line].to_s + '</TD>'
                  Severity: Minor
                  Found in lib/rdot.rb and 1 other location - About 55 mins to fix
                  lib/rdot.rb on lines 522..526

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

                  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 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
                    Severity
                    Category
                    Status
                    Source
                    Language