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
- Read upRead up
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
- Read upRead up
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?
- Read upRead up
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
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
- Read upRead up
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
- Read upRead up
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
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?
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
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!
- Read upRead up
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|
- Read upRead up
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|
- Read upRead up
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