fgrehm/vagrant-notify

View on GitHub

Showing 16 of 22 total issues

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

        def action_start_server
          Vagrant::Action::Builder.new.tap do |b|
            b.use Call, CheckProvider do |env, b2|
              next if !env[:result]

Severity: Minor
Found in lib/vagrant-notify/action.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 validate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def validate(machine)
        errors = _detected_errors

        if backed_by_cloud_provider?(machine)
          machine.ui.warn("Disabling vagrant-notify, cloud provider #{machine.provider_name} in use.")
Severity: Minor
Found in lib/vagrant-notify/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 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def execute
        options = {}
        opts = OptionParser.new do |o|
          o.banner = 'Usage: vagrant notify'
          o.separator ''
Severity: Minor
Found in lib/vagrant-notify/command.rb - About 1 hr to fix

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

          def execute
            options = {}
            opts = OptionParser.new do |o|
              o.banner = 'Usage: vagrant notify'
              o.separator ''
    Severity: Minor
    Found in lib/vagrant-notify/command.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 call has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

            def call(env)
              message = notify_provision_messages(env) unless env[:machine].config.notify.enable == false
              system(message[:start]) unless env[:machine].config.notify.enable == false
    
              begin
    Severity: Minor
    Found in lib/vagrant-notify/action/notify_provisioning_status.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_status_server has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

            def action_status_server
              Vagrant::Action::Builder.new.tap do |b|
                b.use Call, CheckProvider do |env, b2|
                  next if !env[:result]
    
    
    Severity: Minor
    Found in lib/vagrant-notify/action.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 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def validate(machine)
            errors = _detected_errors
    
            if backed_by_cloud_provider?(machine)
              machine.ui.warn("Disabling vagrant-notify, cloud provider #{machine.provider_name} in use.")
    Severity: Minor
    Found in lib/vagrant-notify/config.rb - About 1 hr to fix

      Method run has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

            def self.run(id, port, bind_ip, sender_app, sender_params_str, sender_params_escape, machine_name='default', provider='virtualbox')
      Severity: Major
      Found in lib/vagrant-notify/server.rb - About 1 hr to fix

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

              def initialize(id, sender_app, sender_params_str, sender_params_escape, machine_name = :default, provider = :virtualbox)
        Severity: Minor
        Found in lib/vagrant-notify/server.rb - About 45 mins to fix

          Method action_stop_server has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def action_stop_server
                    Vagrant::Action::Builder.new.tap do |b|
                      b.use Call, CheckProvider do |env, b2|
                        next if !env[:result]
          
          
          Severity: Minor
          Found in lib/vagrant-notify/action.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 valid_process? has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                  def valid_process?(pid)
                    if RUBY_PLATFORM =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
                      Vagrant::Notify::Action::Windows::ProcessInfo.queryProcess(pid) if pid
                    else
                      Process.getpgid(pid.to_i) if pid
          Severity: Minor
          Found in lib/vagrant-notify/action/server_is_running.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 queryProcess has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                    def self.queryProcess(pid)
                      return false unless pid =~ /\A\d+\z/
                      result = `c\:/Windows/System32/wbem/WMIC.exe process where \"ProcessID = '#{pid}'\" get ProcessID,Commandline /format:list 2>nul`
                      querypid = false
                      result.split(/\r?\n/).each do |line|
          Severity: Minor
          Found in lib/vagrant-notify/action/windows/process_info.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 next_available_port has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  def next_available_port(bind_ip)
                    # Determine a list of usable ports for us to use
                    usable_ports = Set.new(@env[:machine].config.vm.usable_port_range)
          
                    # Pass one, remove all defined host ports from usable ports
          Severity: Minor
          Found in lib/vagrant-notify/action/start_server.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                def self.run(id, port, bind_ip, sender_app, sender_params_str, sender_params_escape, machine_name='default', provider='virtualbox')
                  #id                   = env[:machine].id
                  #machine_name         = env[:machine].name
                  #provider             = env[:machine].provider_name
                  #sender_app           = env[:machine].config.sender_app
          Severity: Minor
          Found in lib/vagrant-notify/server.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  def call(env)         
                    begin
                      unless env[:machine].config.notify.enable == false 
                        host_dir = Pathname("/tmp/vagrant-notify/#{env[:machine].index_uuid}")
                        FileUtils.mkdir_p host_dir.to_s unless host_dir.exist?
          Severity: Minor
          Found in lib/vagrant-notify/action/set_shared_folder.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 which has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

                  def which(cmd)
                    exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
                    ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
                      exts.each { |ext|
                        exe = File.join(path, "#{cmd}#{ext}")
          Severity: Minor
          Found in lib/vagrant-notify/action/start_server.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