redmine/redmine

View on GitHub

Showing 1,181 of 1,181 total issues

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

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

class IssueQuery < Query
  class EstimatedRemainingHoursColumn < QueryColumn
    COLUMN_SQL = Arel.sql("COALESCE(#{Issue.table_name}.estimated_hours, 0) * (100 - COALESCE(#{Issue.table_name}.done_ratio, 0)) / 100")

    def initialize
Severity: Minor
Found in app/models/issue_query.rb - About 6 hrs to fix

    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

    File git_adapter.rb has 402 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'redmine/scm/adapters/abstract_adapter'
    
    module Redmine
      module Scm
        module Adapters
    Severity: Minor
    Found in lib/redmine/scm/adapters/git_adapter.rb - About 5 hrs to fix

      Method validate_issue has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

        def validate_issue
          if due_date && start_date && (start_date_changed? || due_date_changed?) && due_date < start_date
            errors.add :due_date, :greater_than_start_date
          end
      
      
      Severity: Minor
      Found in app/models/issue.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

      Function buildFilterRow has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

      function buildFilterRow(field, operator, values) {
        var fieldId = field.replace('.', '_');
        var filterTable = $("#filters-table");
        var filterOptions = availableFilters[field];
        if (!filterOptions) return;
      Severity: Minor
      Found in app/assets/javascripts/application.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 allowed_to_condition has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.allowed_to_condition(user, permission, options={})
          perm = Redmine::AccessControl.permission(permission)
          base_statement =
            if perm && perm.read?
              "#{Project.table_name}.status <> #{Project::STATUS_ARCHIVED} AND #{Project.table_name}.status <> #{Project::STATUS_SCHEDULED_FOR_DELETION}"
      Severity: Minor
      Found in app/models/project.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 format_object has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

        def format_object(object, html=true, &block)
          if block
            object = yield object
          end
          case object
      Severity: Minor
      Found in app/helpers/application_helper.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 issues_to_pdf has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

              def issues_to_pdf(issues, project, query)
                pdf = ITCPDF.new(current_language, "L")
                title = query.new_record? ? l(:label_issue_plural) : query.name
                title = "#{project} - #{title}" if project
                pdf.set_title(title)
      Severity: Minor
      Found in lib/redmine/export/pdf/issues_pdf_helper.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 lost_password has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

        def lost_password
          (redirect_to(home_url); return) unless Setting.lost_password?
          if prt = (params[:token] || session[:password_recovery_token])
            @token = Token.find_token("recovery", prt.to_s)
            if @token.nil?
      Severity: Minor
      Found in app/controllers/account_controller.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

      File repository.rb has 391 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class ScmFetchError < StandardError; end
      
      class Repository < ApplicationRecord
        include Redmine::Ciphering
        include Redmine::SafeAttributes
      Severity: Minor
      Found in app/models/repository.rb - About 5 hrs to fix

        Class AbstractAdapter has 40 methods (exceeds 20 allowed). Consider refactoring.
        Open

              class AbstractAdapter
                include Redmine::Utils::Shell
        
                # raised if scm command exited with error, e.g. unknown revision.
                class ScmCommandAborted < ::Redmine::Scm::Adapters::CommandFailed; end
        Severity: Minor
        Found in lib/redmine/scm/adapters/abstract_adapter.rb - About 5 hrs to fix

          Method customize_allowlist has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

                  def customize_allowlist(allowlist)
                    # Disallow `name` attribute globally, allow on `a`
                    allowlist[:attributes][:all].delete("name")
                    allowlist[:attributes]["a"].push("name")
          
          
          Severity: Minor
          Found in lib/redmine/wiki_formatting/common_mark/sanitization_filter.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 html_task has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
          Open

                def html_task(params, coords, markers, label, object)
                  output = +''
                  data_options = {}
                  if object
                    data_options[:collapse_expand] = "#{object.class}-#{object.id}".downcase
          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

          Class UserPreference has 39 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class UserPreference < ApplicationRecord
            include Redmine::SafeAttributes
          
            belongs_to :user
            serialize :others
          Severity: Minor
          Found in app/models/user_preference.rb - About 5 hrs to fix

            Class Version has 39 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Version < ApplicationRecord
              include Redmine::SafeAttributes
            
              after_update :update_issues_from_sharing_change
              after_save :update_default_project_version
            Severity: Minor
            Found in app/models/version.rb - About 5 hrs to fix

              Method safe_attributes= has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
              Open

                def safe_attributes=(attrs, user=User.current)
                  if attrs.respond_to?(:to_unsafe_hash)
                    attrs = attrs.to_unsafe_hash
                  end
              
              
              Severity: Minor
              Found in app/models/issue.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 bulk_update has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
              Open

                def bulk_update
                  @issues.sort!
                  @copy = params[:copy].present?
              
                  attributes = parse_params_for_bulk_update(params[:issue])
              Severity: Minor
              Found in app/controllers/issues_controller.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

              Severity
              Category
              Status
              Source
              Language