opf/openproject

View on GitHub

Showing 628 of 1,682 total issues

Method replacenextlarger has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def replacenextlarger(value, high = nil)
    high ||= length
    if empty? || value > self[-1]
      push value
      return high
Severity: Minor
Found in lib_static/redmine/diff/diffable.rb - About 55 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 makediff has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def makediff(a, b)
    mvector = self.class.lcs(a, b)
    ai = bi = 0
    while ai < mvector.length
      bline = mvector[ai]
Severity: Minor
Found in lib_static/redmine/diff/array_string_diff.rb - About 55 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 compare has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  def compare(first, second)
    first  = Array(first).flatten
    second = Array(second).flatten
    first.zip second do |a, b|
      return (a <=> b) || (a == Infinity ? 1 : -1) if a != b
Severity: Minor
Found in modules/reporting/lib/report/query_utils.rb - About 55 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 load_custom_values_values has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

          def load_custom_values_values(work_package)
            work_package.custom_values.each do |cv|
              next unless cv.custom_field && cv.value.present?

              loaded_value = case cv.custom_field.field_format
Severity: Minor
Found in lib/api/v3/work_packages/eager_loading/custom_value.rb - About 55 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 register has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def register # rubocop:disable Metrics/AbcSize
        @device_type = params[:key].to_sym
        @device = new_device_type! @device_type

        needs_confirmation = true

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

      def playground(show_filter_input: true, show_filter_button: true, show_action_button: true, text: "Monday, 12th")
        render(Primer::OpenProject::SubHeader.new) do |component|
          component.with_filter_input(name: "filter", label: "Filter") if show_filter_input
          if show_filter_button
            component.with_filter_button do |button|
Severity: Minor
Found in lookbook/previews/open_project/common/sub_header_preview.rb - About 55 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 add_row has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def add_row(arr, idx = nil)
      idx ||= [@sheet.last_row_index + 1, 1].max
      column_array = []
      arr.each_with_index do |c, i|
        value = if %w(Time Date Float Integer).include?(c.class.name)
Severity: Minor
Found in modules/xls_export/lib/open_project/xls_export/spreadsheet_builder.rb - About 55 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 constructor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  constructor(public readonly injector:Injector,
    protected readonly elementRef:ElementRef,
    protected readonly $transitions:TransitionService,
    protected readonly ConfigurationService:ConfigurationService,
    protected readonly editingPortalService:EditingPortalService,

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

  public onMove(event:any) {
    if (!this.autoScroll()) {
      return;
    }

Severity: Minor
Found in frontend/src/app/shared/helpers/drag-and-drop/dom-autoscroll.service.ts - About 55 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 buildPayloadFromChanges has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  protected buildPayloadFromChanges() {
    let payload:unknown&{ _links:{ attachments?:IHalOptionalTitledLink[], fileLinks?:IHalOptionalTitledLink[] } };

    if (isNewResource(this.pristineResource)) {
      // If the resource is new, we need to pass the entire form payload

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

  protected updateLabels(activeDragNDrop:boolean,
    labels:WorkPackageCellLabels,
    change:WorkPackageChangeset) {
    const labelConfiguration = this.wpTableTimeline.getNormalizedLabels(change.projectedResource);

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

export function initializeGlobalListeners():void {
  document
    .documentElement
    .addEventListener('click', (evt:MouseEvent) => {
      const target = evt.target as HTMLElement;
Severity: Minor
Found in frontend/src/app/core/setup/globals/global-listeners.ts - About 55 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 toggleNavigation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  public toggleNavigation(event?:JQuery.TriggeredEvent|Event):void {
    if (event) {
      event.stopPropagation();
      event.preventDefault();
    }
Severity: Minor
Found in frontend/src/app/core/main-menu/main-menu-toggle.service.ts - About 55 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 listParamsString has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function listParamsString(params?:ApiV3ListParameters):string {
  const queryProps = [];

  if (params && params.sortBy) {
    queryProps.push(`sortBy=${JSON.stringify(params.sortBy)}`);
Severity: Minor
Found in frontend/src/app/core/apiv3/paths/apiv3-list-resource.interface.ts - About 55 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 makeSplitViewRoutes has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

export function makeSplitViewRoutes(baseRoute:string,
  menuItemClass:string|undefined,
  showComponent:ComponentType<unknown>,
  newComponent:ComponentType<unknown> = WorkPackageNewSplitViewComponent,
  makeFullWidth?:boolean,

    Avoid deeply nested control flow statements.
    Open

              if (opts.weeks) {
                if (units.days >= daysPerWeek) {
                  units.weeks = Math.trunc(units.days / daysPerWeek);
                  units.days = Math.trunc(units.days % daysPerWeek);
                  if (units.weeks >= FULL_WEEKS_PER_MONTH) {
    Severity: Major
    Found in frontend/src/app/shared/helpers/chronic_duration.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

            if node.left == model.arel_table
              node.left = model.journal_class.arel_table
            end
      Severity: Major
      Found in app/models/journable/historic_active_record_relation.rb - About 45 mins to fix

        Method build_header_cells_parts has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def build_header_cells_parts(columns, top, height, mapping_lambda, compare_lambda, title_lambda)
        Severity: Minor
        Found in app/models/work_package/pdf_export/gantt/gantt_builder.rb - About 45 mins to fix

          Method options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def options(*names)
                default_values = {}
          
                if names.size == 1 && names.first.is_a?(Hash)
                  default_values = names.first
          Severity: Minor
          Found in app/components/application_component.rb - About 45 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 Taskboard has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          RB.Taskboard = (function ($) {
            return RB.Object.create(RB.Model, {
          
              initialize: function (el) {
                var self = this; // So we can bind the event handlers to this object
          Severity: Minor
          Found in frontend/src/stimulus/controllers/dynamic/backlogs/taskboard.js - About 45 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