zammad/zammad

View on GitHub

Showing 2,064 of 4,422 total issues

Method request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def request(api_path:, params: nil)
    10.times do |iteration|
      response = perform_request(
        api_path: api_path,
        params:   params,
Severity: Minor
Found in lib/sequencer/unit/import/freshdesk/requester.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 utf8_encode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def utf8_encode(data)
      data.each do |key, value|
        next if !value
        next if !value.respond_to?(:utf8_encode)

Severity: Minor
Found in lib/import/helper.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 humanized_error has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.humanized_error(verb:, url:, response:, payload: nil)
    prefix = "Unable to process #{verb} request to elasticsearch URL '#{url}'."
    suffix = "\n\nResponse:\n#{response.inspect}\n\n"

    if payload.respond_to?(:to_json)
Severity: Minor
Found in lib/search_index_backend.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 dynamic_fields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def dynamic_fields(ticket)
        result = {}
        ticket.each_key do |key|

          key_string = key.to_s
Severity: Minor
Found in lib/import/otrs/ticket.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 extract_from_string has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def extract_from_string(string, filename)
    return if string.empty?

    # @T / @Ti
    literal_string_regex = %r{('|")(.+?)(?<!\\)\1}
Severity: Minor
Found in lib/generators/zammad/translation_catalog/extractor/frontend.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 missing_language_files? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def missing_language_files?

    skippable_locales = %w[en-us sr-latn-rs]

    Locale.all.each do |l|

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

  def provide(attribute, value = nil)
    if provideable?(attribute)
      value = yield if block_given?
      set(attribute, value)
    else
Severity: Minor
Found in lib/sequencer/state.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 request_result has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def request_result(params)
        tries ||= 1
        response = request_json(params)
        response['Result']
      rescue
Severity: Minor
Found in lib/import/otrs/requester.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 extract_from_string has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def extract_from_string(string, filename)
    return if string.empty?

    # zt() / t()
    literal_string_regex = %r{(['"])(.+?)(?<!\\)\1}
Severity: Minor
Found in lib/generators/zammad/translation_catalog/extractor/erb.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 onmessage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.onmessage(websocket, msg)
    client_id = websocket.object_id.to_s
    log 'info', "receiving #{msg.to_s.bytesize} bytes", client_id
    log 'debug', "received: #{msg}", client_id
    begin
Severity: Minor
Found in lib/websocket_server.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 log_status has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.log_status
    # websocket
    log 'info', "Status: websocket clients: #{@clients.size}"
    @clients.each_key do |client_id|
      log 'info', 'working...', client_id
Severity: Minor
Found in lib/websocket_server.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 missing_locale_entries? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def missing_locale_entries?
    languages.each do |l|
      next if Locale.exists?(locale: l)

      strings = Translation.cached_strings_for_locale(l).values

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

  def self.handled_open_timeout(tries)
    tries ||= 1

    tries.times do |index|
      yield
Severity: Minor
Found in lib/user_agent.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 sum_deeply has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def sum_deeply(existing:, additions:)
    return existing if additions.nil?

    existing.merge(additions) do |_key, oldval, newval|
      if oldval.is_a?(Hash) || newval.is_a?(Hash)
Severity: Minor
Found in lib/sequencer/unit/import/common/import_job/statistics/update.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 strip_if_needed_next has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def strip_if_needed_next(node, content)
        return content if !node.parent
        return content if node.previous
        return content if node.next && %w[div p br].exclude?(node.next.name)

Severity: Minor
Found in lib/html_sanitizer/scrubber/cleanup.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 article_created_and_updated_by_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def article_created_and_updated_by_id(article)
        return {} if article['SenderType'] != 'customer'

        created_by_id = get_article_created_by_id(article)
        return {} if get_article_created_by_id(article) != 1
Severity: Minor
Found in lib/import/otrs/article.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 asset_needed_by_updated_at? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def asset_needed_by_updated_at?(class_name, record_id, updated_at)
    return true if @asset_lookup.blank?
    return true if @asset_lookup[class_name].blank?
    return true if @asset_lookup[class_name][record_id].blank?
    return true if @asset_lookup[class_name][record_id][:updated_at] < updated_at
Severity: Minor
Found in lib/sessions/backend/base.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 translation_ids_for_answers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def translation_ids_for_answers(user)
    scope = KnowledgeBase::Answer
      .joins(:category)
      .where(knowledge_base_categories: { knowledge_base_id: knowledge_bases })
      .then do |relation|
Severity: Minor
Found in lib/search_knowledge_base_backend.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 aggs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.aggs(params_origin)
    params = params_origin.deep_dup

    selector = params[:selector]['ticket.group_id']

Severity: Minor
Found in lib/report/ticket_moved.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 build_style has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def build_style(input)
        style = 'max-width:100%;'

        return style if input.blank?

Severity: Minor
Found in lib/html_sanitizer/scrubber/image_size.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

Severity
Category
Status
Source
Language