shageman/cobradeps

View on GitHub

Showing 3 of 3 total issues

Method graph has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.graph(path)
    g = GraphViz.new(:G, :type => :digraph, concentrate: true)
    gem_nodes = {}

    app = GemfileScraper.new(path)
Severity: Major
Found in lib/cobradeps.rb - About 2 hrs to fix

    Method graph has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.graph(path)
        g = GraphViz.new(:G, :type => :digraph, concentrate: true)
        gem_nodes = {}
    
        app = GemfileScraper.new(path)
    Severity: Minor
    Found in lib/cobradeps.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 gem_dependencies has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def gem_dependencies
          in_path_block_dir = nil
          raw_gemfile.split("\n").inject([]) do |memo, line|
            if in_path_block_dir
              if match = line.match(/gem\s+["']([^'"]+)["'](.*)/)
    Severity: Minor
    Found in lib/cobradeps/gemfile_scraper.rb - About 45 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