chatwoot/chatwoot

View on GitHub

Showing 7 of 25 total issues

Function runSDK has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

const runSDK = ({ baseUrl, websiteToken }) => {
  if (window.$chatwoot) {
    return;
  }

Severity: Minor
Found in app/javascript/packs/sdk.js - About 3 hrs to fix

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

Function classHelper has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

export const classHelper = (classes, action, elm) => {
  let search;
  let replace;
  let i;
  let has = false;
Severity: Minor
Found in app/javascript/sdk/DOMHelpers.js - About 2 hrs to fix

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 find_all has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def find_all(name, prefix = nil, partial = false, details = {}, key = nil, locals = [])
Severity: Minor
Found in app/services/email_templates/db_resolver_service.rb - About 45 mins to fix

Method perform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def perform
    message = event_data[:message]
    return if message.private?
    return unless processable_message?(message)
    return unless message.conversation.pending?
Severity: Minor
Found in lib/integrations/dialogflow/processor_service.rb - About 35 mins to fix

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 create_test_text has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def create_test_text
    messenger_channel = Channel::FacebookPage.last
    @inbox = ::Inbox.find_by(channel: messenger_channel)
    return unless @inbox

Severity: Minor
Found in app/jobs/webhooks/instagram_events_job.rb - About 25 mins to fix

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 contact_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def contact_params
    begin
      k = Koala::Facebook::API.new(@inbox.channel.page_access_token) if @inbox.facebook?
      result = k.get_object(@sender_id) || {}
    rescue Koala::Facebook::AuthenticationError
Severity: Minor
Found in app/builders/messages/facebook/message_builder.rb - About 25 mins to fix

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

Function conversationUrl has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export const conversationUrl = ({
  accountId,
  activeInbox,
  id,
  label,
Severity: Minor
Found in app/javascript/dashboard/helper/URLHelper.js - About 25 mins to fix

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

Severity
Category
Status
Source
Language