Showing 8 of 24 total issues
File example.rb
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
File messages.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "request"
module WhatsappSdk
module Api
class Messages < Request
Method faraday
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def faraday(url:, multipart: false)
::Faraday.new(url) do |client|
client.request(:multipart) if multipart
client.request(:url_encoded)
client.adapter(::Faraday.default_adapter)
- 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 to_json
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def to_json
json = {}
json[:id] = id unless id.nil?
json[:link] = link unless link.nil?
json[:caption] = caption unless caption.nil?
- 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 validate_attributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_attributes
[
[Type::TEXT, text],
[Type::IMAGE, image],
[Type::DOCUMENT, document],
- 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 validate_attributes
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_attributes
[
[Type::TEXT, text],
[Type::CURRENCY, currency],
[Type::DATE_TIME, date_time],
- 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 validate_list_message
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_list_message
button_length = button.length
sections_count = sections.length
unless button_length.positive?
raise Errors::InvalidInteractiveActionButton,
- 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 send_document
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def send_document(
sender_id:, recipient_number:, document_id: nil, link: nil, caption: "", message_id: nil, filename: nil
)
if !document_id && !link
raise Resource::Errors::MissingArgumentError,
- 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"