Showing 7 of 7 total issues
Method load
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def self.load options = {}
config_file_paths = [
"#{ENV['HOME']}/.rancher-shell.yml",
"#{Dir.pwd}/.rancher-shell.yml",
]
- 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 initialize
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def initialize url, options = {}
return if @socket
@url = url
uri = URI.parse url
@socket = TCPSocket.new(uri.host, uri.port || (uri.scheme == 'wss' ? 443 : 80))
- 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 initialize
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize url, options = {}
return if @socket
@url = url
uri = URI.parse url
@socket = TCPSocket.new(uri.host, uri.port || (uri.scheme == 'wss' ? 443 : 80))
Method initialize
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def initialize
@config = Config.get_all
logger.debug "config = #{@config}"
exit_with_error "Project not found: #{@config['project']}" unless @config['project']
exit_with_error "Command not specified" unless @config['options']['command'] && @config['options']['command'] != ''
- 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 setup_websocket!
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_websocket!
logger.info "container = #{@container['id']}"
# default_bash_command = "TERM=xterm-256color; export TERM; [ -x /bin/bash ] && ([ -x /usr/bin/script ] && /usr/bin/script -q -c \"/bin/bash\" /dev/null || exec /bin/bash) || exec /bin/sh"
# @config['options']['command'] = default_bash_command if @config['options']['command'] === 'bash'
bash_command = @config['options']['command']
Method load
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.load options = {}
config_file_paths = [
"#{ENV['HOME']}/.rancher-shell.yml",
"#{Dir.pwd}/.rancher-shell.yml",
]
Method logs
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def logs
filename = logger.instance_variable_get(:'@logdev').filename
tail_command = "tail#{options[:tail] ? " -f -n#{options[:lines] || 0}" : " -n#{options[:lines] || 10}"} #{filename}"
puts "==> displaying logs from #{filename} <=="
puts " #{tail_command}"
- 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"