sethvargo/stove

View on GitHub

Showing 10 of 10 total issues

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

    def execute!
      $stdout, $stderr = @stdout, @stderr

      # Parse the options hash
      option_parser.parse!(@argv)
Severity: Minor
Found in lib/stove/cli.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 option_parser has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def option_parser
      @option_parser ||= OptionParser.new do |opts|
        opts.banner = 'Usage: stove [OPTIONS]'

        opts.separator ''
Severity: Major
Found in lib/stove/cli.rb - About 2 hrs to fix

    Method execute! has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def execute!
          $stdout, $stderr = @stdout, @stderr
    
          # Parse the options hash
          option_parser.parse!(@argv)
    Severity: Minor
    Found in lib/stove/cli.rb - About 1 hr to fix

      Method initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def initialize(cookbook = nil, maintainer = 'YOUR_COMPANY_NAME', maintainer_email = 'YOUR_EMAIL', license = 'none')
              @cookbook         = cookbook
              @name             = cookbook ? cookbook.name : ''
              @long_description = ''
              @source_url       = Stove::Mash.new
      Severity: Minor
      Found in lib/stove/cookbook/metadata.rb - About 1 hr to fix

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

              def to_hash(extended_metadata = false)
                hash = {
                  'name'             => self.name,
                  'version'          => self.version,
                  'description'      => self.description,
        Severity: Minor
        Found in lib/stove/cookbook/metadata.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 to_hash has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def to_hash(extended_metadata = false)
                hash = {
                  'name'             => self.name,
                  'version'          => self.version,
                  'description'      => self.description,
        Severity: Minor
        Found in lib/stove/cookbook/metadata.rb - About 1 hr to fix

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

              def initialize(argv, stdin=STDIN, stdout=STDOUT, stderr=STDERR, kernel=Kernel)
          Severity: Minor
          Found in lib/stove/cli.rb - About 35 mins to fix

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

                def upload(cookbook, extended_metadata = false)
                  # Artifactory doesn't prevent uploading over an existing release in
                  # some cases so let's check for that. Seriously never do this, go delete
                  # and then re-upload if you have to.
                  response = request(:get, "api/v1/cookbooks/#{cookbook.name}/versions/#{cookbook.version}")
            Severity: Minor
            Found in lib/stove/artifactory.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

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

                  def initialize(cookbook = nil, maintainer = 'YOUR_COMPANY_NAME', maintainer_email = 'YOUR_EMAIL', license = 'none')
                    @cookbook         = cookbook
                    @name             = cookbook ? cookbook.name : ''
                    @long_description = ''
                    @source_url       = Stove::Mash.new
            Severity: Minor
            Found in lib/stove/cookbook/metadata.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

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

                def git(command, errors = true)
                  Stove::Log.debug("the command matches")
                  Stove::Log.debug("Running `git #{command}', errors: #{errors}")
                  Dir.chdir(cookbook.path) do
                    response = %x|git #{command}|
            Severity: Minor
            Found in lib/stove/plugins/git.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