zammad/zammad

View on GitHub

Showing 2,063 of 4,240 total issues

Function change has 331 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    change: function (shiftKey, originalEvent) {
      var options = this.options;
      var aspectRatio = options.aspectRatio;
      var action = this.action;
      var container = this.container;
Severity: Major
Found in app/assets/javascripts/app/lib/base/cropper.js - About 1 day to fix

    Method condition_query has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
    Open

      def condition_query(block_condition)
        query_must     = []
        query_must_not = []
    
        current_user = options[:current_user]
    Severity: Minor
    Found in lib/selector/search_index.rb - About 1 day 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 ua-parser.js has 703 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /////////////////////////////////////////////////////////////////////////////////
    /* UAParser.js v1.0.34
       Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
       MIT License *//*
       Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.
    Severity: Major
    Found in app/assets/javascripts/app/lib/base/ua-parser.js - About 1 day to fix

      File bootstrap-tokenfield.js has 702 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*!
       * bootstrap-tokenfield
       * https://github.com/sliptree/bootstrap-tokenfield
       * Copyright 2013-2014 Sliptree and other contributors; Licensed MIT
       *
      Severity: Major
      Found in app/assets/javascripts/app/lib/base/bootstrap-tokenfield.js - About 1 day to fix

        File exif.js has 698 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        (function() {
        
            var debug = false;
        
            var root = this;
        Severity: Major
        Found in app/assets/javascripts/app/lib/base/exif.js - About 1 day to fix

          File users_controller.rb has 679 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class UsersController < ApplicationController
            include ChecksUserAttributesByCurrentUserPermission
            include CanPaginate
          
            prepend_before_action -> { authorize! }, only: %i[import_example import_start search history unlock]
          Severity: Major
          Found in app/controllers/users_controller.rb - About 1 day to fix

            Method config has 303 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.config
                config = {}
                config[:metric] = {}
            
                config[:metric][:count] = {
            Severity: Major
            Found in app/models/report.rb - About 1 day to fix

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

                def perform
              
                  # return if we run import mode
                  return if Setting.get('import_mode')
                  return if @item[:object] != 'Ticket'
              Severity: Minor
              Found in app/models/transaction/notification.rb - About 1 day 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 fill_db.rb has 666 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module FillDb
              
              =begin
              
              fill your database with demo records
              Severity: Major
              Found in lib/fill_db.rb - About 1 day to fix

                Function useTicketEditForm has 288 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const useTicketEditForm = (
                  ticket: Ref<TicketById | undefined>,
                  form: Ref<FormRef | undefined>,
                ) => {
                  const ticketArticleTypes = computed(() => {
                Severity: Major
                Found in app/frontend/apps/mobile/pages/ticket/composable/useTicketEditForm.ts - About 1 day to fix

                  File telegram_helper.rb has 645 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'telegram/bot'
                  
                  class TelegramHelper
                  
                    attr_accessor :client
                  Severity: Major
                  Found in lib/telegram_helper.rb - About 1 day to fix

                    Function useEmailChannelConfiguration has 282 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export const useEmailChannelConfiguration = (
                      emailChannelForms: EmailChannelForms,
                      metaInformationInbound: Ref<Maybe<EmailInboundMetaInformation>>,
                      updateMetaInformationInbound: UpdateMetaInformationInboundFunction,
                      onSuccessCallback: () => void,

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

                        def perform
                      
                          # return if we run import mode
                          return if Setting.get('import_mode')
                      
                      
                      Severity: Minor
                      Found in app/models/transaction/slack.rb - About 1 day 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_webhook has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def process_webhook(channel)
                          Rails.logger.debug { 'import tweet' }
                          ticket = nil
                          if @payload['direct_message_events'].present? && channel.options[:sync][:direct_messages][:group_id].present?
                            @payload['direct_message_events'].each do |item|
                      Severity: Minor
                      Found in lib/twitter_sync.rb - About 1 day 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 277 lines of code (exceeds 25 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: Major
                      Found in lib/fill_db.rb - About 1 day to fix

                        File qrcodegen.js has 624 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /*
                         * QR Code generator library (compiled from TypeScript)
                         *
                         * Copyright (c) Project Nayuki. (MIT License)
                         * https://www.nayuki.io/page/qr-code-generator-library
                        Severity: Major
                        Found in app/assets/javascripts/app/lib/base/qrcodegen.js - About 1 day to fix

                          Method run has a Cognitive Complexity of 69 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def self.run(_channel, mail, _transaction_params)
                          
                              return if mail[:'x-zammad-ticket-id']
                          
                              # get ticket# from subject
                          Severity: Minor
                          Found in app/models/channel/filter/follow_up_check.rb - About 1 day 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 email_helper.rb has 615 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          class EmailHelper
                          
                          =begin
                          
                          get available driver
                          Severity: Major
                          Found in lib/email_helper.rb - About 1 day to fix

                            Method csv_example has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def csv_example(params = {})
                                  header = []
                                  records = where.not(id: csv_object_ids_ignored).offset(1).limit(23).to_a
                                  if records.count < 20
                                    record_ids = records.pluck(:id).concat(csv_object_ids_ignored)
                            Severity: Minor
                            Found in app/models/concerns/can_csv_import.rb - About 1 day 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 setDocument has 262 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            setDocument = Sizzle.setDocument = function( node ) {
                                var hasCompare, subWindow,
                                    doc = node ? node.ownerDocument || node : preferredDoc;
                            
                                // Return early if doc is invalid or already selected
                            Severity: Major
                            Found in app/assets/javascripts/app/lib/core/jquery-3.6.0.js - About 1 day to fix
                              Severity
                              Category
                              Status
                              Source
                              Language