opf/openproject

View on GitHub

Showing 635 of 1,693 total issues

Method edit has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def edit
    # TODO: split into edit and update
    # remove code where appropriate
    if @project
      # Hourly Rate
Severity: Minor
Found in modules/costs/app/controllers/hourly_rates_controller.rb - About 1 hr 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 extension has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

        def extension # rubocop:disable Metrics/AbcSize
          ->(*) do
            link :gitlab,
                 cache_if: -> { current_user.allowed_in_work_package?(:show_gitlab_content, represented) } do
              next if represented.new_record?

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

  load() {
    this.loadingInterval = window.setTimeout(
      async () => {
        try {
          const response = await fetch(

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

  manageRow(row:HTMLElement):void {
    const selectedField = this.getSelectedField(row);
    const selectedDirection = this.getSelectedDirection(row);

    // we have deselected the field, so we need to unset the direction, remove the row and move it to the end of the list

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

export function getBaselineState(workPackage:WorkPackageResource, schemaService:SchemaCacheService):string {
  let state = '';
  const schema = schemaService.of(workPackage);
  const timestamps = workPackage.attributesByTimestamp || [];
  if (timestamps.length > 1) {

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

  static extractPayloadFromSchema<T extends HalResource = HalResource>(resource:T, schema:SchemaResource) {
    const payload:any = {
      _links: {},
    };

Severity: Minor
Found in frontend/src/app/features/hal/schemas/hal-payload.helper.ts - About 1 hr 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 buildItemsForVersion has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  private buildItemsForVersion(version:VersionResource):OpContextMenuItem[] {
    const id = version.id!;
    return [
      {
        // Lock version

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 mappings has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def mappings
    {
      "seconds" => "seconds",
      "second" => "seconds",
      "secs" => "seconds",
Severity: Minor
Found in lib/chronic_duration.rb - About 1 hr to fix

    Function checkRunStateIcon has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public checkRunStateIcon(checkRun:IGithubCheckRunResource) {
        switch (this.checkRunState(checkRun)) {
          case 'success': {
            return 'checkmark';
          }

      Method parse_line has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def parse_line(line, _type = "inline")
            if line[0, 1] == "+"
              diff = diff_for_added_line
              diff.line_right = line[1..-1]
              diff.nb_line_right = @line_num_r
      Severity: Minor
      Found in lib/redmine/diff_table.rb - About 1 hr to fix

        Function insertInList has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export const insertInList = (
          projects:IProject[],
          project:IProject,
          list:IProjectData[],
          ancestors:IHalResourceLink[],

          Function removeChild has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public removeChild(childWorkPackage:WorkPackageResource) {
              return childWorkPackage.$load().then(() => {
                const parentWorkPackage = childWorkPackage.parent;
                return childWorkPackage.changeParent({
                  _links: {

            Function onMouseDown has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public onMouseDown(ev:MouseEvent,
                dateForCreate:string|null,
                renderInfo:RenderInfo,
                labels:WorkPackageCellLabels):MouseDirection {
                // check for active selection mode

              Function registerDragAndDrop has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public registerDragAndDrop() {
                  // The DragService may not have been provided
                  // in which case we do not provide drag and drop
                  if (this.dragService === null) {
                    return;

                Function load_available_values_for_filter_from_remote has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  var load_available_values_for_filter_from_remote = function(select, filter_name, callback_func) {
                    var url = select.attr("data-remote-url"),
                        json_post_select_values = select.attr('data-initially-selected'),
                        post_select_values;
                
                

                  Function saveEdits has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      saveEdits: function () {
                        var j = this.$,
                            self = this,
                            editors = j.find('.editor'),
                            saveDir;
                  Severity: Minor
                  Found in frontend/src/stimulus/controllers/dynamic/backlogs/model.js - About 1 hr to fix

                    Method search has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                              def search(tokens, projects = nil, options = {})
                                tokens = Array(tokens)
                                projects = [] << projects unless projects.nil? || projects.is_a?(Array)
                    
                                find_order = "#{searchable_options[:order_column]} " + (options[:before] ? "DESC" : "ASC")
                    Severity: Minor
                    Found in lib_static/plugins/acts_as_searchable/lib/acts_as_searchable.rb - About 1 hr to fix

                      Function initializeDatepicker has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        private initializeDatepicker() {
                          this.datePickerInstance?.destroy();
                      
                          // Initialize the working values.
                          const initialDate = parseDate(this.value || new Date()) as Date;

                        Function load has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          load() {
                            this.loadingInterval = window.setTimeout(
                              async () => {
                                try {
                                  const response = await fetch(

                          Function selectPreviousResult has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            private selectPreviousResult(activeID:ID|null, allProjects:IProjectData[]):void {
                              if (activeID === null) {
                                return;
                              }
                          
                          
                            Severity
                            Category
                            Status
                            Source
                            Language