zammad/zammad

View on GitHub

Showing 4,240 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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        _adjustOffsetFromHelper: function(obj) {
            if (typeof obj === "string") {
                obj = obj.split(" ");
            }
            if (Array.isArray(obj)) {
    Severity: Major
    Found in app/assets/javascripts/app/lib/core/jquery-ui-1.11.4.js and 1 other location - About 1 day to fix
    app/assets/javascripts/app/lib/core/jquery-ui-1.11.4.js on lines 1933..1952

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 296.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        _adjustOffsetFromHelper: function(obj) {
            if (typeof obj === "string") {
                obj = obj.split(" ");
            }
            if (Array.isArray(obj)) {
    Severity: Major
    Found in app/assets/javascripts/app/lib/core/jquery-ui-1.11.4.js and 1 other location - About 1 day to fix
    app/assets/javascripts/app/lib/core/jquery-ui-1.11.4.js on lines 4028..4047

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 296.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('can show inbound configuration form when roundtrip is unsuccessful', async () => {
          const view = await visitView('/guided-setup/manual/channels/email')
    
          const accountForm = view.getByTestId('channel-email-account')
    
    
    app/frontend/apps/desktop/pages/guided-setup/__tests__/guided-setup-manual-channel-email.spec.ts on lines 502..560

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 296.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        it('can show outbound configuration form when roundtrip is unsuccessful', async () => {
          const view = await visitView('/guided-setup/manual/channels/email')
    
          const accountForm = view.getByTestId('channel-email-account')
    
    
    app/frontend/apps/desktop/pages/guided-setup/__tests__/guided-setup-manual-channel-email.spec.ts on lines 235..290

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 296.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      Timeout.prototype.start = function() {
                        var check, timeoutStartedAt;
                        this.stop();
                        timeoutStartedAt = new Date;
                        check = (function(_this) {
                  Severity: Major
                  Found in public/assets/chat/chat-no-jquery.js and 1 other location - About 1 day to fix
                  public/assets/chat/chat.js on lines 751..769

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 265.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                      Timeout.prototype.start = function() {
                        var check, timeoutStartedAt;
                        this.stop();
                        timeoutStartedAt = new Date;
                        check = (function(_this) {
                  Severity: Major
                  Found in public/assets/chat/chat.js and 1 other location - About 1 day to fix
                  public/assets/chat/chat-no-jquery.js on lines 772..790

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 265.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  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

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      it('supports clearing of the existing value when option goes away', async () => {
                        const optionsProp = cloneDeep(testOptions)
                    
                        optionsProp.push({
                          value: 10,
                    app/frontend/apps/desktop/components/Form/fields/FieldSelect/__tests__/FieldSelect.spec.ts on lines 172..206

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 264.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Similar blocks of code found in 2 locations. Consider refactoring.
                    Open

                      it('supports clearing of the existing value when option goes away', async () => {
                        const optionsProp = cloneDeep(testOptions)
                    
                        optionsProp.push({
                          value: 3,
                    app/frontend/apps/desktop/components/Form/fields/FieldTreeSelect/__tests__/FieldTreeSelect.spec.ts on lines 366..400

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 264.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    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,
                      Severity
                      Category
                      Status
                      Source
                      Language