zammad/zammad

View on GitHub

Showing 4,240 of 4,240 total issues

File marked.js has 912 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * marked - a markdown parser
 * Copyright (c) 2011-2014, Christopher Jeffrey. (MIT Licensed)
 * https://github.com/chjj/marked
 */
Severity: Major
Found in app/assets/javascripts/app/lib/base/marked.js - About 2 days to fix

    File tinycolor.js has 902 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // TinyColor v1.4.1
    // https://github.com/bgrins/TinyColor
    // Brian Grinstead, MIT License
    
    (function(Math) {
    Severity: Major
    Found in app/assets/javascripts/app/lib/base/tinycolor.js - About 2 days to fix

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

      !function(root, factory) {
           if (typeof define === 'function' && define.amd) {
               define(['jquery'], factory);
           } else if (typeof exports === 'object') {
               module.exports = factory(require('jquery'));
      Severity: Major
      Found in app/assets/javascripts/app/lib/base/jquery.noty.js - 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

          File user.rb has 808 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 1 day to fix

            Function addEditorMethods has 378 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function addEditorMethods(CodeMirror) {
                var optionHandlers = CodeMirror.optionHandlers;
            
                var helpers = CodeMirror.helpers = {};
            
            
            Severity: Major
            Found in app/assets/javascripts/app/lib/base/codemirror.js - About 1 day to fix

              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-addresses.js has 775 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              
              // email-addresses.js - RFC 5322 email address parser
              // v 3.0.1
              //
              // http://tools.ietf.org/html/rfc5322
              Severity: Major
              Found in app/assets/javascripts/app/lib/base/email-addresses.js - About 1 day to fix

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

                    ZammadChat.prototype.pasteHtmlAtCaret = function(html) {
                      var el, frag, lastNode, node, range, sel;
                      sel = void 0;
                      range = void 0;
                      if (window.getSelection) {
                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 2547..2574

                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 325.

                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

                    ZammadChat.prototype.pasteHtmlAtCaret = function(html) {
                      var el, frag, lastNode, node, range, sel;
                      sel = void 0;
                      range = void 0;
                      if (window.getSelection) {
                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 2550..2577

                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 325.

                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 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

                    Function jsonlint has 357 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    var jsonlint = (function(){
                    var parser = {trace: function trace() { },
                    yy: {},
                    symbols_: {"error":2,"JSONString":3,"STRING":4,"JSONNumber":5,"NUMBER":6,"JSONNullLiteral":7,"NULL":8,"JSONBooleanLiteral":9,"TRUE":10,"FALSE":11,"JSONText":12,"JSONValue":13,"EOF":14,"JSONObject":15,"JSONArray":16,"{":17,"}":18,"JSONMemberList":19,"JSONMember":20,":":21,",":22,"[":23,"]":24,"JSONElementList":25,"$accept":0,"$end":1},
                    terminals_: {2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},
                    Severity: Major
                    Found in app/assets/javascripts/app/lib/base/jsonlint.js - About 1 day to fix

                      File search_index_backend.rb has 755 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

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

                          it('supports element focusing', async () => {
                            const wrapper = renderComponent(FormKit, {
                              ...wrapperParameters,
                              props: {
                                ...commonProps,
                        app/frontend/apps/desktop/components/Form/fields/FieldAutoComplete/__tests__/FieldAutoComplete.spec.ts on lines 995..1038

                        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 317.

                        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 element focusing', async () => {
                            const wrapper = renderComponent(FormKit, {
                              ...wrapperParameters,
                              props: {
                                ...testProps,
                        app/frontend/apps/desktop/components/Form/fields/FieldSelect/__tests__/FieldSelect.spec.ts on lines 1112..1155

                        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 317.

                        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

                            ZammadChat.prototype.T = function() {
                              var item, items, j, len, string, translations;
                              string = arguments[0], items = 2 <= arguments.length ? slice.call(arguments, 1) : [];
                              if (this.options.lang && this.options.lang !== 'en') {
                                if (!this.translations[this.options.lang]) {
                        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 1300..1321

                        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 316.

                        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

                            ZammadChat.prototype.T = function() {
                              var item, items, j, len, string, translations;
                              string = arguments[0], items = 2 <= arguments.length ? slice.call(arguments, 1) : [];
                              if (this.options.lang && this.options.lang !== 'en') {
                                if (!this.translations[this.options.lang]) {
                        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 1321..1342

                        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 316.

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