opf/openproject

View on GitHub

Showing 635 of 1,693 total issues

Function openGantt has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  openGantt(evt:MouseEvent):void {
    evt.preventDefault();

    this
      .dateModalRelations

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

      ngOnInit() {
        const element = jQuery(this.elementRef.nativeElement);
        const eventName = 'op:dragscroll';
    
        // Is mouse down?

      Function onMoved has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            onMoved: async (el:HTMLElement, target:HTMLElement, source:HTMLElement, sibling:HTMLElement|null) => {
              const wpId:string = el.dataset.workPackageId!;
              let rowIndex;
      
              try {

        Function addExisting has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          public addExisting() {
            if (_.isNil(this.selectedWpId)) {
              return;
            }
        
        

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

            ngOnInit():void {
              // Ensure board is being loaded
              this.Boards.loadAllBoards();
          
              this.removeTransitionSubscription = this.$transitions.onSuccess({}, (transition):any => {

            Function refreshView has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              refreshView() {
                if (!this.wpTableTimeline.isVisible) {
                  debugLog('refreshView() requested, but TL is invisible.');
                  return;
                }

              Function loadActionAttribute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                private async loadActionAttribute(query:QueryResource):Promise<void> {
                  if (!this.board.isAction) {
                    this.actionResource = undefined;
                    this.headerComponent = undefined;
                    this.canDragInto = !!query.updateOrderedWorkPackages;

                Function menuTourSteps has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function menuTourSteps():OnboardingStep[] {
                  return [
                    {
                      'next .members-menu-item': I18n.t('js.onboarding.steps.members'),
                      showSkip: false,
                Severity: Minor
                Found in frontend/src/app/core/setup/globals/onboarding/tours/menu_tour.ts - About 1 hr to fix

                  Function newSegment has 8 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  function newSegment(vp:TimelineViewParameters,
                    classNames:string[],
                    yPosition:number,
                    top:number,
                    left:number,

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

                        def allowed_in_any_entity?(permission, entity_class, in_project: nil) # rubocop:disable Metrics/PerceivedComplexity
                          perms = contextual_permissions(permission, context_name(entity_class))
                          return false unless authorizable_user?
                          return false if in_project && !(in_project.active? || in_project.being_archived?)
                          return true if admin_and_all_granted_to_admin?(perms)
                    Severity: Minor
                    Found in app/services/authorization/user_permissible_service.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 substitute_database_table_in_predicate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def substitute_database_table_in_predicate(predicate)
                        case predicate
                        when String
                          gsub_table_names_in_sql_string!(predicate)
                        when Arel::Nodes::HomogeneousIn,
                    Severity: Minor
                    Found in app/models/journable/historic_active_record_relation.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 group_by_sort has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def group_by_sort(order: true)
                        if query.grouped? && (column = query.group_by_column)
                          alias_name = include_aliases[column.name]
                          columns_hash = columns_hash_for(alias_name ? column.association : nil)
                          Array(column.sortable).map do |s|
                    Severity: Minor
                    Found in app/models/query/results/group_by.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 allowed_values_subset has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def allowed_values_subset
                            values
                              .map { |page| [page, ::Grids::Configuration.attributes_from_scope(page)] }
                              .filter_map do |page, config|
                                next unless config && config[:class]
                    Severity: Minor
                    Found in modules/grids/app/queries/grids/filters/page_filter.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 allowed_to has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def allowed_to(user, permission)
                            permissions = allowed_to_permissions(permission)
                    
                            return none if user.locked?
                            return none if permissions.empty?
                    Severity: Minor
                    Found in app/models/projects/scopes/allowed_to.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 highlight_tokens has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      def highlight_tokens(text, tokens, text_on_not_found: false)
                        split_text = text_split_by_token(text, tokens)
                    
                        return nil unless split_text.length > 1 || text_on_not_found
                    
                    
                    Severity: Minor
                    Found in app/helpers/search_helper.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 allowed_to has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def allowed_to(user, permission) # rubocop:disable Metrics/AbcSize
                            permissions = Authorization.contextual_permissions(permission, :work_package, raise_on_unknown: true)
                    
                            return none if user.locked?
                            return none if permissions.empty?
                    Severity: Minor
                    Found in app/models/work_packages/scopes/allowed_to.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 Controls has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                    Reporting.Controls = function($){
                      var toggle_delete_form = function (e) {
                        e.preventDefault();
                    
                        var offset = $('#query-icon-delete').offsetLeft;

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

                      def query_search(scope)
                        scope = scope.in_group(params[:group_id].to_i) if params[:group_id].present?
                        c = ARCondition.new
                    
                        case params[:status]
                    Severity: Minor
                    Found in app/services/user_search_service.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 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

                    Severity
                    Category
                    Status
                    Source
                    Language