redmine/redmine

View on GitHub

Showing 945 of 1,179 total issues

File jstoolbar.js has 465 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * This file is part of DotClear.
 * Copyright (c) 2005 Nicolas Martin & Olivier Meunier and contributors. All rights reserved.
 * This code is released under the GNU General Public License.
 *
Severity: Minor
Found in app/assets/javascripts/jstoolbar/jstoolbar.js - About 7 hrs to fix

    Class Attachment has 50 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Attachment < ApplicationRecord
      include Redmine::SafeAttributes
      belongs_to :container, :polymorphic => true
      belongs_to :author, :class_name => "User"
    
    
    Severity: Minor
    Found in app/models/attachment.rb - About 7 hrs to fix

      Class Gantt has 50 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class Gantt
            class MaxLinesLimitReached < StandardError
            end
      
            include ERB::Util
      Severity: Minor
      Found in lib/redmine/helpers/gantt.rb - About 7 hrs to fix

        Method recalculate_attributes_for has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
        Open

          def recalculate_attributes_for(issue_id)
            if issue_id && p = Issue.find_by_id(issue_id)
              if p.priority_derived?
                # priority = highest priority of open children
                # priority is left unchanged if all children are closed and there's no default priority defined
        Severity: Minor
        Found in app/models/issue.rb - About 6 hrs 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 block_textile_lists has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
        Open

            def block_textile_lists( text )
                text.gsub!( LISTS_RE ) do |match|
                    lines = match.split( "\n" )
                    last_line = -1
                    depth = []
        Severity: Minor
        Found in lib/redmine/wiki_formatting/textile/redcloth3.rb - About 6 hrs 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 save_attachments has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
        Open

                def save_attachments(attachments, author=User.current)
                  if attachments.respond_to?(:to_unsafe_hash)
                    attachments = attachments.to_unsafe_hash
                  end
        
        
        Severity: Minor
        Found in lib/plugins/acts_as_attachable/lib/acts_as_attachable.rb - About 6 hrs 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 to_image has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
        Open

              def to_image(format='PNG')
                date_to = (@date_from >> @months) - 1
                show_weeks = @zoom > 1
                show_days = @zoom > 2
                subject_width = 400
        Severity: Minor
        Found in lib/redmine/helpers/gantt.rb - About 6 hrs 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 queries_helper.rb has 451 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'redmine/export/csv'
        
        module QueriesHelper
          include ApplicationHelper
        
        
        Severity: Minor
        Found in app/helpers/queries_helper.rb - About 6 hrs to fix

          Method rip_offtags has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
          Open

              def rip_offtags( text, escape_aftertag=true, escape_line=true )
                  if text =~ /<.*>/
                      ## strip and encode <pre> content
                      codepre, used_offtags = 0, {}
                      text.gsub!( OFFTAG_MATCH ) do |line|
          Severity: Minor
          Found in lib/redmine/wiki_formatting/textile/redcloth3.rb - About 6 hrs 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

          Class RedCloth3 has 48 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class RedCloth3 < String
              include Redmine::Helpers::URL
          
              VERSION = '3.0.4'
              DEFAULT_RULES = [:textile, :markdown]
          Severity: Minor
          Found in lib/redmine/wiki_formatting/textile/redcloth3.rb - About 6 hrs to fix

            File attachment.rb has 441 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require "digest"
            require "fileutils"
            require "zip"
            
            class Attachment < ApplicationRecord
            Severity: Minor
            Found in app/models/attachment.rb - About 6 hrs to fix

              Method validate_query_filters has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
              Open

                def validate_query_filters
                  filters.each_key do |field|
                    if values_for(field)
                      case type_for(field)
                      when :integer
              Severity: Minor
              Found in app/models/query.rb - About 6 hrs 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_relations has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
              Open

                def build_relations(row, item, issue)
                  IssueRelation::TYPES.each_key do |type|
                    has_delay = [IssueRelation::TYPE_PRECEDES, IssueRelation::TYPE_FOLLOWS].include?(type)
              
                    if decls = relation_values(row, "relation_#{type}")
              Severity: Minor
              Found in app/models/issue_import.rb - About 6 hrs 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 copy_issues has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
              Open

                def copy_issues(project)
                  # Stores the source issue id as a key and the copied issues as the
                  # value.  Used to map the two together for issue relations.
                  issues_map = {}
              
              
              Severity: Minor
              Found in app/models/project.rb - About 6 hrs 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 index has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
              Open

                def index
                  @days = Setting.activity_days_default.to_i
              
                  if params[:from]
                    begin; @date_to = params[:from].to_date + 1; rescue; end
              Severity: Minor
              Found in app/controllers/activities_controller.rb - About 6 hrs 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 entries has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
              Open

                      def entries(path=nil, identifier=nil, options={})
                        path ||= ''
                        p = scm_iconv(@path_encoding, 'UTF-8', path)
                        entries = Entries.new
                        cmd_args = %w|ls-tree -l|
              Severity: Minor
              Found in lib/redmine/scm/adapters/git_adapter.rb - About 6 hrs 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 contextMenuClick has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

              function contextMenuClick(event) {
                var target = $(event.target);
                var lastSelected;
              
                if (target.is('a') && target.hasClass('submenu')) {
              Severity: Minor
              Found in app/assets/javascripts/context_menu.js - About 5 hrs 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 html_subject_content has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

                    def html_subject_content(object)
                      case object
                      when Issue
                        issue = object
                        css_classes = +''
              Severity: Minor
              Found in lib/redmine/helpers/gantt.rb - About 5 hrs 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 check has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
              Open

                    def check(pop_options={}, options={})
                      if pop_options[:ssl]
                        ssl = true
                        if pop_options[:ssl] == 'force'
                          Net::POP3.enable_ssl(OpenSSL::SSL::VERIFY_NONE)
              Severity: Minor
              Found in lib/redmine/pop3.rb - About 5 hrs 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

              Class IssueQuery has 43 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class IssueQuery < Query
                self.queried_class = Issue
                self.view_permission = :view_issues
              
                self.available_columns = [
              Severity: Minor
              Found in app/models/issue_query.rb - About 5 hrs to fix
                Severity
                Category
                Status
                Source
                Language