opf/openproject

View on GitHub

Showing 620 of 1,668 total issues

Method highlighting_mode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def highlighting_mode
      return :none unless EnterpriseToken.allows_to?(:conditional_highlighting)

      val = super

Severity: Minor
Found in app/models/query/highlighting.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

  def update
    call = attachable_update_call ::MeetingContents::UpdateService,
                                  model: @content,
                                  args: content_params

Severity: Minor
Found in modules/meeting/app/controllers/meeting_contents_controller.rb - About 25 mins 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 reorder_by_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def reorder_by_name
      @reorder_nested_set = nil
      return unless siblings.any?

      left_neighbor = left_neighbor_by_name_order
Severity: Minor
Found in app/models/projects/hierarchy.rb - About 25 mins 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 aliased_sorting_by_column_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def aliased_sorting_by_column_name
    sorting_by_column_name = query.sortable_key_by_column_name
    aliases = include_aliases
    reflections = reflection_includes

Severity: Minor
Found in app/models/query/results.rb - About 25 mins 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 selected_type_ids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def selected_type_ids(selectable_types, default_types = nil)
    if (ids = params[:type_ids])
      ids.is_a?(Array) ? ids.map(&:to_s) : ids.split("/")
    else
      (default_types || selectable_types).map { |t| t.id.to_s }
Severity: Minor
Found in app/controllers/versions_controller.rb - About 25 mins 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 careful_new_custom_field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.careful_new_custom_field(type)
      if /.+CustomField\z/.match?(type.to_s)
        klass = type.to_s.constantize
        klass.new if klass.ancestors.include? CustomField
      end
Severity: Minor
Found in app/services/custom_fields/create_service.rb - About 25 mins 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 icons has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def icons(result)
    icons = ""
    with_project(result.fields["project_id"]) do
      if entry_for(result).editable_by? User.current
        if controller_for(result.fields["type"]) == "costlog"
Severity: Minor
Found in modules/reporting/lib/widget/table/entry_table.rb - About 25 mins 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 state has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  get state() {

    if (this.mergeRequest.state === 'opened') {
      return (this.mergeRequest.draft ? 'open' : 'ready');
    } else {

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 render_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def render_options(group_by_ary)
    group_by_ary.sort_by(&:label).map do |group_by|
      next unless group_by.selectable?

      label_text = CGI::escapeHTML(h(group_by.label)).to_s
Severity: Minor
Found in modules/reporting/lib/widget/group_bys.rb - About 25 mins 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 error_message_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def error_message_list(objects)
          objects.map do |object|
            error_messages = []

            object.errors.each_error do |attr, error|
Severity: Minor
Found in lib/open_project/patches/action_view_accessible_errors.rb - About 25 mins 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 existing_rate_attributes= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def existing_rate_attributes=(rate_attributes)
    rates.reject(&:new_record?).each do |rate|
      attributes = rate_attributes[rate.id.to_s]

      has_rate = false
Severity: Minor
Found in modules/costs/app/models/cost_type.rb - About 25 mins 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 set_rate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def set_rate
    today = Date.today

    rate = @user.rate_at(today, @project)
    rate = HourlyRate.new if rate.nil? || rate.valid_from != today
Severity: Minor
Found in modules/costs/app/controllers/hourly_rates_controller.rb - About 25 mins 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 view_permissions? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def view_permissions?
        return false unless user_allowed_on_view?(:view_ifc_models)
        return false unless user_allowed_on_view?(:save_bcf_queries)
        if model.query.public && !user_allowed_on_view?(:manage_public_bcf_queries)
          return false
Severity: Minor
Found in modules/bim/app/contracts/bim/views/contract_strategy.rb - About 25 mins 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 rollback_attachment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def rollback_attachment(attachment)
        return unless attachment.file.path

        old_file = rolled_back_file_name attachment

Severity: Minor
Found in lib/tasks/shared/legacy_attachment.rb - About 25 mins 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 recognize_route has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.recognize_route(path)
      return nil unless path.present?

      # Remove relative URL root
      if (relative_url = OpenProject::Configuration.rails_relative_url_root)
Severity: Minor
Found in lib/open_project/static_routing.rb - About 25 mins 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 ifc_attachment_is_ifc has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def ifc_attachment_is_ifc
        return unless model.ifc_attachment&.new_record? || model.ifc_attachment&.pending_direct_upload?

        file_path = model.ifc_attachment.file.local_file.path

Severity: Minor
Found in modules/bim/app/contracts/bim/ifc_models/base_contract.rb - About 25 mins 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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def self.call(node, doc:, context:)
        content = node.to_html
        return unless applicable?(content)

        # Replace the content
Severity: Minor
Found in lib/open_project/text_formatting/matchers/regex_matcher.rb - About 25 mins 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_ar_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def to_ar_name(attribute, context:, refer_to_ids: false, collapse_cf_name: true)
          attribute = underscore_attribute attribute.to_s.underscore
          attribute = collapse_custom_field_name(attribute) if collapse_cf_name

          special_conversion = Constants::ARToAPIConversions.api_to_ar_conversions[attribute]
Severity: Minor
Found in lib/api/utilities/property_name_converter.rb - About 25 mins 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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def call
        return html unless applicable?

        html.gsub(self.class.regexp) do |matched_string|
          variable = ($1.presence || $2.presence).dup
Severity: Minor
Found in lib/open_project/text_formatting/filters/setting_macros_filter.rb - About 25 mins 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 parse_context has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

            def parse_context
              context = ::API::Utilities::ResourceLinkParser.parse(params[:context])

              if context.nil?
                fail ::API::Errors::InvalidRenderContext.new(
Severity: Minor
Found in lib/api/v3/render/render_api.rb - About 25 mins 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