zammad/zammad

View on GitHub

Showing 2,064 of 4,422 total issues

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

  def fullname(email_fallback: true)
    name = "#{firstname} #{lastname}".strip

    if name.blank? && email.present? && email_fallback
      return email
Severity: Minor
Found in app/models/user.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 generate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.generate
    counter = Ticket::Counter.create_with(content: '0')
                             .find_or_create_by(generator: 'Increment')

    counter.with_lock do
Severity: Minor
Found in app/models/ticket/number/increment.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 update_image has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update_image
    logo_content = %i[logo logo_resize].each_with_object({}) do |key, memo|
      data = params[key]

      next if !data&.match? %r{^data:image}i
Severity: Minor
Found in app/controllers/settings_controller.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 show? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def show?
    return true if user.permissions?('admin.*')
    return true if own_account? # TODO: check if a customer user may really see all their fields.
    return true if user.permissions?('ticket.agent')
    # check same organization for customers
Severity: Minor
Found in app/policies/user_policy.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 base has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def base
    args = params.slice(:url, :locale_default, :timezone_default, :organization)

    %i[logo logo_resize].each do |key|
      data = params[key]
Severity: Minor
Found in app/controllers/getting_started_controller.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 private_key_add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def private_key_add
    string = params[:data]
    if string.blank? && params[:file].present?
      string = params[:file].read.force_encoding('utf-8')
    end
Severity: Minor
Found in app/controllers/integration/smime_controller.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def execute(image_data:)
    begin
      raise if image_data.nil?

      data = image_data.is_a?(String) ? ImageHelper.data_url_attributes(image_data) : image_data
Severity: Minor
Found in app/services/service/avatar/image_validate.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 check_single_row has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_single_row(row, value)
      message = case row[:type]
                when 'gt'
                  if ticket_count > value
                    "The limit of #{value} was exceeded with #{ticket_count} in the last #{given_periode}"
Severity: Minor
Found in lib/monitoring_helper/amount_check.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 synced? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def synced?
        return false if !@config

        UserInfo.current_user_id = 1

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

  def list
    assets = {}
    sessions_clean = []
    SessionHelper.list.each do |session|
      next if session.data['user_id'].blank?
Severity: Minor
Found in app/controllers/sessions_controller.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 verify_migrator! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def verify_migrator!(response)
    begin
      migrator = JSON.parse(response.body)
    rescue JSON::ParserError
      raise_unreachable_error
Severity: Minor
Found in app/services/service/system/import/apply_otrs_configuration.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 execute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def execute(token:)
    raise AutoWizardNotEnabledError if !AutoWizard.enabled?

    auto_wizard_data = AutoWizard.data
    if auto_wizard_data.blank?
Severity: Minor
Found in app/services/service/system/run_auto_wizard.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_map has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def translation_map(extracted_strings)
    sources = source_strings(extracted_strings)
    map = {}
    Locale.all.each do |locale|
      next if locale.locale.start_with?('en')
Severity: Minor
Found in lib/generators/zammad/translation_catalog/writer/form_js.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?

    # Remove doc comments
    string.gsub!(%r{^=begin.*?^=end}mx, '')
Severity: Minor
Found in lib/generators/zammad/translation_catalog/extractor/ruby.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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.log(url, request, response, options)
    return if !options[:log]

    # request
    request_data = {
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 process_option has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def process_option(tree_path, current_options, parent_tree_path = nil)
    fragments = tree_path.split('::')

    current_fragment = fragments.shift

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

    def self.config_set_verify_ssl(config, params)
      return if !config[:options]

      if params.key?(:ssl_verify)
        config[:options][:ssl_verify] = params[:ssl_verify]
Severity: Minor
Found in lib/email_helper/probe.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 check_present_missing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def check_present_missing(value)
    CHECK_PRESENT.each_with_object([]) do |(key, attrs), result|
      next if !value[key].is_a? Hash

      attrs.each do |attr|
Severity: Minor
Found in lib/validations/verify_perform_rules_validator.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 location has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.location(address)

    # check cache
    cache_key = "zammadgeocalendar::#{address}"
    cache = ::Rails.cache.read(cache_key)
Severity: Minor
Found in lib/service/geo_calendar/zammad.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_map has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def translation_map(extracted_strings)
    sources = source_strings(extracted_strings)
    map = {}
    Locale.all.each do |locale|
      next if locale.locale.start_with?('en')
Severity: Minor
Found in lib/generators/zammad/translation_catalog/writer/chat.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