zammad/zammad

View on GitHub

Showing 4,422 of 4,422 total issues

Function domTextBetween has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function domTextBetween(cm, from, to, fromLine, toLine) {
    var text = "", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false;
    function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
    function close() {
      if (closing) {
Severity: Minor
Found in app/assets/javascripts/app/lib/base/codemirror.js - About 1 hr to fix

    Function locateNodeInLineView has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function locateNodeInLineView(lineView, node, offset) {
        var wrapper = lineView.text.firstChild, bad = false;
        if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
        if (node == wrapper) {
          bad = true;
    Severity: Minor
    Found in app/assets/javascripts/app/lib/base/codemirror.js - About 1 hr to fix

      Function mousewheel has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          mousewheel: function(e) {
            if (this.disableMousewheel) {
              return;
            }
      
      
      Severity: Minor
      Found in app/assets/javascripts/app/lib/bootstrap/bootstrap-timepicker.js - About 1 hr to fix

        Function matcherFromTokens has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function matcherFromTokens( tokens ) {
            var checkContext, matcher, j,
                len = tokens.length,
                leadingRelative = Expr.relative[ tokens[ 0 ].type ],
                implicitRelative = leadingRelative || Expr.relative[ " " ],
        Severity: Minor
        Found in app/assets/javascripts/app/lib/core/jquery-3.6.0.js - About 1 hr to fix

          Function select has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          select = Sizzle.select = function( selector, context, results, seed ) {
              var i, tokens, token, type, find,
                  compiled = typeof selector === "function" && selector,
                  match = !seed && tokenize( ( selector = compiled.selector || selector ) );
          
          
          Severity: Minor
          Found in app/assets/javascripts/app/lib/core/jquery-3.6.0.js - About 1 hr to fix

            Method create_recipients has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.create_recipients(mail)
                max_count = 40
                current_count = 0
                %w[raw-to raw-cc].each do |item|
                  next if mail[item.to_sym].blank?
            Severity: Minor
            Found in app/models/channel/filter/identify_sender.rb - About 1 hr to fix

              Function articleTypeChangeHandler has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                const articleTypeChangeHandler = () => {
                  const executeHandler = (
                    execution: FormHandlerExecution,
                    schemaData: ReactiveFormSchemData,
                    changedField?: ChangedField,

                Function useNavigateOptions has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function useNavigateOptions(
                  items: Ref<unknown[]>,
                  onSelect: (item: unknown) => void,
                ) {
                  const selectedIndex = ref(0)

                  Method assets has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def assets(data = {})
                      return data if !authorized_asset?
                  
                      app_model = self.class.to_app_model
                  
                  
                  Severity: Minor
                  Found in app/models/application_model/can_assets.rb - About 1 hr 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 find_merge_follow_up_ticket has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.find_merge_follow_up_ticket(ticket)
                      return if ticket.state.name != 'merged'
                  
                      links = Link.list(
                        link_object:       'Ticket',
                  Severity: Minor
                  Found in app/models/channel/filter/follow_up_merged.rb - About 1 hr 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 extract has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def extract(remote_key, structure)
                        return if !structure
                  
                        information_source = structure.clone
                        result             = nil
                  Severity: Minor
                  Found in app/models/external_sync.rb - About 1 hr 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 assets has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def assets(data)
                  
                        app_model_sla = Sla.to_app_model
                  
                        if !data[ app_model_sla ]
                  Severity: Minor
                  Found in app/models/sla/assets.rb - About 1 hr 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_voip_users has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def load_voip_users
                      return {} if @config.blank? || @config[:api_token].blank?
                  
                      list = Rails.cache.read('placetelGetVoipUsers')
                      return list if list
                  Severity: Minor
                  Found in app/models/cti/driver/placetel.rb - About 1 hr 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 bot_duplicate? has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.bot_duplicate?(bot_id, channel_id = nil)
                      Channel.where(area: 'Telegram::Bot').each do |channel|
                        next if !channel.options
                        next if !channel.options[:bot]
                        next if !channel.options[:bot][:id]
                  Severity: Minor
                  Found in lib/telegram_helper.rb - About 1 hr 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 value_lookup has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def value_lookup(record, attribute, object, additional)
                      value = record[attribute.to_sym]
                      if attribute[-3, 3] == '_id'
                        ref = attribute[0, attribute.length - 3]
                        if record.respond_to?(ref.to_sym)
                  Severity: Minor
                  Found in lib/excel_sheet.rb - About 1 hr 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 useTicketSignature has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export const useTicketSignature = (ticket?: Ref<TicketById | undefined>) => {
                    const signatureQuery = getTicketSignatureQuery()
                  
                    const getValue = (
                      values: FormValues,
                  Severity: Minor
                  Found in app/frontend/shared/composables/useTicketSignature.ts - About 1 hr 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

                                      else if (e.shiftKey){
                                          newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
                                          newViewDate = this.moveMonth(focusDate, dir);
                                          this._trigger('changeMonth', this.viewDate);
                                      }
                  app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js on lines 1404..1419
                  app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js on lines 1432..1447
                  app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js on lines 1437..1447

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

                  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

                                      if (e.ctrlKey){
                                          newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir);
                                          newViewDate = this.moveYear(focusDate, dir);
                                          this._trigger('changeYear', this.viewDate);
                                      }
                  app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js on lines 1404..1419
                  app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js on lines 1409..1419
                  app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js on lines 1437..1447

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

                  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

                                      else if (e.shiftKey){
                                          newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir);
                                          newViewDate = this.moveMonth(focusDate, dir);
                                          this._trigger('changeMonth', this.viewDate);
                                      }
                  app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js on lines 1404..1419
                  app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js on lines 1409..1419
                  app/assets/javascripts/app/lib/bootstrap/bootstrap-datepicker.js on lines 1432..1447

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

                  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

                      for (var i = 0; i < chunk.lines.length; ++i) {
                        var line = chunk.lines[i];
                        if (line == lineObj) { break }
                        else { h += line.height; }
                      }
                  Severity: Major
                  Found in app/assets/javascripts/app/lib/base/codemirror.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/app/lib/base/codemirror.js on lines 1645..1649

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

                  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