akissa/vagrant-rimu

View on GitHub

Showing 22 of 22 total issues

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

      def finalize!
        @api_key = ENV['RIMU_API_KEY'] if @api_key == UNSET_VALUE
        @api_url = ENV['RIMU_URL'] if @api_url == UNSET_VALUE
        @distro_code = "centos6.64" if @distro_code == UNSET_VALUE
        @disk_space_mb = 20000 if @disk_space_mb == UNSET_VALUE
Severity: Minor
Found in lib/vagrant-rimu/config.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 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def execute(env)
          client = env[:rimu_api]
          env[:ui].info I18n.t('vagrant_rimu.creating')
          params = {
            :billing_oid => @machine.provider_config.billing_id,
Severity: Major
Found in lib/vagrant-rimu/actions/create.rb - About 2 hrs to fix

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

            def execute(env)
              client = env[:rimu_api]
              env[:ui].info I18n.t('vagrant_rimu.creating')
              params = {
                :billing_oid => @machine.provider_config.billing_id,
    Severity: Minor
    Found in lib/vagrant-rimu/actions/create.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 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def execute(env)
              client = env[:rimu_api]
              env[:ui].info I18n.t('vagrant_rimu.rebuilding')
              
              params = {
    Severity: Minor
    Found in lib/vagrant-rimu/actions/rebuild.rb - About 1 hr to fix

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

              def execute(env)
                client = env[:rimu_api]
                env[:ui].info I18n.t('vagrant_rimu.rebuilding')
                
                params = {
      Severity: Minor
      Found in lib/vagrant-rimu/actions/rebuild.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 validate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

            def validate(machine)
              errors = []
              errors << I18n.t('vagrant_rimu.config.api_key') unless @api_key
              errors << I18n.t('vagrant_rimu.config.host_name') unless @host_name
              if @host_name
      Severity: Minor
      Found in lib/vagrant-rimu/config.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 action_destroy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.action_destroy
              new_builder.tap do |b|
                b.use Call, DestroyConfirm do |env, b1|
                  if env[:result]
                    b1.use ConfigValidate
      Severity: Minor
      Found in lib/vagrant-rimu/actions.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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def execute(env)
                client = env[:rimu_api]
      
                env[:ui].info I18n.t('vagrant_rimu.moving')
      
      
      Severity: Minor
      Found in lib/vagrant-rimu/actions/move.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

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

              def execute(env)
                # check if provisioning is enabled
                enabled = true
                enabled = env[:provision_enabled] if env.has_key?(:provision_enabled)
                return @app.call(env) unless enabled
      Severity: Minor
      Found in lib/vagrant-rimu/actions/modify_provision_path.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

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

            def self.action_ssh
              new_builder.tap do |b|
                b.use ConfigValidate
                b.use ConnectToRimu
                b.use Call, ReadState do |env, b1|
      Severity: Minor
      Found in lib/vagrant-rimu/actions.rb and 1 other location - About 30 mins to fix
      lib/vagrant-rimu/actions.rb on lines 69..77

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

      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

            def self.action_ssh_run
              new_builder.tap do |b|
                b.use ConfigValidate
                b.use ConnectToRimu
                b.use Call, ReadState do |env, b1|
      Severity: Minor
      Found in lib/vagrant-rimu/actions.rb and 1 other location - About 30 mins to fix
      lib/vagrant-rimu/actions.rb on lines 55..63

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

      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 init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.init
              level = nil
              begin
                level = Log4r.const_get(ENV['VAGRANT_LOG'].upcase)
              rescue NameError
      Severity: Minor
      Found in lib/vagrant-rimu/logging.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

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

      module VagrantPlugins
        module Rimu
          module Commands
            class Move < AbstractCommand
              def self.synopsis
      Severity: Minor
      Found in lib/vagrant-rimu/commands/move.rb and 3 other locations - About 25 mins to fix
      lib/vagrant-rimu/commands/billing_methods.rb on lines 3..13
      lib/vagrant-rimu/commands/distributions.rb on lines 3..13
      lib/vagrant-rimu/commands/list_servers.rb on lines 3..13

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

      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 VagrantPlugins
        module Rimu
          module Actions
            class MessageWillNotDestroy < AbstractAction
              def initialize(app, env)
      Severity: Minor
      Found in lib/vagrant-rimu/actions/message_will_not_destroy.rb and 1 other location - About 25 mins to fix
      lib/vagrant-rimu/actions/message_will_not_stop.rb on lines 3..14

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

      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 VagrantPlugins
        module Rimu
          module Actions
            class MessageWillNotStop < AbstractAction
              def initialize(app, env)
      Severity: Minor
      Found in lib/vagrant-rimu/actions/message_will_not_stop.rb and 1 other location - About 25 mins to fix
      lib/vagrant-rimu/actions/message_will_not_destroy.rb on lines 3..14

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

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

      module VagrantPlugins
        module Rimu
          module Commands
            class ListServers < RimuCommand
              def self.synopsis
      Severity: Minor
      Found in lib/vagrant-rimu/commands/list_servers.rb and 3 other locations - About 25 mins to fix
      lib/vagrant-rimu/commands/billing_methods.rb on lines 3..13
      lib/vagrant-rimu/commands/distributions.rb on lines 3..13
      lib/vagrant-rimu/commands/move.rb on lines 3..13

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

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

      module VagrantPlugins
        module Rimu
          module Commands
            class Distributions < RimuCommand
              def self.synopsis
      Severity: Minor
      Found in lib/vagrant-rimu/commands/distributions.rb and 3 other locations - About 25 mins to fix
      lib/vagrant-rimu/commands/billing_methods.rb on lines 3..13
      lib/vagrant-rimu/commands/list_servers.rb on lines 3..13
      lib/vagrant-rimu/commands/move.rb on lines 3..13

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

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

      module VagrantPlugins
        module Rimu
          module Commands
            class BillingMethods < RimuCommand
              def self.synopsis
      Severity: Minor
      Found in lib/vagrant-rimu/commands/billing_methods.rb and 3 other locations - About 25 mins to fix
      lib/vagrant-rimu/commands/distributions.rb on lines 3..13
      lib/vagrant-rimu/commands/list_servers.rb on lines 3..13
      lib/vagrant-rimu/commands/move.rb on lines 3..13

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

      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

      Useless private access modifier.
      Open

            private
      Severity: Minor
      Found in lib/vagrant-rimu/actions.rb by rubocop

      This cop checks for redundant access modifiers, including those with no code, those which are repeated, and leading public modifiers in a class or module body. Conditionally-defined methods are considered as always being defined, and thus access modifiers guarding such methods are not redundant.

      Example:

      class Foo
        public # this is redundant (default access is public)
      
        def method
        end
      
        private # this is not redundant (a method is defined)
        def method2
        end
      
        private # this is redundant (no following methods are defined)
      end

      Example:

      class Foo
        # The following is not redundant (conditionally defined methods are
        # considered as always defining a method)
        private
      
        if condition?
          def method
          end
        end
      
        protected # this is not redundant (method is defined)
      
        define_method(:method2) do
        end
      
        protected # this is redundant (repeated from previous modifier)
      
        [1,2,3].each do |i|
          define_method("foo#{i}") do
          end
        end
      
        # The following is redundant (methods defined on the class'
        # singleton class are not affected by the public modifier)
        public
      
        def self.method3
        end
      end

      Example:

      # Lint/UselessAccessModifier:
      #   ContextCreatingMethods:
      #     - concerning
      require 'active_support/concern'
      class Foo
        concerning :Bar do
          def some_public_method
          end
      
          private
      
          def some_private_method
          end
        end
      
        # this is not redundant because `concerning` created its own context
        private
      
        def some_other_private_method
        end
      end

      Example:

      # Lint/UselessAccessModifier:
      #   MethodCreatingMethods:
      #     - delegate
      require 'active_support/core_ext/module/delegation'
      class Foo
        # this is not redundant because `delegate` creates methods
        private
      
        delegate :method_a, to: :method_b
      end

      TODO found
      Open

                       (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
      Severity: Minor
      Found in .rubocop.yml by fixme
      Severity
      Category
      Status
      Source
      Language