zammad/zammad

View on GitHub

Showing 4,422 of 4,422 total issues

Function ajax has 259 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    ajax: function( url, options ) {

        // If url is an object, simulate pre-1.5 signature
        if ( typeof url === "object" ) {
            options = url;
Severity: Major
Found in app/assets/javascripts/app/lib/core/jquery-3.6.0.js - About 1 day to fix

    Method associations_from_param has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
    Open

      def associations_from_param(params)
    
        # special handling for group access association
        {
          groups:    :group_names_access_map=,
    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 jquery.textmodule.js has 580 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    (function ($, window, undefined) {
    
    /*
    # mode: textonly/richtext / disable b/i/u/enter + strip on paste
    # pasteOnlyText: true
    Severity: Major
    Found in app/assets/javascripts/app/lib/base/jquery.textmodule.js - About 1 day to fix

      Method get_attachments has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
      Open

        def get_attachments(file, attachments, mail)
          return file.parts.map { |p| get_attachments(p, attachments, mail) } if file.parts.any?
          return [] if [mail.text_part&.body&.encoded, mail.html_part&.body&.encoded].include?(file.body.encoded)
          return [] if file.content_type&.start_with?('text/plain') && !file.attachment?
      
      
      Severity: Minor
      Found in app/models/channel/email_parser.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

      export type TicketOverviewUpdatesSubscription = { __typename?: 'Subscriptions', ticketOverviewUpdates: { __typename?: 'TicketOverviewUpdatesPayload', ticketOverviews?: { __typename?: 'OverviewConnection', edges: Array<{ __typename?: 'OverviewEdge', cursor: string, node: { __typename?: 'Overview', id: string, name: string, link: string, prio: number, orderBy: string, orderDirection: EnumOrderDirection, active: boolean, ticketCount?: number, viewColumns: Array<{ __typename?: 'KeyValue', key: string, value?: string | null }>, orderColumns: Array<{ __typename?: 'KeyValue', key: string, value?: string | null }> } }>, pageInfo: { __typename?: 'PageInfo', endCursor?: string | null, hasNextPage: boolean } } | null } };
      Severity: Major
      Found in app/frontend/shared/graphql/types.ts and 1 other location - About 1 day to fix
      app/frontend/shared/graphql/types.ts on lines 4721..4721

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

      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

      export type TicketOverviewsQuery = { __typename?: 'Queries', ticketOverviews: { __typename?: 'OverviewConnection', edges: Array<{ __typename?: 'OverviewEdge', cursor: string, node: { __typename?: 'Overview', id: string, name: string, link: string, prio: number, orderBy: string, orderDirection: EnumOrderDirection, active: boolean, ticketCount?: number, viewColumns: Array<{ __typename?: 'KeyValue', key: string, value?: string | null }>, orderColumns: Array<{ __typename?: 'KeyValue', key: string, value?: string | null }> } }>, pageInfo: { __typename?: 'PageInfo', endCursor?: string | null, hasNextPage: boolean } } };
      Severity: Major
      Found in app/frontend/shared/graphql/types.ts and 1 other location - About 1 day to fix
      app/frontend/shared/graphql/types.ts on lines 4357..4357

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

      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

      Class User has 66 methods (exceeds 20 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 renderBase has 240 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            ZammadChat.prototype.renderBase = function() {
              this.el = $(this.view('chat')({
                title: this.options.title,
                scrollHint: this.options.scrollHint
              }));
        Severity: Major
        Found in public/assets/chat/chat.js - About 1 day to fix

          Method fetch has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
          Open

            def fetch(options, channel, check_type = '', verify_string = '')
              ssl = true
              if options[:ssl] == 'off'
                ssl = false
              end
          Severity: Minor
          Found in app/models/channel/driver/pop3.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 build has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.build(attr, notification = false)
              mail = Mail.new
          
              # set headers
              attr.each do |key, value|
          Severity: Minor
          Found in app/models/channel/email_build.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 references has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.references(object_name, object_id, include_zero = false)
              object_name = object_name.to_s
          
              # check if model exists
              object_name.constantize.find(object_id)
          Severity: Minor
          Found in lib/models.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

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

          describe('Form - Field - Toggle List', () => {
            it('renders given options', async () => {
              const wrapper = await renderToggleListInput()
          
              const selectOptions = wrapper.getAllByRole('listitem')
          app/frontend/apps/desktop/components/Form/fields/FieldRadioList/__tests__/FieldRadioList.spec.ts on lines 62..90

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

          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

          describe('Form - Field - Radio List', () => {
            it('renders given options', async () => {
              const wrapper = await renderRadioListInput()
          
              const selectOptions = wrapper.getAllByRole('radio')
          app/frontend/apps/desktop/components/Form/fields/FieldToggleList/__tests__/FieldToggleList.spec.ts on lines 62..90

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

          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

          Method _process has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
          Open

            def _process(channel, msg)
          
              # parse email
              mail = parse(msg)
          
          
          Severity: Minor
          Found in app/models/channel/email_parser.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

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

          export type AutocompleteSearchRecipientEntry = {
            __typename?: 'AutocompleteSearchRecipientEntry';
            disabled?: Maybe<Scalars['Boolean']['output']>;
            heading?: Maybe<Scalars['String']['output']>;
            headingPlaceholder?: Maybe<Array<Scalars['String']['output']>>;
          Severity: Major
          Found in app/frontend/shared/graphql/types.ts and 3 other locations - About 1 day to fix
          app/frontend/shared/graphql/types.ts on lines 115..125
          app/frontend/shared/graphql/types.ts on lines 152..162
          app/frontend/shared/graphql/types.ts on lines 200..210

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

          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 4 locations. Consider refactoring.
          Open

          export type AutocompleteSearchOrganizationEntry = {
            __typename?: 'AutocompleteSearchOrganizationEntry';
            disabled?: Maybe<Scalars['Boolean']['output']>;
            heading?: Maybe<Scalars['String']['output']>;
            headingPlaceholder?: Maybe<Array<Scalars['String']['output']>>;
          Severity: Major
          Found in app/frontend/shared/graphql/types.ts and 3 other locations - About 1 day to fix
          app/frontend/shared/graphql/types.ts on lines 115..125
          app/frontend/shared/graphql/types.ts on lines 175..185
          app/frontend/shared/graphql/types.ts on lines 200..210

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

          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 4 locations. Consider refactoring.
          Open

          export type AutocompleteSearchUserEntry = {
            __typename?: 'AutocompleteSearchUserEntry';
            disabled?: Maybe<Scalars['Boolean']['output']>;
            heading?: Maybe<Scalars['String']['output']>;
            headingPlaceholder?: Maybe<Array<Scalars['String']['output']>>;
          Severity: Major
          Found in app/frontend/shared/graphql/types.ts and 3 other locations - About 1 day to fix
          app/frontend/shared/graphql/types.ts on lines 115..125
          app/frontend/shared/graphql/types.ts on lines 152..162
          app/frontend/shared/graphql/types.ts on lines 175..185

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

          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 4 locations. Consider refactoring.
          Open

          export type AutocompleteSearchMergeTicketEntry = {
            __typename?: 'AutocompleteSearchMergeTicketEntry';
            disabled?: Maybe<Scalars['Boolean']['output']>;
            heading?: Maybe<Scalars['String']['output']>;
            headingPlaceholder?: Maybe<Array<Scalars['String']['output']>>;
          Severity: Major
          Found in app/frontend/shared/graphql/types.ts and 3 other locations - About 1 day to fix
          app/frontend/shared/graphql/types.ts on lines 152..162
          app/frontend/shared/graphql/types.ts on lines 175..185
          app/frontend/shared/graphql/types.ts on lines 200..210

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

          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

          $.noty.layouts.bottomCenter = {
              name     : 'bottomCenter',
              options  : { // overrides options
          
              },
          Severity: Major
          Found in app/assets/javascripts/app/lib/base/jquery.noty.js and 1 other location - About 1 day to fix
          app/assets/javascripts/app/lib/base/jquery.noty.js on lines 932..968

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

          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

          $.noty.layouts.topCenter = {
              name     : 'topCenter',
              options  : { // overrides options
          
              },
          Severity: Major
          Found in app/assets/javascripts/app/lib/base/jquery.noty.js and 1 other location - About 1 day to fix
          app/assets/javascripts/app/lib/base/jquery.noty.js on lines 588..624

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

          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

          Severity
          Category
          Status
          Source
          Language