reachlocal/boxci

View on GitHub
lib/boxci/tester.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method test has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def test(options)
      File.open('/tmp/boxci.log', 'w') do |f|
        f.write('')
      end

Severity: Major
Found in lib/boxci/tester.rb - About 2 hrs to fix

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

        def install_puppet_on_box
          say "Opening SSH tunnel into the box...", :blue if verbose?
          Net::SSH.start("default", nil, {:config => File.join(@project_workspace_folder, "ssh-config.local")}) do |ssh|
            puppet = ssh.exec! "which puppet"
            unless puppet
    Severity: Minor
    Found in lib/boxci/tester.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 spin_up_box has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def spin_up_box
          inside @project_workspace_folder do
            if verbose?
              if !run "vagrant up --no-provision --provider #{provider}", :verbose => verbose?
                raise Boxci::CommandFailed, "Failed to successfully run vagrant up --no-provision --provider #{provider}"
    Severity: Minor
    Found in lib/boxci/tester.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 setup_ssh_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def setup_ssh_config
          inside @project_workspace_folder do
            if verbose?
              if !run "vagrant ssh-config > ssh-config.local", :verbose => verbose?
                raise Boxci::CommandFailed, "Failed to successfully run vagrant ssh-config > ssh-config.local"
    Severity: Minor
    Found in lib/boxci/tester.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

    There are no issues that match your filters.

    Category
    Status