opf/openproject

View on GitHub

Showing 635 of 1,693 total issues

Function constructor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor() {
    jQuery('costs-subform').each((i, match) => {
      const el = jQuery(match);

      const container = el.find('.subform-container');

    Function handleUploadError has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      private handleUploadError(error:HttpErrorResponse, fileName:string):void {
        if (error.status === 500 && (error.error as IHalErrorBase).errorIdentifier === v3ErrorIdentifierMissingEnterpriseToken) {
          this.toastService.addError(error);
          return;
        }

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

        protected buildItems(permittedActions:WorkPackageAction[]):OpContextMenuItem[] {
          const configureFormLink = this.workPackage.configureForm;
      
          this.items = permittedActions.map((action:WorkPackageAction) => {
            const { key } = action;

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

          public render(element:HTMLElement, displayText:string):void {
            if (!this.value) {
              return;
            }
        
        

          Function submit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            public async submit():Promise<T> {
              if (this.change.isEmpty() && !isNewResource(this.resource)) {
                this.closeEditFields();
                return Promise.resolve(this.resource);
              }

            Function selectNextResult has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Function create has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                public async create(
                  wrapper:HTMLElement,
                  context:ICKEditorContext,
                  initialData:string|null = null,
                ):Promise<ICKEditorWatchdog> {

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

                  ngOnInit() {
                    this.polling$ = merge(
                      timer(10, this.interval).pipe(filter(() => this.activeWindow.isActive)),
                      timer(10, this.interval * 10).pipe(filter(() => !this.activeWindow.isActive)),
                    )

                  Function checkForNewNotifications has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    @EffectCallback(notificationCountIncreased)
                    private checkForNewNotifications() {
                      this.onReload.pipe(take(1)).subscribe((collection) => {
                        const { activeCollection } = this.query.getValue();
                        const hasNewNotifications = !collection.ids.reduce(

                    Function handleUserSubmit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      public async handleUserSubmit():Promise<unknown> {
                        if (this.inFlight || !this.rawComment) {
                          return Promise.resolve();
                        }
                    
                    

                      Function ngAfterViewInit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        ngAfterViewInit() {
                          this.$element = jQuery(this.elementRef.nativeElement);
                      
                          const scrollBar = document.querySelector('.work-packages-tabletimeline--timeline-side');
                          if (scrollBar) {

                        Function onValidatedSubmit has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          onValidatedSubmit():void {
                            if (this.principalForm.invalid) {
                              return;
                            }
                        
                        

                          Function buildGroupRow has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            public buildGroupRow(group:GroupObject, colspan:number) {
                              const row = document.createElement('tr');
                              let togglerIconClass; let
                                text;
                          
                          

                            Function setLinksAsProperties has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              function setLinksAsProperties() {
                                halResource.$linkableKeys().forEach((linkName:string) => {
                                  OpenprojectHalModuleHelpers.lazy(halResource, linkName,
                                    () => {
                                      const link:any = halResource.$links[linkName].$link || halResource.$links[linkName];
                            Severity: Minor
                            Found in frontend/src/app/features/hal/helpers/hal-resource-builder.ts - About 1 hr to fix

                              Function bootstrapAttributeGroups has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                public static bootstrapAttributeGroups(injector:Injector):void {
                                  if (this.bootstrapAttributeGroupsCalled) {
                                    return;
                                  }
                              
                              

                                Function getAllowedRelationActions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  private getAllowedRelationActions(workPackage:WorkPackageResource, allowSplitScreenActions:boolean) {
                                    const allowedActions:WorkPackageAction[] = [];
                                
                                    if (!!workPackage.addRelation && this.wpViewTimeline.isVisible) {
                                      allowedActions.push({

                                  Function handleEvent has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    public handleEvent(view:TableEventComponent, evt:JQuery.TriggeredEvent) {
                                      const target = jQuery(evt.target);
                                  
                                      // Ignore links
                                      if (target.is('a') || target.parent().is('a')) {

                                    Function listParamsString has 28 lines of code (exceeds 25 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 1 hr to fix

                                      Method set_colors has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                          def set_colors
                                            return unless params[:colors]
                                      
                                            # reset all colors if a new theme is set
                                            if params[:theme].present?
                                      Severity: Minor
                                      Found in app/services/design/update_design_service.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 modify_joins has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                        def modify_joins(arel)
                                          arel.instance_variable_get(:@ast).instance_variable_get(:@cores).each do |core|
                                            core.instance_variable_get(:@source).right.each do |node|
                                              if node.kind_of? Arel::Nodes::StringJoin
                                                gsub_table_names_in_sql_string!(node.left)
                                      Severity: Minor
                                      Found in app/models/journable/historic_active_record_relation.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language