zammad/zammad

View on GitHub

Showing 2,064 of 4,422 total issues

Function _create has 203 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _create: function() {
        // Some browsers only repeat keydown events, not keypress events,
        // so we use the suppressKeyPress flag to determine if we've already
        // handled the keydown event. #7269
        // Unfortunately the code for & in keypress is the same as the up arrow,
Severity: Major
Found in app/assets/javascripts/app/lib/core/jquery-ui-1.11.4.js - About 1 day to fix

    File tooltip.js has 499 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* ========================================================================
     * Bootstrap: tooltip.js v3.4.1
     * https://getbootstrap.com/docs/3.4/javascript/#tooltip
     * Inspired by the original jQuery.tipsy by Jason Frame
     * ========================================================================
    Severity: Minor
    Found in app/assets/javascripts/app/lib/bootstrap/tooltip.js - About 1 day to fix

      Method to_article has 199 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def to_article(params, user, ticket, channel, article = nil)
      
          if article
            Rails.logger.debug { 'Update article from message...' }
          else
      Severity: Major
      Found in lib/telegram_helper.rb - About 7 hrs to fix

        Method condition_query has 198 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def condition_query(block_condition)
            query_must     = []
            query_must_not = []
        
            current_user = options[:current_user]
        Severity: Major
        Found in lib/selector/search_index.rb - About 7 hrs to fix

          Method stream has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.stream
              Thread.abort_on_exception = true
          
              auto_reconnect_after = 180
              delay_before_reconnect = 70
          Severity: Minor
          Found in app/models/channel.rb - About 7 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

          File log.rb has 493 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          module Cti
            class Log < ApplicationModel
              include HasSearchIndexBackend
          
              self.table_name = 'cti_logs'
          Severity: Minor
          Found in app/models/cti/log.rb - About 7 hrs to fix

            Method search has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
            Open

                  def search(params)
            
                    # get params
                    query = params[:query]
                    limit = params[:limit] || 10
            Severity: Minor
            Found in app/models/user/search.rb - About 7 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 init has 190 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function init(plot) {
                    var selection = {
                            first: { x: -1, y: -1}, second: { x: -1, y: -1},
                            show: false,
                            active: false
            Severity: Major
            Found in app/assets/javascripts/app/lib/flot/jquery.flot.selection.js - About 7 hrs to fix

              File jquery.contenteditable.js has 482 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              (function ($) {
              
              /*
              # mode:          textonly/richtext / disable b/i/u/enter + strip on paste
              # pasteOnlyText: true
              Severity: Minor
              Found in app/assets/javascripts/app/lib/base/jquery.contenteditable.js - About 7 hrs to fix

                Function drawSeriesLines has 187 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function drawSeriesLines(series) {
                            function plotLine(datapoints, xoffset, yoffset, axisx, axisy) {
                                var points = datapoints.points,
                                    ps = datapoints.pointsize,
                                    prevx = null, prevy = null;
                Severity: Major
                Found in app/assets/javascripts/app/lib/flot/jquery.flot.js - About 7 hrs to fix

                  Method param_cleanup has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def param_cleanup(params, new_object = false, inside_nested = false, exceptions = true)
                  
                        if params.respond_to?(:permit!)
                          params = params.permit!.to_h
                        end
                  Severity: Minor
                  Found in app/models/application_model/can_cleanup_param.rb - About 7 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 d has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def d(key, escape = nil, escaping: true)
                  
                      # do validation, ignore some methods
                      return "\#{#{key} / not allowed}" if !data_key_valid?(key)
                  
                  
                  Severity: Minor
                  Found in lib/notification_factory/renderer.rb - About 7 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 clone_attachments has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def clone_attachments(object_type, object_id, options = {})
                      existing_attachments = Store.list(
                        object: object_type,
                        o_id:   object_id,
                      )
                  Severity: Minor
                  Found in app/models/concerns/can_clone_attachments.rb - About 7 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 set_attributes_by_x_headers has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def set_attributes_by_x_headers(item_object, header_name, mail, suffix = false)
                  
                      # loop all x-zammad-header-* headers
                      item_object.attributes.each_key do |key|
                  
                  
                  Severity: Minor
                  Found in app/models/channel/email_parser.rb - About 7 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 load_data has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.load_data(params)
                      nice = params[:nice] || 0.5
                  
                      object_manager_attributes = params[:object_manager_attributes]
                      agents                    = params[:agents] || 0
                  Severity: Minor
                  Found in lib/fill_db.rb - About 7 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 useEmailInboundForm has 181 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export const useEmailInboundForm = () => {
                    const formEmailInbound: ShallowRef<FormRef | undefined> = shallowRef()
                  
                    const { values, updateFieldValues, formSetErrors, onChangedField } =
                      useForm<EmailInboundData>(formEmailInbound)

                    File ticket-mocks.ts has 464 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
                    
                    import { mockGraphQLApi } from '#tests/support/mock-graphql-api.ts'
                    import { nullableMock } from '#tests/support/utils.ts'
                    
                    

                      Function Deferred has 178 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          Deferred: function( func ) {
                              var tuples = [
                      
                                      // action, add listener, callbacks,
                                      // ... .then handlers, argument index, [final state]
                      Severity: Major
                      Found in app/assets/javascripts/app/lib/core/jquery-3.6.0.js - About 7 hrs to fix

                        File user_agent.rb has 463 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'net/http'
                        require 'net/https'
                        require 'net/ftp'
                        
                        class UserAgent
                        Severity: Minor
                        Found in lib/user_agent.rb - About 7 hrs to fix

                          Method perform_triggers has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def self.perform_triggers(ticket, article, triggers, item, options = {})
                              recursive = Setting.get('ticket_trigger_recursive')
                              type = options[:type] || item[:type]
                              local_options = options.clone
                              local_options[:type] = type
                          Severity: Minor
                          Found in app/models/ticket.rb - About 7 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

                          Severity
                          Category
                          Status
                          Source
                          Language