opf/openproject

View on GitHub

Showing 1,465 of 1,482 total issues

File te-calendar.component.ts has 510 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {
  ChangeDetectionStrategy,
  Component,
  ElementRef,
  EventEmitter,

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export const TEAM_PLANNER_ROUTES:Ng2StateDeclaration[] = [
      {
        name: 'team_planner',
        parent: 'optional_project',
        url: '/team_planners/:query_id?query_props&cdate&cview',
    frontend/src/app/features/calendar/calendar.routes.ts on lines 36..75

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 197.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export const CALENDAR_ROUTES:Ng2StateDeclaration[] = [
      {
        name: 'calendar',
        parent: 'optional_project',
        url: '/calendars/:query_id?&query_props&cdate&cview',
    Severity: Major
    Found in frontend/src/app/features/calendar/calendar.routes.ts and 1 other location - About 1 day to fix
    frontend/src/app/features/team-planner/team-planner/team-planner.routes.ts on lines 36..75

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 197.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

                eventResize: (resizeInfo:EventResizeDoneArg) => {
                  const due = moment(resizeInfo.event.endStr).subtract(1, 'day').toDate();
                  const start = moment(resizeInfo.event.startStr).toDate();
                  const wp = resizeInfo.event.extendedProps.workPackage as WorkPackageResource;
                  if (!wp.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start) || this.weekdayService.isNonWorkingDay(due))) {
    frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts on lines 212..222

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 196.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

          eventResize: (resizeInfo:EventResizeDoneArg) => {
            const due = moment(resizeInfo.event.endStr).subtract(1, 'day').toDate();
            const start = moment(resizeInfo.event.startStr).toDate();
            const wp = resizeInfo.event.extendedProps.workPackage as WorkPackageResource;
            if (!wp.ignoreNonWorkingDays && (this.weekdayService.isNonWorkingDay(start) || this.weekdayService.isNonWorkingDay(due))) {
    frontend/src/app/features/team-planner/team-planner/planner/team-planner.component.ts on lines 527..537

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 196.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export class ApiV3StatusesPaths extends ApiV3ResourceCollection<StatusResource, ApiV3StatusPaths> {
      constructor(protected apiRoot:ApiV3Service,
        protected basePath:string) {
        super(apiRoot, basePath, 'statuses', ApiV3StatusPaths);
      }
    frontend/src/app/core/apiv3/endpoints/roles/apiv3-roles-paths.ts on lines 37..58

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 191.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    export class ApiV3RolesPaths extends ApiV3ResourceCollection<RoleResource, ApiV3RolePaths> {
      constructor(protected apiRoot:ApiV3Service,
        protected basePath:string) {
        super(apiRoot, basePath, 'roles', ApiV3RolePaths);
      }
    frontend/src/app/core/apiv3/endpoints/statuses/apiv3-statuses-paths.ts on lines 37..58

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 191.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function registerWidgets has 187 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function registerWidgets(injector:Injector) {
      const hookService = injector.get(HookService);
      const i18n = injector.get(I18nService);
    
      hookService.register('gridWidgets', () => {
    Severity: Major
    Found in frontend/src/app/shared/components/grids/openproject-grids.module.ts - About 7 hrs to fix

      Method static_links has 185 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def static_links
                {
                  upsale: {
                    href: 'https://www.openproject.org/enterprise-edition',
                    label: 'homescreen.links.upgrade_enterprise_edition'
      Severity: Major
      Found in lib/open_project/static/links.rb - About 7 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          public editCodeBlock(content:string, languageClass:string):Promise<{ content:string, languageClass:string }> {
            return new Promise<{ content:string, languageClass:string }>((resolve, _) => {
              this.opModalService.show(
                CodeBlockMacroModalComponent,
                this.injector,
        frontend/src/app/shared/components/modals/editor/editor-macros.service.ts on lines 46..58

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 178.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          public configureWorkPackageButton(typeName?:string, classes?:string):Promise<{ type:string, classes:string }> {
            return new Promise<{ type:string, classes:string }>((resolve, reject) => {
              this.opModalService.show(
                WpButtonMacroModalComponent,
                this.injector,
        frontend/src/app/shared/components/modals/editor/editor-macros.service.ts on lines 83..95

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 178.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        File dynamic-form.component.spec.ts has 461 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { NgSelectModule } from '@ng-select/ng-select';
        import { NgOptionHighlightModule } from '@ng-select/ng-option-highlight';
        import {
          Component,
          forwardRef,

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            constructor(
              readonly states:States,
              readonly $state:StateService,
              readonly wpTableFilters:WorkPackageViewFiltersService,
              readonly wpListService:WorkPackagesListService,
          frontend/src/app/features/work-packages/components/wp-card-view/wp-card-view.component.ts on lines 121..140

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 176.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            text = {
              title: this.I18n.t('js.reminders.settings.alerts.title'),
              explanation: this.I18n.t('js.reminders.settings.alerts.explanation'),
              newsAdded: this.I18n.t('js.reminders.settings.alerts.news_added'),
              newsCommented: this.I18n.t('js.reminders.settings.alerts.news_commented'),
          frontend/src/app/core/setup/globals/components/admin/backup.component.ts on lines 55..66

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 176.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            public text = {
              info: this.i18n.t('js.backup.info'),
              note: this.i18n.t('js.backup.note'),
              title: this.i18n.t('js.backup.title'),
              lastBackup: this.i18n.t('js.backup.last_backup'),
          frontend/src/app/features/user-preferences/reminder-settings/email-alerts/email-alerts-settings.component.ts on lines 38..49

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 176.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            constructor(readonly querySpace:IsolatedQuerySpace,
              readonly states:States,
              readonly injector:Injector,
              readonly $state:StateService,
              readonly I18n:I18nService,
          frontend/src/app/features/calendar/wp-calendar/wp-calendar.component.ts on lines 108..129

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 176.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Class SetAttributesService has 50 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class WorkPackages::SetAttributesService < ::BaseServices::SetAttributes
            include Attachments::SetReplacements
          
            private
          
          
          Severity: Minor
          Found in app/services/work_packages/set_attributes_service.rb - About 7 hrs to fix

            PathHelperService has 50 functions (exceeds 20 allowed). Consider refactoring.
            Open

            @Injectable({ providedIn: 'root' })
            export class PathHelperService {
              public readonly appBasePath = window.appBasePath || '';
            
              public readonly api = {
            Severity: Minor
            Found in frontend/src/app/core/path-helper/path-helper.service.ts - About 7 hrs to fix

              TeamPlannerComponent has 50 functions (exceeds 20 allowed). Consider refactoring.
              Open

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

                Function registerWorkPackageMouseHandler has 160 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function registerWorkPackageMouseHandler(this:void,
                  injector:Injector,
                  getRenderInfo:() => RenderInfo,
                  workPackageTimeline:WorkPackageTimelineTableController,
                  halEditing:HalResourceEditingService,
                  Severity
                  Category
                  Status
                  Source
                  Language