Showing 10 of 29 total issues
File messages.rb
has 378 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "request"
require_relative "response"
module WhatsappSdk
module Api
File example.rb
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
Method send_template
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_template(
sender_id:, recipient_number:, name:, language:, components: nil, components_json: nil
)
if !components && !components_json
raise Resource::Errors::MissingArgumentError,
Method send_document
has 26 lines of code (exceeds 25 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,
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 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 validate_attributes
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_attributes
[
[Type::Text, text],
[Type::Currency, currency],
[Type::DateTime, 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"