zammad/zammad

View on GitHub

Showing 1,209 of 2,501 total issues

File types.ts has 2340 lines of code (exceeds 250 allowed). Consider refactoring.
Open

export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]?: Maybe<T[SubKey]> };
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & { [SubKey in K]: Maybe<T[SubKey]> };
Severity: Major
Found in app/frontend/shared/graphql/types.ts - About 6 days to fix

    File FieldTreeSelect.spec.ts has 1229 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
    
    import { cloneDeep, keyBy } from 'lodash-es'
    import {
      getAllByRole,

      File FieldTreeSelect.spec.ts has 1103 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
      
      import { cloneDeep, keyBy } from 'lodash-es'
      import { getByText, waitFor } from '@testing-library/vue'
      import { FormKit } from '@formkit/vue'

        File FieldSelect.spec.ts has 1092 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
        
        import type { SetRequired } from 'type-fest'
        import { cloneDeep, keyBy } from 'lodash-es'
        import {

          File FieldSelect.spec.ts has 1010 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
          
          import type { SetRequired } from 'type-fest'
          import { cloneDeep, keyBy } from 'lodash-es'
          import { getByText, waitFor } from '@testing-library/vue'

            File user.rb has 879 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class User < ApplicationModel
              include CanBeImported
              include HasActivityStreamLog
              include ChecksClientNotification
              include HasHistory
            Severity: Major
            Found in app/models/user.rb - About 2 days to fix

              File attribute.rb has 832 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              class ObjectManager::Attribute < ApplicationModel
                include HasDefaultModelUserRelations
              
                include ChecksClientNotification
                include CanSeed
              Severity: Major
              Found in app/models/object_manager/attribute.rb - About 2 days to fix

                Method csv_import has a Cognitive Complexity of 96 (exceeds 5 allowed). Consider refactoring.
                Open

                    def csv_import(data)
                      try    = data[:try].to_s == 'true'
                      delete = data[:delete].to_s == 'true'
                
                      begin
                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

                Method association_name_to_id_convert has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
                Open

                    def association_name_to_id_convert(params)
                
                      if params.respond_to?(:permit!)
                        params = params.permit!.to_h
                      end
                Severity: Minor
                Found in app/models/application_model/can_associations.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_parser.rb has 762 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                class Channel::EmailParser
                  include Channel::EmailHelper
                
                  PROCESS_TIME_MAX = 180
                  EMAIL_REGEX = %r{.+@.+}
                Severity: Major
                Found in app/models/channel/email_parser.rb - About 1 day to fix

                  File twitter_sync.rb has 762 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  require 'http/uri'
                  
                  class TwitterSync
                  
                    STATUS_URL_TEMPLATE = 'https://twitter.com/_/status/%s'.freeze
                  Severity: Major
                  Found in lib/twitter_sync.rb - About 1 day to fix

                    File search_index_backend.rb has 758 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    class SearchIndexBackend
                    
                      SUPPORTED_ES_VERSION_MINIMUM   = '7.8'.freeze
                      SUPPORTED_ES_VERSION_LESS_THAN = '9'.freeze
                    
                    
                    Severity: Major
                    Found in lib/search_index_backend.rb - About 1 day to fix

                      File guided-setup-manual-channel-email.spec.ts has 727 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
                      
                      import { getNode } from '@formkit/core'
                      import {
                        getByLabelText,

                        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 users_controller.rb has 698 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
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language