opf/openproject

View on GitHub

Showing 1,391 of 1,408 total issues

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

xdescribe('DateInputComponent', () => {
  let component:DateInputComponent;
  let fixture:ComponentFixture<DateInputComponent>;

  beforeEach(async () => {
frontend/src/app/features/projects/components/projects/projects.component.spec.ts on lines 5..25
frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/formattable-textarea-input/components/formattable-control/formattable-control.component.spec.ts on lines 5..25

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 156.

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 3 locations. Consider refactoring.
Open

xdescribe('FormattableControlComponent', () => {
  let component:FormattableControlComponent;
  let fixture:ComponentFixture<FormattableControlComponent>;

  beforeEach(async () => {
frontend/src/app/features/projects/components/projects/projects.component.spec.ts on lines 5..25
frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/date-input/date-input.component.spec.ts on lines 5..25

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 156.

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 3 locations. Consider refactoring.
Open

xdescribe('ProjectsComponent', () => {
  let component:ProjectsComponent;
  let fixture:ComponentFixture<ProjectsComponent>;

  beforeEach(async () => {
frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/date-input/date-input.component.spec.ts on lines 5..25
frontend/src/app/shared/components/dynamic-forms/components/dynamic-inputs/formattable-textarea-input/components/formattable-control/formattable-control.component.spec.ts on lines 5..25

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 156.

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 removeColumn(column:number) {
    this.numColumns--;

    // shrink widgets that span more than the removed column
    this.widgetAreas.forEach((widget) => {
frontend/src/app/shared/components/grids/grid/area.service.ts on lines 337..354

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 154.

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 removeRow(row:number) {
    this.numRows--;

    // shrink widgets that span more than the removed row
    this.widgetAreas.forEach((widget) => {
frontend/src/app/shared/components/grids/grid/area.service.ts on lines 318..335

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 154.

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

Method static_links has 147 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 5 hrs to fix

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

      private renderLabelsMonths(vp:TimelineViewParameters):void {
        this.renderTimeSlices(vp, 'week', vp.dateDisplayStart, vp.dateDisplayEnd, () => {
        });
    
        this.renderTimeSlices(vp, 'month', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {
    frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.ts on lines 142..154

    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 152.

    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

      private renderLabelsQuarters(vp:TimelineViewParameters):void {
        this.renderTimeSlices(vp, 'month', vp.dateDisplayStart, vp.dateDisplayEnd, () => {
        });
    
        this.renderTimeSlices(vp, 'quarter', vp.dateDisplayStart, vp.dateDisplayEnd, (start, cell) => {
    frontend/src/app/features/work-packages/components/wp-table/timeline/grid/wp-timeline-grid.directive.ts on lines 128..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 152.

    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

      startAddRelationPredecessor(start:WorkPackageResource) {
        this.activateSelectionMode(start.id!, (end) => {
          this.wpRelations
            .addCommonRelation(start.id!, 'follows', end.id!)
            .then(() => {
    frontend/src/app/features/work-packages/components/wp-table/timeline/container/wp-timeline-container.directive.ts on lines 271..284

    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 148.

    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

      startAddRelationFollower(start:WorkPackageResource) {
        this.activateSelectionMode(start.id!, (end) => {
          this.wpRelations
            .addCommonRelation(start.id!, 'precedes', end.id!)
            .then(() => {
    frontend/src/app/features/work-packages/components/wp-table/timeline/container/wp-timeline-container.directive.ts on lines 256..269

    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 148.

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

    export function initializeHalProperties<T extends HalResource>(halResourceService:HalResourceService, halResource:T) {
      setSource();
      setupLinks();
      setupEmbedded();
      proxyProperties();
    Severity: Major
    Found in frontend/src/app/features/hal/helpers/hal-resource-builder.ts - About 5 hrs to fix

      File wp-timeline-container.directive.ts has 398 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      // -- copyright
      // OpenProject is an open source project management software.
      // Copyright (C) 2012-2022 the OpenProject GmbH
      //
      // This program is free software; you can redistribute it and/or

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

          get showErrorMessage():boolean {
            if (!this.formControl) {
              return false;
            }
        
        
        frontend/src/app/shared/components/forms/checkbox-field/checkbox-field.component.ts on lines 61..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 145.

        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

          get showErrorMessage():boolean {
            if (!this.formControl) {
              return false;
            }
        
        
        frontend/src/app/shared/components/forms/form-field/form-field.component.ts on lines 53..67

        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 145.

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

          private buildItems() {
            this.items = [
              {
                // Configuration modal
                disabled: false,

          Function Attachable has 136 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function Attachable<TBase extends Constructor<HalResource>>(Base:TBase) {
            return class extends Base {
              public attachments:AttachmentCollectionResource;
          
              private ToastService:ToastService;
          Severity: Major
          Found in frontend/src/app/features/hal/resources/mixins/attachable-mixin.ts - About 5 hrs to fix

            Function Model has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
            Open

            RB.Model = (function ($) {
              return RB.Object.create({
            
                initialize: function (el) {
                  this.$ = $(el);
            Severity: Minor
            Found in frontend/src/app/core/augmenting/dynamic-scripts/backlogs/model.js - About 5 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

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

              public text = {
                button_submit: this.I18n.t('js.modals.button_submit'),
                button_cancel: this.I18n.t('js.modals.button_cancel'),
                button_continue: this.I18n.t('js.button_continue'),
                close_popup: this.I18n.t('js.close_popup_title'),
            frontend/src/app/features/admin/types/type-form-configuration.component.ts on lines 44..53
            frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts on lines 68..77
            frontend/src/app/shared/components/datepicker/datepicker.modal.ts on lines 82..91
            frontend/src/app/shared/components/modals/save-modal/save-query.modal.ts on lines 58..67
            frontend/src/app/shared/components/modals/share-modal/query-sharing.modal.ts on lines 56..65
            frontend/src/app/shared/components/project-include/project-include.component.ts on lines 47..56

            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 142.

            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 7 locations. Consider refactoring.
            Open

              public text = {
                title: this.I18n.t('js.modals.form_submit.title'),
                text: this.I18n.t('js.modals.form_submit.text'),
                save_as: this.I18n.t('js.label_save_as'),
                label_name: this.I18n.t('js.modals.label_name'),
            frontend/src/app/features/admin/types/type-form-configuration.component.ts on lines 44..53
            frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts on lines 68..77
            frontend/src/app/features/enterprise/enterprise-modal/enterprise-trial.modal.ts on lines 64..73
            frontend/src/app/shared/components/datepicker/datepicker.modal.ts on lines 82..91
            frontend/src/app/shared/components/modals/save-modal/save-query.modal.ts on lines 58..67
            frontend/src/app/shared/components/project-include/project-include.component.ts on lines 47..56

            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 142.

            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 7 locations. Consider refactoring.
            Open

              public text = {
                toggle_title: this.I18n.t('js.include_projects.toggle_title'),
                title: this.I18n.t('js.include_projects.title'),
                filter_all: this.I18n.t('js.include_projects.selected_filter.all'),
                filter_selected: this.I18n.t('js.include_projects.selected_filter.selected'),
            frontend/src/app/features/admin/types/type-form-configuration.component.ts on lines 44..53
            frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts on lines 68..77
            frontend/src/app/features/enterprise/enterprise-modal/enterprise-trial.modal.ts on lines 64..73
            frontend/src/app/shared/components/datepicker/datepicker.modal.ts on lines 82..91
            frontend/src/app/shared/components/modals/save-modal/save-query.modal.ts on lines 58..67
            frontend/src/app/shared/components/modals/share-modal/query-sharing.modal.ts on lines 56..65

            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 142.

            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

            Severity
            Category
            Status
            Source
            Language