chatwoot/chatwoot

View on GitHub

Showing 25 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

Expected item on line 5 to appear before line 4. Rule sets should be ordered as follows: @extends, @includes without @content, properties, @includes with @content, nested rule sets
Open

  @include custom-border-top(3px, transparent);

Use // comments everywhere
Open

/* Enter and leave animations can use different */

Color literals like rgba(0, 0, 0, 0.1) should only be used in variable declarations; they should be referred to via variable everywhere else.
Open

      box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.1);

Each selector in a comma sequence should be on its own single line
Open

      &.disabled:focus, &[disabled]:focus {

Expected item on line 4 to appear before line 3. Rule sets should be ordered as follows: @extends, @includes without @content, properties, @includes with @content, nested rule sets
Open

  @include flex-align($x: center, $y: middle);

Properties should be ordered opacity, transform
Open

  transform: translateY(-$space-small);

0px should be written without units as 0
Open

      box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.1);

Each selector in a comma sequence should be on its own single line
Open

      &.disabled, &[disabled],

Each selector in a comma sequence should be on its own single line
Open

      &:hover, &:focus {

Properties should be ordered color, font-size
Open

      font-size: $font-size-default;

Use // comments everywhere
Open

/* durations and timing functions.              */

Properties should be ordered opacity, transform
Open

  transform: translateY(-$space-medium);

Properties should be ordered align-items, color, display, font-size, font-weight
Open

    font-size: $font-size-small;
Severity
Category
Status
Source
Language