maoueh/nugrant

View on GitHub

Showing 10 of 10 total issues

Class Bag has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Bag < Hash

    ##
    # Create a new Bag object which holds key/value pairs.
    # The Bag object inherits from the Hash object, the main
Severity: Minor
Found in lib/nugrant/bag.rb - About 3 hrs to fix

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

          def self.fetch_error_region_from_location(location, options = {})
            prefix = options[:prefix] || "   "
            width = options[:width] || 4
            file = File.new(location[:file], "r")
            line = location[:line]
    Severity: Minor
    Found in lib/nugrant/helper/stack.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 execute has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

              def execute
                parser = create_parser()
                arguments = parse_options(parser)
    
                return help(parser) if @show_help
    Severity: Minor
    Found in lib/nugrant/vagrant/v2/command/parameters.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 create_parser has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def create_parser()
                return OptionParser.new do |parser|
                  parser.banner = "Usage: vagrant user env [<options>]"
                  parser.separator ""
    
    
    Severity: Minor
    Found in lib/nugrant/vagrant/v2/command/env.rb - About 1 hr to fix

      Method execute has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

                def execute
                  parser = create_parser()
                  arguments = parse_options(parser)
      
                  return error("Invalid format value '#{@format}'", parser) if not EnvExporter.valid?(@format)
      Severity: Minor
      Found in lib/nugrant/vagrant/v2/command/env.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 execute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def execute
                  parser = create_parser()
                  arguments = parse_options(parser)
      
                  return error("Invalid format value '#{@format}'", parser) if not EnvExporter.valid?(@format)
      Severity: Minor
      Found in lib/nugrant/vagrant/v2/command/env.rb - About 1 hr to fix

        Method create_parser has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  def create_parser()
                    return OptionParser.new do |parser|
                      parser.banner = "Usage: vagrant user parameters [<options>]"
                      parser.separator ""
        
        
        Severity: Minor
        Found in lib/nugrant/vagrant/v2/command/parameters.rb - About 1 hr to fix

          Method find_project_path has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                  def self.find_project_path()
                    vagrantfile_name = ENV["VAGRANT_VAGRANTFILE"]
                    vagrantfile_name = [vagrantfile_name] if vagrantfile_name && !vagrantfile_name.is_a?(Array)
          
                    root_finder = lambda do |path|
          Severity: Minor
          Found in lib/nugrant/vagrant/v2/helper.rb - About 35 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

          Method call has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                    def call(env)
                      return @app.call(env) if not @config.user.auto_export
          
                      options = {
                        :type => :export,
          Severity: Minor
          Found in lib/nugrant/vagrant/v2/action/auto_export.rb - About 35 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

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

              def merge!(other, options = {})
                other.each do |key, value|
                  current = __get(key)
                  case
                    when current == nil
          Severity: Minor
          Found in lib/nugrant/bag.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