Showing 169 of 169 total issues
Method start_service
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def start_service io, logger=nil
begin
require 'hrr_rb_ssh'
rescue LoadError
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
begin
pid, status = Process.waitpid2 pid
context.log_info { "program exited with status #{status.inspect}" }
status.exitstatus
ensure
- Read upRead up
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 70.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method connection_loop_thread
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def connection_loop_thread
log_info { "start connection loop" }
Thread.new do
begin
while true
Method connection_loop_thread
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def connection_loop_thread
log_info { "start connection loop" }
Thread.new do
begin
while true
- 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 err_receiver_thread
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def err_receiver_thread
Thread.start {
log_info { "start err receiver thread" }
loop do
begin
- 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 receiver_thread
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def receiver_thread
Thread.start {
log_info { "start receiver thread" }
loop do
begin
- 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 receive
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def receive
raise Error::ClosedTransport if @closed
@receiver_monitor.synchronize do
begin
payload = @receiver.receive self
- 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 out_receiver_thread
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def out_receiver_thread
Thread.start {
log_info { "start out receiver thread" }
loop do
begin
- 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_service
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_service io, logger=nil
begin
require 'hrr_rb_ssh'
rescue LoadError
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
Similar blocks of code found in 2 locations. Consider refactoring. Open
def close
begin
if @sender_thread_finished && @receiver_thread_finished
log_info { "closing direct-tcpip" }
@socket.close
- Read upRead up
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 63.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
def close
begin
if @sender_thread_finished && @receiver_thread_finished
log_info { "closing forwarded-tcpip" }
@socket.close
- Read upRead up
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 63.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method request_authentication
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def request_authentication
authentication_methods = (@options['authentication_preferred_authentication_methods'].dup rescue nil) || Method.list_preferred # rescue nil.dup for Ruby version < 2.4
log_info { "preferred authentication methods: #{authentication_methods}" }
next_method_name = "none"
log_info { "authentication request begins with none method" }
- 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 request_authentication
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request_authentication
authentication_methods = (@options['authentication_preferred_authentication_methods'].dup rescue nil) || Method.list_preferred # rescue nil.dup for Ruby version < 2.4
log_info { "preferred authentication methods: #{authentication_methods}" }
next_method_name = "none"
log_info { "authentication request begins with none method" }
Method start
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start transport
case transport.mode
when Mode::SERVER
message = receive_kex_dh_gex_request transport.receive
@min = message[:'min']
Method receiver_thread
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def receiver_thread
Thread.start {
log_info { "start receiver thread" }
loop do
begin
Method start_service
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def start_service io, logger=nil
begin
require 'hrr_rb_ssh'
rescue LoadError
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
Method err_receiver_thread
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def err_receiver_thread
Thread.start {
log_info { "start err receiver thread" }
loop do
begin
Method out_receiver_thread
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def out_receiver_thread
Thread.start {
log_info { "start out receiver thread" }
loop do
begin
Method exec
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exec command, pty: false, env: {}
log_info { "start exec: #{command}" }
begin
log_info { "Opning channel" }
channel = @connection.request_channel_open "session"
Method request_authentication
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request_authentication username, service_name
message = {
:'message number' => Messages::SSH_MSG_USERAUTH_REQUEST::VALUE,
:"user name" => username,
:"service name" => service_name,