YetiForceCompany/YetiForceCRM

View on GitHub
public_html/layouts/basic/modules/Project/resources/Gantt.js

Summary

Maintainability
F
5 days
Test Coverage

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

    constructor(container, projectData) {
        this.container = $(container);
        this.containerParent = this.container.parent();
        this.headerContainer = this.containerParent.parent().find('.js-gantt-header').eq(0);
        this.weekStart = 6 - CONFIG.firstDayOfWeekNos;
Severity: Major
Found in public_html/layouts/basic/modules/Project/resources/Gantt.js - About 6 hrs to fix

    File Gantt.js has 435 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* {[The file is published on the basis of YetiForce Public License 6.5 that can be found in the following directory: licenses/LicenseEN.txt or yetiforce.com]} */
    'use strict';
    
    class Gantt {
        /**
    Severity: Minor
    Found in public_html/layouts/basic/modules/Project/resources/Gantt.js - About 6 hrs to fix

      Function showFiltersModal has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          showFiltersModal() {
              const self = this;
              app.showModalHtml({
                  headerIcon: 'fas fa-filter',
                  header: app.vtranslate('JS_FILTER_BY_STATUSES'),
      Severity: Major
      Found in public_html/layouts/basic/modules/Project/resources/Gantt.js - About 2 hrs to fix

        Function registerLanguage has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            registerLanguage() {
                this.options.locale = {
                    name: CONFIG.langKey,
                    weekStart: this.weekStart,
                    weekdays: [
        Severity: Minor
        Found in public_html/layouts/basic/modules/Project/resources/Gantt.js - About 2 hrs to fix

          Function loadProject has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              loadProject(projectData) {
                  this.projectData = projectData;
                  if (typeof this.projectData.tasks === 'undefined' || this.projectData.tasks.length === 0) {
                      $('.js-hide-filter').addClass('d-none');
                      $('.js-show-add-record').removeClass('d-none');
          Severity: Minor
          Found in public_html/layouts/basic/modules/Project/resources/Gantt.js - About 1 hr to fix

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

                registerHeaderActions() {
                    this.headerContainer.find('.js-gantt-header__btn-filter').on('click', (e) => {
                        e.preventDefault();
                        this.showFiltersModal();
                    });
            Severity: Minor
            Found in public_html/layouts/basic/modules/Project/resources/Gantt.js - About 1 hr to fix

              Function showFiltersModal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  showFiltersModal() {
                      const self = this;
                      app.showModalHtml({
                          headerIcon: 'fas fa-filter',
                          header: app.vtranslate('JS_FILTER_BY_STATUSES'),
              Severity: Minor
              Found in public_html/layouts/basic/modules/Project/resources/Gantt.js - About 25 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

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

                                      ${self.statuses.ProjectMilestone.map((status) => {
                                          return `<option value="${status.value}" ${
                                              this.filter.status.ProjectMilestone.map((status) => status.value).indexOf(status.value) >= 0
                                                  ? 'selected'
                                                  : ''
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 428..432
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 450..456

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

              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

                                      ${self.statuses.Project.map((status) => {
                                          return `<option value="${status.value}" ${
                                              this.filter.status.Project.map((status) => status.value).indexOf(status.value) >= 0 ? 'selected' : ''
                                          }>${status.label}</option>`;
                                      })}
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 438..444
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 450..456

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

              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

                                      ${self.statuses.ProjectTask.map((status) => {
                                          return `<option value="${status.value}" ${
                                              this.filter.status.ProjectTask.map((status) => status.value).indexOf(status.value) >= 0
                                                  ? 'selected'
                                                  : ''
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 428..432
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 438..444

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

              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

                          footerButtons: [
                              { text: app.vtranslate('JS_UPDATE_GANTT'), icon: 'fas fa-check', class: 'btn-success js-success' },
                              { text: app.vtranslate('JS_CANCEL'), icon: 'fas fa-times', class: 'btn-danger', data: { dismiss: 'modal' } }
                          ],
              public_html/layouts/basic/modules/Settings/Workflows/resources/Edit3.js on lines 477..489

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

              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

                          monthsShort: [
                              LANG.JS_JAN,
                              LANG.JS_FEB,
                              LANG.JS_MAR,
                              LANG.JS_APR,
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 196..209

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

              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

                          months: [
                              LANG.JS_JANUARY,
                              LANG.JS_FEBRUARY,
                              LANG.JS_MARCH,
                              LANG.JS_APRIL,
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 210..223

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

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

                      this.headerContainer.find('.js-gantt-header__range-slider--task-list-width').on('input', (e) => {
                          this.ganttElastic.$emit('taskList-width-change', Number(e.target.value));
                      });
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 299..301
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 302..304
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 308..310

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

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

                      this.headerContainer.find('.js-gantt-header__range-slider--x').on('input', (e) => {
                          this.ganttElastic.$emit('times-timeZoom-change', Number(e.target.value));
                      });
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 302..304
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 305..307
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 308..310

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

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

                      this.headerContainer.find('.js-gantt-header__range-slider--scope').on('input', (e) => {
                          this.ganttElastic.$emit('scope-change', Number(e.target.value));
                      });
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 299..301
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 302..304
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 305..307

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

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

                      this.headerContainer.find('.js-gantt-header__range-slider--y').on('input', (e) => {
                          this.ganttElastic.$emit('row-height-change', Number(e.target.value));
                      });
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 299..301
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 305..307
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 308..310

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

              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

                                          ProjectTask: modal
                                              .find('.js-gantt__filter-task')
                                              .val()
                                              .map((status) => {
                                                  return self.getStatusFromValue(status, 'ProjectTask');
              Severity: Minor
              Found in public_html/layouts/basic/modules/Project/resources/Gantt.js and 2 other locations - About 35 mins to fix
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 468..473
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 474..479

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

              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

                                          ProjectMilestone: modal
                                              .find('.js-gantt__filter-milestone')
                                              .val()
                                              .map((status) => {
                                                  return self.getStatusFromValue(status, 'ProjectMilestone');
              Severity: Minor
              Found in public_html/layouts/basic/modules/Project/resources/Gantt.js and 2 other locations - About 35 mins to fix
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 468..473
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 480..485

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

              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

                                          Project: modal
                                              .find('.js-gantt__filter-project')
                                              .val()
                                              .map((status) => {
                                                  return self.getStatusFromValue(status, 'Project');
              Severity: Minor
              Found in public_html/layouts/basic/modules/Project/resources/Gantt.js and 2 other locations - About 35 mins to fix
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 474..479
              public_html/layouts/basic/modules/Project/resources/Gantt.js on lines 480..485

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

              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

              There are no issues that match your filters.

              Category
              Status