redmine/redmine

View on GitHub

Showing 1,184 of 1,184 total issues

Method aggregate has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def aggregate(data, criteria)
    a = 0
    data.each do |row|
      match = 1
      criteria.each do |k, v|
Severity: Minor
Found in app/helpers/reports_helper.rb - About 3 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 diff has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def diff
    if params[:format] == 'diff'
      @diff = @repository.diff(@path, @rev, @rev_to)
      (show_error_not_found; return) unless @diff
      filename = +"changeset_r#{@rev}"
Severity: Minor
Found in app/controllers/repositories_controller.rb - About 3 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 retrieve_previous_and_next_issue_ids has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def retrieve_previous_and_next_issue_ids
    if params[:prev_issue_id].present? || params[:next_issue_id].present?
      @prev_issue_id = params[:prev_issue_id].presence.try(:to_i)
      @next_issue_id = params[:next_issue_id].presence.try(:to_i)
      @issue_position = params[:issue_position].presence.try(:to_i)
Severity: Minor
Found in app/controllers/issues_controller.rb - About 3 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 24 (exceeds 5 allowed). Consider refactoring.
Open

        def entries(path="", identifier=nil, options={})
          entries = Entries.new
          trgt_utf8 = target(path)
          trgt = scm_iconv(@path_encoding, 'UTF-8', trgt_utf8)
          Dir.new(trgt).each do |e1|
Severity: Minor
Found in lib/redmine/scm/adapters/filesystem_adapter.rb - About 3 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 24 (exceeds 5 allowed). Consider refactoring.
Open

        def entries(path=nil, identifier=nil, options={})
          path ||= ''
          identifier = (identifier and identifier.to_i > 0) ? identifier.to_i : "HEAD"
          entries = Entries.new
          cmd = +"#{self.class.sq_bin} list --xml #{target(path)}@#{identifier}"
Severity: Minor
Found in lib/redmine/scm/adapters/subversion_adapter.rb - About 3 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 24 (exceeds 5 allowed). Consider refactoring.
Open

        def entries(path=nil, identifier=nil, options={})
          path ||= ''
          entries = Entries.new
          identifier = -1 unless identifier && identifier.to_i > 0
          cmd_args = %w|ls -v --show-ids|
Severity: Minor
Found in lib/redmine/scm/adapters/bazaar_adapter.rb - About 3 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 drawRevisionGraph has 84 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function drawRevisionGraph(holder, commits_hash, graph_space) {
    var XSTEP = 20,
        CIRCLE_INROW_OFFSET = 10;
    var commits_by_scmid = commits_hash,
        commits = $.map(commits_by_scmid, function(val,i){return val;});
Severity: Major
Found in app/assets/javascripts/revision_graph.js - About 3 hrs to fix

    Class WikiPage has 28 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class WikiPage < ApplicationRecord
      include Redmine::SafeAttributes
    
      belongs_to :wiki
      has_one :content, :class_name => 'WikiContent', :foreign_key => 'page_id',
    Severity: Minor
    Found in app/models/wiki_page.rb - About 3 hrs to fix

      Class AccountController has 28 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class AccountController < ApplicationController
        helper :custom_fields
        include CustomFieldsHelper
      
        self.main_menu = false
      Severity: Minor
      Found in app/controllers/account_controller.rb - About 3 hrs to fix

        Method initialize has 83 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def initialize
            self.issue_attributes = {}
        
            optparse = OptionParser.new do |opts|
              opts.banner = "Usage: rdm-mailhandler.rb [options] --url=<Redmine URL> --key=<API key>"
        Severity: Major
        Found in extra/mail_handler/rdm-mailhandler.rb - About 3 hrs to fix

          Method calc_col_width has 83 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def calc_col_width(issues, query, table_width, pdf)
                    # calculate statistics
                    #  by captions
                    pdf.SetFontStyle('B', 8)
                    margins = pdf.get_margins
          Severity: Major
          Found in lib/redmine/export/pdf/issues_pdf_helper.rb - About 3 hrs to fix

            Method receive has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

              def receive(email, options={})
                @email = email
                @handler_options = options
                sender_email = email.from.to_a.first.to_s.strip
                # Ignore emails received from the application emission address to avoid hell cycles
            Severity: Minor
            Found in app/models/mail_handler.rb - About 3 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 details_to_strings has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

              def details_to_strings(details, no_html=false, options={})
                options[:only_path] = !(options[:only_path] == false)
                strings = []
                values_by_field = {}
                details.each do |detail|
            Severity: Minor
            Found in app/helpers/issues_helper.rb - About 3 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 update has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

              def update
                return unless update_issue_from_params
            
                attachments = params[:attachments] || params.dig(:issue, :uploads)
                if @issue.attachments_addable?
            Severity: Minor
            Found in app/controllers/issues_controller.rb - About 3 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 retrieve_query has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

              def retrieve_query(klass=IssueQuery, use_session=true, options={})
                session_key = klass.name.underscore.to_sym
            
                if params[:query_id].present?
                  scope = klass.where(:project_id => nil)
            Severity: Minor
            Found in app/helpers/queries_helper.rb - About 3 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 inline_textile_link has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                def inline_textile_link( text )
                    text.gsub!( LINK_RE ) do |m|
                      all,pre,atts,text,title,url,proto,slash,post = $~[1..9]
                      if text.include?('<br />')
                        all
            Severity: Minor
            Found in lib/redmine/wiki_formatting/textile/redcloth3.rb - About 3 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_html has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                  def to_html
                    words = self.words.collect{|word| h(word)}
                    words_add = 0
                    words_del = 0
                    dels = 0
            Severity: Minor
            Found in lib/redmine/helpers/diff.rb - About 3 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 lcs has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                  def Diff.lcs(a, b)
                    astart = 0
                    bstart = 0
                    afinish = a.length-1
                    bfinish = b.length-1
            Severity: Minor
            Found in lib/redmine/string_array_diff/diff.rb - About 3 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 23 (exceeds 5 allowed). Consider refactoring.
            Open

                  def check(imap_options={}, options={})
                    host = imap_options[:host] || '127.0.0.1'
                    port = imap_options[:port] || '143'
                    ssl = !imap_options[:ssl].nil?
                    starttls = !imap_options[:starttls].nil?
            Severity: Minor
            Found in lib/redmine/imap.rb - About 3 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 80 lines of code (exceeds 25 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: Major
            Found in app/models/project.rb - About 3 hrs to fix
              Severity
              Category
              Status
              Source
              Language