redmine/redmine

View on GitHub

Showing 1,179 of 1,179 total issues

Method parse_redmine_links has a Cognitive Complexity of 225 (exceeds 5 allowed). Consider refactoring.
Open

  def parse_redmine_links(text, default_project, obj, attr, only_path, options)
    text.gsub!(LINKS_RE) do |_|
      tag_content = $~[:tag_content]
      leading = $~[:leading]
      esc = $~[:esc]
Severity: Minor
Found in app/helpers/application_helper.rb - About 4 days 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 issue.rb has 1622 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Issue < ApplicationRecord
  include Redmine::SafeAttributes
  include Redmine::Utils::DateCalculation
  include Redmine::I18n
  before_save :set_parent_id
Severity: Major
Found in app/models/issue.rb - About 4 days to fix

    File application_helper.rb has 1549 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'forwardable'
    require 'cgi'
    
    module ApplicationHelper
      include Redmine::WikiFormatting::Macros::Definitions
    Severity: Major
    Found in app/helpers/application_helper.rb - About 4 days to fix

      File query.rb has 1366 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class QueryColumn
        attr_accessor :name, :totalable, :default_order
        attr_writer   :sortable, :groupable
      
        include Redmine::I18n
      Severity: Major
      Found in app/models/query.rb - About 3 days to fix

        Class Issue has 152 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Issue < ApplicationRecord
          include Redmine::SafeAttributes
          include Redmine::Utils::DateCalculation
          include Redmine::I18n
          before_save :set_parent_id
        Severity: Major
        Found in app/models/issue.rb - About 3 days to fix

          File application.js has 1106 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * Redmine - project management software
           * Copyright (C) 2006-  Jean-Philippe Lang
           * This code is released under the GNU General Public License.
           */
          Severity: Major
          Found in app/assets/javascripts/application.js - About 2 days to fix

            File project.rb has 1005 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            class Project < ApplicationRecord
              include Redmine::SafeAttributes
              include Redmine::NestedSet::ProjectNestedSet
            
              # Project statuses
            Severity: Major
            Found in app/models/project.rb - About 2 days to fix

              Method show_detail has a Cognitive Complexity of 119 (exceeds 5 allowed). Consider refactoring.
              Open

                def show_detail(detail, no_html=false, options={})
                  multiple = false
                  show_diff = false
                  no_details = false
              
              
              Severity: Minor
              Found in app/helpers/issues_helper.rb - About 2 days 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 gantt.rb has 947 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Redmine
                module Helpers
                  # Simple class to handle gantt chart data
                  class Gantt
                    class MaxLinesLimitReached < StandardError
              Severity: Major
              Found in lib/redmine/helpers/gantt.rb - About 2 days to fix

                Method replace_transitions has a Cognitive Complexity of 109 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.replace_transitions(trackers, roles, transitions)
                    trackers = Array.wrap trackers
                    roles = Array.wrap roles
                
                    transaction do
                Severity: Minor
                Found in app/models/workflow_transition.rb - About 2 days 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 issue_to_pdf has a Cognitive Complexity of 106 (exceeds 5 allowed). Consider refactoring.
                Open

                        def issue_to_pdf(issue, assoc={})
                          pdf = ITCPDF.new(current_language)
                          pdf.set_title("#{issue.project} - #{issue.tracker} ##{issue.id}")
                          pdf.alias_nb_pages
                          pdf.footer_date = format_date(User.current.today)
                Severity: Minor
                Found in lib/redmine/export/pdf/issues_pdf_helper.rb - About 2 days 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 field_format.rb has 872 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require 'uri'
                
                module Redmine
                  module FieldFormat
                    def self.add(name, klass)
                Severity: Major
                Found in lib/redmine/field_format.rb - About 2 days to fix

                  Class Query has 106 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Query < ApplicationRecord
                    class StatementInvalid < ::ActiveRecord::StatementInvalid
                    end
                  
                    class QueryError < StandardError
                  Severity: Major
                  Found in app/models/query.rb - About 2 days to fix

                    Method parse_wiki_links has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def parse_wiki_links(text, project, obj, attr, only_path, options)
                        text.gsub!(/(!)?(\[\[([^\n\|]+?)(\|([^\n\|]+?))?\]\])/) do |m|
                          link_project = project
                          esc, all, page, title = $1, $2, $3, $5
                          if esc.nil?
                    Severity: Minor
                    Found in app/helpers/application_helper.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 redcloth3.rb has 788 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

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

                      File issue_query.rb has 773 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      class IssueQuery < Query
                        self.queried_class = Issue
                        self.view_permission = :view_issues
                      
                        self.available_columns = [
                      Severity: Major
                      Found in app/models/issue_query.rb - About 1 day to fix

                        Method prepare has 355 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            def self.prepare
                              ApplicationRecord.include Redmine::Acts::Positioned
                              ApplicationRecord.include Redmine::Acts::Mentionable
                              ApplicationRecord.include Redmine::I18n
                        
                        
                        Severity: Major
                        Found in lib/redmine/preparation.rb - About 1 day to fix

                          Class User has 92 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class User < Principal
                            include Redmine::Ciphering
                            include Redmine::SafeAttributes
                          
                            # Different ways of displaying/sorting users
                          Severity: Major
                          Found in app/models/user.rb - About 1 day to fix

                            File user.rb has 746 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            require "digest/sha1"
                            
                            class User < Principal
                              include Redmine::Ciphering
                              include Redmine::SafeAttributes
                            Severity: Major
                            Found in app/models/user.rb - About 1 day to fix

                              Method revisions has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
                              Open

                                      def revisions(path, identifier_from, identifier_to, options={})
                                        revs = Revisions.new
                                        cmd_args = %w|log --no-color --encoding=UTF-8 --raw --date=iso --pretty=fuller --parents --stdin|
                                        cmd_args << '--no-renames' if self.class.client_version_above?([2, 9])
                                        cmd_args << "--reverse" if options[:reverse]
                              Severity: Minor
                              Found in lib/redmine/scm/adapters/git_adapter.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

                              Severity
                              Category
                              Status
                              Source
                              Language