opf/openproject

View on GitHub

Showing 610 of 1,650 total issues

Function buildQueries has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public buildQueries():IStaticQuery[] {
    let items:IStaticQuery[] = [
      {
        title: this.text.all_open,
        uiSref: 'work-packages',

    Function makeSplitViewRoutes has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      StorageComponent has 26 functions (exceeds 20 allowed). Consider refactoring.
      Open

      @Component({
        selector: 'op-storage',
        templateUrl: './storage.component.html',
        changeDetection: ChangeDetectionStrategy.OnPush,
        providers: [{ provide: OpUploadService, useClass: StorageUploadService }],

        Function initializeGlobalListeners has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function initializeGlobalListeners():void {
          document
            .documentElement
            .addEventListener('click', (evt:MouseEvent) => {
              const target = evt.target as HTMLElement;
        Severity: Major
        Found in frontend/src/app/core/setup/globals/global-listeners.ts - About 2 hrs to fix

          Method search has a Cognitive Complexity of 21 (exceeds 5 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 2 hrs 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 ngOnInit has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            ngOnInit():void {
              this.form.disable();
              this.userId = (this.userId || this.uiRouterGlobals.params.userId) as string;
              this.eeShowBanners = this.bannersService.eeShowBanners;
          
          

            Class HistoricActiveRecordRelation has 25 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Journable::HistoricActiveRecordRelation < ActiveRecord::Relation
              attr_accessor :timestamp
            
              include ActiveRecord::Delegation::ClassSpecificRelation
            
            
            Severity: Minor
            Found in app/models/journable/historic_active_record_relation.rb - About 2 hrs to fix

              TopMenuService has 25 functions (exceeds 20 allowed). Consider refactoring.
              Open

              @Injectable({ providedIn: 'root' })
              export class TopMenuService {
                private hover = false;
              
                private menuIsOpen = false;
              Severity: Minor
              Found in frontend/src/app/core/top-menu/top-menu.service.ts - About 2 hrs to fix

                Function listenToSettingChanges has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function listenToSettingChanges() {
                  jQuery('#settings_session_ttl_enabled').on('change', function () {
                    jQuery('#settings_session_ttl_container').toggle(jQuery(this).is(':checked'));
                  }).trigger('change');
                
                
                Severity: Major
                Found in frontend/src/app/core/setup/globals/global-listeners/settings.ts - About 2 hrs to fix

                  Method full_breadcrumbs has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def full_breadcrumbs
                      render(Primer::Beta::Breadcrumbs.new(test_selector: "op-breadcrumb")) do |breadcrumbs|
                        breadcrumb_paths.each_with_index do |item, index|
                          item = anchor_string_to_object(item) if item.is_a?(String) && item.start_with?("\u003c")
                  
                  
                  Severity: Minor
                  Found in app/helpers/breadcrumb_helper.rb - About 2 hrs 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 selectNextResult has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                    private selectNextResult(activeID:ID|null, allProjects:IProjectData[]):void {
                      if (activeID === null) {
                        return;
                      }
                  
                  

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

                  RB.Story = (function ($) {
                    return RB.Object.create(RB.WorkPackage, RB.EditableInplace, {
                      initialize: function (el) {
                        this.$ = $(el);
                        this.el = el;
                  Severity: Major
                  Found in frontend/src/stimulus/controllers/dynamic/backlogs/story.js - About 2 hrs to fix

                    Class CustomStylesController has 24 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                    class CustomStylesController < ApplicationController
                      layout "admin"
                      menu_item :custom_style
                    
                      before_action :require_admin,
                    Severity: Minor
                    Found in app/controllers/custom_styles_controller.rb - About 2 hrs to fix

                      Class BaseContract has 24 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                        class BaseContract < ::ModelContract
                          include OpenProject::StaticRouting::UrlHelpers
                          include AssignableValuesContract
                          include ::Attachments::ValidateReplacements
                      
                      
                      Severity: Minor
                      Found in modules/grids/app/contracts/grids/base_contract.rb - About 2 hrs to fix

                        OpProjectIncludeComponent has 24 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        @Component({
                          selector: 'op-project-include',
                          changeDetection: ChangeDetectionStrategy.OnPush,
                          templateUrl: './project-include.component.html',
                          styleUrls: ['./project-include.component.sass'],

                          WpGraphConfigurationService has 24 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          @Injectable()
                          export class WpGraphConfigurationService {
                            private _configuration:WpGraphConfiguration;
                          
                            private _globalScope = false;

                            SelectEditFieldComponent has 24 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            @Component({
                              templateUrl: './select-edit-field.component.html',
                            })
                            export class SelectEditFieldComponent extends EditFieldComponent implements OnInit {
                              @InjectField() selectAutocompleterRegister:SelectAutocompleterRegisterService;

                              IanCenterService has 24 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              @Injectable()
                              @EffectHandler
                              export class IanCenterService extends UntilDestroyedMixin {
                                readonly id = 'ian-center';
                              
                              

                                HalResource has 24 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                export class HalResource {
                                  // TODO this is the source of many issues in the frontend
                                  // because it no longer properly type checks stuff
                                  // Since 2019-10-21 I'm documenting what bugs this caused:
                                  // https://community.openproject.com/wp/31462
                                Severity: Minor
                                Found in frontend/src/app/features/hal/resources/hal-resource.ts - About 2 hrs to fix

                                  WorkPackagesListService has 24 functions (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  @Injectable()
                                  export class WorkPackagesListService {
                                    @InjectField() protected readonly currentUser:CurrentUserService;
                                  
                                    // We remember the query requests coming in so we can ensure only the latest request is being tended to
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language