Showing 111 of 111 total issues
Method read_fully
has a Cognitive Complexity of 9 (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
Method subscribe_to_originator_queue
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def subscribe_to_originator_queue
originator_watcher = proc do
payload = nil
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
class Unblocked < Protocol::Method
@name = "connection.unblocked"
@method_id = 61
@index = 0x000A003D # 10, 61, 655421
@packed_indexes = [10, 61].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 42.
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
class CloseOk < Protocol::Method
@name = "connection.close-ok"
@method_id = 51
@index = 0x000A0033 # 10, 51, 655411
@packed_indexes = [10, 51].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 42.
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
class SelectOk < Protocol::Method
@name = "confirm.select-ok"
@method_id = 11
@index = 0x0055000B # 85, 11, 5570571
@packed_indexes = [85, 11].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 40.
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 add_consumer
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_consumer(queue, consumer_tag, no_ack, exclusive, arguments, &block)
Method raise_if_channel_close!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def raise_if_channel_close!(method)
if method && method.is_a?(GorgonAMQ::Protocol::Channel::Close)
# basic.ack, basic.reject, basic.nack. MK.
if channel_level_exception_after_operation_that_has_no_response?(method)
@on_error.call(self, method) if @on_error
- 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 encode
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.encode(channel, destination, source, routing_key, nowait, arguments)
Method encode
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.encode(channel, destination, source, routing_key, nowait, arguments)
Method encode
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.encode(channel, queue, exchange, routing_key, nowait, arguments)
Method initialize_tls_context
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize_tls_context(ctx)
ctx.cert = OpenSSL::X509::Certificate.new(@tls_certificate) if @tls_certificate
ctx.key = OpenSSL::PKey::RSA.new(@tls_key) if @tls_key
ctx.cert_store = if @tls_certificate_store
@tls_certificate_store
- 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 basic_consume
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def basic_consume(queue, consumer_tag = generate_consumer_tag, no_ack = false, exclusive = false, arguments = nil, &block)
Method basic_publish
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def basic_publish(payload, exchange, routing_key, opts = {})
raise_if_no_longer_open!
exchange_name = if exchange.respond_to?(:name)
exchange.name
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(channel, queue, consumer_tag = channel.generate_consumer_tag, no_ack = true, exclusive = false, arguments = {})
Similar blocks of code found in 2 locations. Consider refactoring. Open
class CloseOk < Protocol::Method
@name = "channel.close-ok"
@method_id = 41
@index = 0x00140029 # 20, 41, 1310761
@packed_indexes = [20, 41].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 40.
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 encode
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.encode(channel, queue, if_unused, if_empty, nowait)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(consumer_tag, delivery_tag, redelivered, exchange, routing_key)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(delivery_tag, redelivered, exchange, routing_key, message_count)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(version_major, version_minor, server_properties, mechanisms, locales)
Method encode
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def self.encode(channel, reply_code, reply_text, class_id, method_id)