express42/vagrant-foodshow

View on GitHub

Showing 13 of 13 total issues

Method parse_log has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

        def self.parse_log(log_h, timeout)
          @ngrok_version_deprecated = VagrantPlugins::Foodshow::Util::NgrokConfig.ngrok_version_deprecated?
          debug_output = []
          begin
            timeout(timeout.to_i) do
Severity: Minor
Found in lib/vagrant-foodshow/util/ngrok.rb - About 6 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 start has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

        def self.start(env, tunnel)
          @ngrok_version_deprecated = VagrantPlugins::Foodshow::Util::NgrokConfig.ngrok_version_deprecated?
          if defined?(@@counter)
            @@counter += 1
          else
Severity: Minor
Found in lib/vagrant-foodshow/util/ngrok.rb - About 3 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 call has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

        def call(env)
          @app.call(env)

          return unless env[:machine].config.foodshow.enabled?

Severity: Minor
Found in lib/vagrant-foodshow/action/start.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 start has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.start(env, tunnel)
          @ngrok_version_deprecated = VagrantPlugins::Foodshow::Util::NgrokConfig.ngrok_version_deprecated?
          if defined?(@@counter)
            @@counter += 1
          else
Severity: Major
Found in lib/vagrant-foodshow/util/ngrok.rb - About 2 hrs to fix

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

          def finalize!
            @ngrok_bin = VagrantPlugins::Foodshow::Util::NgrokConfig.where_ngrok if @ngrok_bin == UNSET_VALUE
    
            @trust_host_root_certs = nil if @trust_host_root_certs == UNSET_VALUE
            @server_addr = nil if @server_addr == UNSET_VALUE
    Severity: Minor
    Found in lib/vagrant-foodshow/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 merge_config has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

            def self.merge_config(env, tunnel)
              config = {}
              foodshow_config = env[:machine].config.foodshow
    
              config[:trust_host_root_certs] = foodshow_config.trust_host_root_certs if foodshow_config.trust_host_root_certs
    Severity: Minor
    Found in lib/vagrant-foodshow/util/ngrok_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 parse_log has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def self.parse_log(log_h, timeout)
              @ngrok_version_deprecated = VagrantPlugins::Foodshow::Util::NgrokConfig.ngrok_version_deprecated?
              debug_output = []
              begin
                timeout(timeout.to_i) do
    Severity: Minor
    Found in lib/vagrant-foodshow/util/ngrok.rb - About 1 hr to fix

      Method call has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def call(env)
                @app.call(env)
      
                return unless env[:machine].config.foodshow.enabled?
      
      
      Severity: Minor
      Found in lib/vagrant-foodshow/action/start.rb - About 1 hr to fix

        Method merge_config has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                def self.merge_config(env, tunnel)
                  config = {}
                  foodshow_config = env[:machine].config.foodshow
        
                  config[:trust_host_root_certs] = foodshow_config.trust_host_root_certs if foodshow_config.trust_host_root_certs
        Severity: Minor
        Found in lib/vagrant-foodshow/util/ngrok_config.rb - About 1 hr to fix

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

                def validate(machine)
                  errors = _detected_errors
                  if @ngrok_bin == UNSET_VALUE
                    errors << <<MSG
          Ngrok binary not found!
          Severity: Minor
          Found in lib/vagrant-foodshow/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 call has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def call(env)
          
                    machine_id = VagrantPlugins::Foodshow::Util::NgrokConfig.get_machine_id(env)
                    Dir.glob("#{env[:tmp_path] || '/tmp'}/ngrok-#{machine_id}-*.pid") do |pid_file|
                      ::File.open(pid_file, 'r') do |f|
          Severity: Minor
          Found in lib/vagrant-foodshow/action/stop.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 where_ngrok has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

                  def self.where_ngrok
                    cmd = 'ngrok'
                    exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
                    ENV['PATH'].split(::File::PATH_SEPARATOR).each do |path|
                      exts.each { |ext|
          Severity: Minor
          Found in lib/vagrant-foodshow/util/ngrok_config.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

          Avoid too many return statements within this method.
          Open

                      return -1, 'Ngrok wait timeout. See ngrok output:', debug_output
          Severity: Major
          Found in lib/vagrant-foodshow/util/ngrok.rb - About 30 mins to fix
            Severity
            Category
            Status
            Source
            Language