opf/openproject

View on GitHub

Showing 635 of 1,693 total issues

Function render has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public render() {
    // If no relation column active, skip this pass
    if (!this.isApplicable) {
      return;
    }

    Function initializeViews has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private initializeViews():void {
        const categories:{ [category:string]:IOpSidemenuItem[] } = {
          starred: [],
          default: [],
          public: [],

      Function wpOnboardingTourSteps has 46 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function wpOnboardingTourSteps():OnboardingStep[] {
        return [
          {
            'next .wp-table--row': I18n.t('js.onboarding.steps.wp.list'),
            showSkip: false,

        Method change has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def change
            create_table :gitlab_merge_requests do |t|
              t.references :gitlab_user
              t.references :merged_by
        
        

          Method up has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def up
              if primary_key_index_name(:cost_objects) != "cost_objects_pkey"
                warn "Found unexpected primary key name. Fixing primary key names..."
          
                require "./db/migrate/20190502102512_ensure_postgres_index_names"

            Method patch has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

              def patch(diff)
                newary = nil
                newary = if diff.difftype == String
                           diff.difftype.new("")
                         else
            Severity: Minor
            Found in lib_static/redmine/diff/diffable.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 push has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

              def push(name, url, options = {})
                options = options.dup
            
                if options[:parent]
                  subtree = find(options[:parent])
            Severity: Minor
            Found in lib/redmine/menu_manager/mapper.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

            Function buildItems has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
            Open

              private buildItems() {
                this.items = [];
            
                if (this.wpDisplayRepresentationService.current !== wpDisplayCardRepresentation) {
                  this.items.push(

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

              private determineParent(el:Element):Promise<string|null> {
                let previous = el.previousElementSibling;
                const next = el.nextElementSibling;
                let parent = null;
            
            

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

              def down
                rename_column :material_budget_items, :amount, :budget
                rename_column :material_budget_items, :budget_id, :cost_object_id
                rename_column :labor_budget_items, :amount, :budget
                rename_column :labor_budget_items, :budget_id, :cost_object_id

              Method core_user_tabs has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      def core_user_tabs
                        [
                          {
                            name: "general",
                            partial: "users/general",
              Severity: Minor
              Found in lib/open_project/ui/extensible_tabs.rb - About 1 hr to fix

                Function ngOnInit has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  ngOnInit():void {
                    if (!(this.resource instanceof HalResource)) {
                      // Parse the resource if any exists
                      this.resource = this.halResourceService.createHalResource(this.resource, true);
                    }

                  Function buildInsertPosition has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function buildInsertPosition(
                    order:string[],
                    positions:QueryOrder,
                    wpId:string,
                    index:number,

                    Function getFilterName has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      public getFilterName(timestamps:string[]) {
                        const datesAndTimes = timestamps.map((el) => el.split(/[@T]/));
                        const baselineValue = baselineFilterFromValue(this.wpTableBaseline.current);
                        const changesSinceOrBetween = this.deriveChangesSinceOrBetween(baselineValue);
                        let description = '';

                      Function ngOnInit has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        ngOnInit():void {
                          this.form = this.rootFormGroup.control.get('dailyReminders') as UntypedFormGroup;
                      
                          this.enabled$ = this
                            .form

                        Function initializeLocale has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function initializeLocale() {
                          const meta = document.querySelector<HTMLMetaElement>('meta[name=openproject_initializer]');
                          const userLocale = meta?.dataset.locale || 'en';
                          const defaultLocale = meta?.dataset.defaultlocale || 'en';
                          const instanceLocale = meta?.dataset.instancelocale || 'en';
                        Severity: Minor
                        Found in frontend/src/app/core/setup/init-locale.ts - About 1 hr to fix

                          Function buildItems has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            private buildItems() {
                              this.items = [
                                {
                                  // Configuration modal
                                  linkText: this.I18n.t('js.toolbar.settings.configure_view'),

                            Consider simplifying this complex logical expression.
                            Open

                                if (
                                  changes.settings
                                  || changes.resourcePath
                                  || changes.resourceId
                                  || changes.formUrl

                              Consider simplifying this complex logical expression.
                              Open

                                  if (inGroup || isRoot) {
                                    const elementGroups = Array.from(element.classList).filter((listClass) => listClass.includes('__hierarchy-group-')) || [];
                                    const previousGroups = Array.from(previous.classList).filter((listClass) => listClass.includes('__hierarchy-group-')) || [];
                                    const nextGroups = next && Array.from(next.classList).filter((listClass) => listClass.includes('__hierarchy-group-')) || [];
                                    const previousWpId = (previous as HTMLElement).dataset.workPackageId!;

                                Method replacements has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    def self.replacements
                                      [
                                        { class: WorkPackage, column: :description },
                                        { class: Journal::WorkPackageJournal, column: :description },
                                        { class: Document, column: :description },
                                Severity: Minor
                                Found in app/services/users/replace_mentions_service.rb - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language