Showing 111 of 111 total issues
File client.rb
has 1731 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "gorgon_amq/pack"
require "gorgon_amq/protocol/table"
require "gorgon_amq/protocol/frame"
File channel.rb
has 831 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "thread"
require "monitor"
require "set"
require "gorgon_bunny/concurrent/atomic_fixnum"
Class Channel
has 94 methods (exceeds 20 allowed). Consider refactoring. Open
class Channel
#
# API
#
Class Session
has 81 methods (exceeds 20 allowed). Consider refactoring. Open
class Session
# Default host used for connection
DEFAULT_HOST = "127.0.0.1"
# Default virtual host used for connection
File session.rb
has 642 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "socket"
require "thread"
require "monitor"
require "gorgon_bunny/transport"
Class Transport
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class Transport
#
# API
#
Method run_loop
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def run_loop
loop do
begin
break if @stopping || @network_is_down
run_once
- 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
File transport.rb
has 290 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "socket"
require "thread"
require "monitor"
begin
Method handle_method
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_method(method)
@logger.debug "Channel#handle_frame on channel #{@id}: #{method.inspect}"
case method
when GorgonAMQ::Protocol::Queue::DeclareOk then
@continuations.push(method)
Class Queue
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Queue
include GorgonBunny::Compatibility
Similar blocks of code found in 3 locations. Consider refactoring. Open
class Bind < Protocol::Method
@name = "queue.bind"
@method_id = 20
@index = 0x00320014 # 50, 20, 3276820
@packed_indexes = [50, 20].pack(PACK_UINT16_X2).freeze
- 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 91.
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 3 locations. Consider refactoring. Open
class Bind < Protocol::Method
@name = "exchange.bind"
@method_id = 30
@index = 0x0028001E # 40, 30, 2621470
@packed_indexes = [40, 30].pack(PACK_UINT16_X2).freeze
- 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 91.
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 3 locations. Consider refactoring. Open
class Unbind < Protocol::Method
@name = "exchange.unbind"
@method_id = 40
@index = 0x00280028 # 40, 40, 2621480
@packed_indexes = [40, 40].pack(PACK_UINT16_X2).freeze
- 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 91.
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 read_fully
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def read_fully(count, timeout = nil)
return nil if @__bunny_socket_eof_flag__
value = ''
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
Class Originator
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Originator
include Configuration
SPEC_SUCCESS_EXIT_STATUS = 0
SPEC_FAILURE_EXIT_STATUS = 1
Similar blocks of code found in 3 locations. Consider refactoring. Open
class FlowOk < Protocol::Method
@name = "channel.flow-ok"
@method_id = 21
@index = 0x00140015 # 20, 21, 1310741
@packed_indexes = [20, 21].pack(PACK_UINT16_X2).freeze
- 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 80.
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 3 locations. Consider refactoring. Open
class Select < Protocol::Method
@name = "confirm.select"
@method_id = 10
@index = 0x0055000A # 85, 10, 5570570
@packed_indexes = [85, 10].pack(PACK_UINT16_X2).freeze
- 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 80.
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 3 locations. Consider refactoring. Open
class Flow < Protocol::Method
@name = "channel.flow"
@method_id = 20
@index = 0x00140014 # 20, 20, 1310740
@packed_indexes = [20, 20].pack(PACK_UINT16_X2).freeze
- 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 80.
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 decode
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.decode(data)
table = Hash.new
table_length = data.unpack(PACK_UINT32).first
return table if table_length.zero?
Method decode_array
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.decode_array(data, initial_offset)
array_length = data.slice(initial_offset, 4).unpack(PACK_UINT32).first
ary = Array.new
offset = initial_offset + 4