crowbar/crowbar-client

View on GitHub

Showing 143 of 143 total issues

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

          def execute
            request.process do |request|
              case request.code
              when 200
                formatter = Formatter::Hash.new(
Severity: Minor
Found in lib/crowbar/client/command/upgrade/prechecks.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

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

module Crowbar
  module Client
    module Command
      module Database
        #
Severity: Major
Found in lib/crowbar/client/command/database/test.rb and 1 other location - About 1 hr to fix
lib/crowbar/client/command/database/connect.rb on lines 19..51

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

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

module Crowbar
  module Client
    module Command
      module Database
        #
Severity: Major
Found in lib/crowbar/client/command/database/connect.rb and 1 other location - About 1 hr to fix
lib/crowbar/client/command/database/test.rb on lines 19..51

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

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 process_hash has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def process_hash(values, path = "", type = :table)
          [].tap do |result|
            values.map do |key, value|
              new_path = [path.to_s.dup, key].reject(&:empty?).join(".")

Severity: Minor
Found in lib/crowbar/client/formatter/nested.rb - About 1 hr to fix

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

  module Client
    module Command
      module Services
        #
        # Implementation for the List Restarts command
Severity: Major
Found in lib/crowbar/client/command/services/restart_flags.rb and 1 other location - About 1 hr to fix
lib/crowbar/client/command/services/list_restarts.rb on lines 18..49

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

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

  module Client
    module Command
      module Services
        #
        # Implementation for the List Restarts command
Severity: Major
Found in lib/crowbar/client/command/services/list_restarts.rb and 1 other location - About 1 hr to fix
lib/crowbar/client/command/services/restart_flags.rb on lines 18..49

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

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 content_from has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def content_from(request)
            result = [].tap do |row|
              request.parsed_response["nodes"].each do |child|
                if options["meta"]
                  row.push(
Severity: Minor
Found in lib/crowbar/client/command/node/list.rb - About 1 hr to fix

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

          def execute
            validate_barclamp! args.barclamp

            request.process do |request|
              case request.code
Severity: Minor
Found in lib/crowbar/client/command/proposal/show.rb - About 1 hr to fix

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

          def execute
            validate_barclamp! args.barclamp

            request.process do |request|
              case request.code
Severity: Minor
Found in lib/crowbar/client/command/proposal/show.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 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def execute
            request.process do |request|
              case request.code
              when 200
                if args.component == "crowbar"
Severity: Minor
Found in lib/crowbar/client/command/upgrade/backup.rb - About 1 hr to fix

Method from_file has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def from_file
            json = begin
              file = File.read(
                options[:file]
              )
Severity: Minor
Found in lib/crowbar/client/command/proposal/create.rb - About 1 hr to fix

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

  module Client
    module Command
      module Proposal
        #
        # Implementation for the proposal delete command
Severity: Major
Found in lib/crowbar/client/command/proposal/delete.rb and 1 other location - About 1 hr to fix
lib/crowbar/client/command/proposal/dequeue.rb on lines 18..43

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

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

  module Client
    module Command
      module Proposal
        #
        # Implementation for the proposal dequeue command
Severity: Major
Found in lib/crowbar/client/command/proposal/dequeue.rb and 1 other location - About 1 hr to fix
lib/crowbar/client/command/proposal/delete.rb on lines 18..43

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

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

module Crowbar
  module Client
    module Request
      module Database
        #
Severity: Major
Found in lib/crowbar/client/request/database/test.rb and 1 other location - About 1 hr to fix
lib/crowbar/client/request/database/connect.rb on lines 19..72

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

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

module Crowbar
  module Client
    module Request
      module Database
        #
Severity: Major
Found in lib/crowbar/client/request/database/connect.rb and 1 other location - About 1 hr to fix
lib/crowbar/client/request/database/test.rb on lines 19..72

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

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

module Crowbar
  module Client
    module Request
      module Backup
        #
Severity: Minor
Found in lib/crowbar/client/request/backup/restore.rb and 1 other location - About 1 hr to fix
lib/crowbar/client/request/backup/download.rb on lines 19..64

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

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 11 locations. Consider refactoring.
Open

module Crowbar
  module Client
    module Command
      module Node
        #
Severity: Major
Found in lib/crowbar/client/command/node/reinstall.rb and 10 other locations - About 1 hr to fix
lib/crowbar/client/command/node/allocate.rb on lines 19..43
lib/crowbar/client/command/node/hardware.rb on lines 19..43
lib/crowbar/client/command/node/identify.rb on lines 19..43
lib/crowbar/client/command/node/powercycle.rb on lines 19..43
lib/crowbar/client/command/node/poweroff.rb on lines 19..43
lib/crowbar/client/command/node/poweron.rb on lines 19..43
lib/crowbar/client/command/node/reboot.rb on lines 19..43
lib/crowbar/client/command/node/reset.rb on lines 19..43
lib/crowbar/client/command/node/shutdown.rb on lines 19..43
lib/crowbar/client/command/restricted/allocate.rb on lines 19..43

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

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 11 locations. Consider refactoring.
Open

module Crowbar
  module Client
    module Command
      module Node
        #
Severity: Major
Found in lib/crowbar/client/command/node/poweron.rb and 10 other locations - About 1 hr to fix
lib/crowbar/client/command/node/allocate.rb on lines 19..43
lib/crowbar/client/command/node/hardware.rb on lines 19..43
lib/crowbar/client/command/node/identify.rb on lines 19..43
lib/crowbar/client/command/node/powercycle.rb on lines 19..43
lib/crowbar/client/command/node/poweroff.rb on lines 19..43
lib/crowbar/client/command/node/reboot.rb on lines 19..43
lib/crowbar/client/command/node/reinstall.rb on lines 19..43
lib/crowbar/client/command/node/reset.rb on lines 19..43
lib/crowbar/client/command/node/shutdown.rb on lines 19..43
lib/crowbar/client/command/restricted/allocate.rb on lines 19..43

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

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 11 locations. Consider refactoring.
Open

module Crowbar
  module Client
    module Command
      module Node
        #
Severity: Major
Found in lib/crowbar/client/command/node/hardware.rb and 10 other locations - About 1 hr to fix
lib/crowbar/client/command/node/allocate.rb on lines 19..43
lib/crowbar/client/command/node/identify.rb on lines 19..43
lib/crowbar/client/command/node/powercycle.rb on lines 19..43
lib/crowbar/client/command/node/poweroff.rb on lines 19..43
lib/crowbar/client/command/node/poweron.rb on lines 19..43
lib/crowbar/client/command/node/reboot.rb on lines 19..43
lib/crowbar/client/command/node/reinstall.rb on lines 19..43
lib/crowbar/client/command/node/reset.rb on lines 19..43
lib/crowbar/client/command/node/shutdown.rb on lines 19..43
lib/crowbar/client/command/restricted/allocate.rb on lines 19..43

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

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 11 locations. Consider refactoring.
Open

module Crowbar
  module Client
    module Command
      module Node
        #
Severity: Major
Found in lib/crowbar/client/command/node/allocate.rb and 10 other locations - About 1 hr to fix
lib/crowbar/client/command/node/hardware.rb on lines 19..43
lib/crowbar/client/command/node/identify.rb on lines 19..43
lib/crowbar/client/command/node/powercycle.rb on lines 19..43
lib/crowbar/client/command/node/poweroff.rb on lines 19..43
lib/crowbar/client/command/node/poweron.rb on lines 19..43
lib/crowbar/client/command/node/reboot.rb on lines 19..43
lib/crowbar/client/command/node/reinstall.rb on lines 19..43
lib/crowbar/client/command/node/reset.rb on lines 19..43
lib/crowbar/client/command/node/shutdown.rb on lines 19..43
lib/crowbar/client/command/restricted/allocate.rb on lines 19..43

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

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

Severity
Category
Status
Source
Language