superdesk/superdesk-client-core

View on GitHub
e2e/client/specs/helpers/desks.ts

Summary

Maintainability
F
4 days
Test Coverage

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

    constructor() {
        /** List of desks on desk settings list **/
        this.list = element.all(by.repeater('desk in desks._items'));
        /** For an item from desks settings list, get his name **/
        this.name = element(by.model('desk.name'));
Severity: Major
Found in e2e/client/specs/helpers/desks.ts - About 1 day to fix

    File desks.ts has 274 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable newline-per-chained-call */
    
    import {element, by, browser, protractor} from 'protractor';
    import {el, ECE} from '@superdesk/end-to-end-testing-helpers';
    import {nav, click} from './utils';
    Severity: Minor
    Found in e2e/client/specs/helpers/desks.ts - About 2 hrs to fix

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

              this.remove = function(name) {
                  this.getRow(name).then((rows) => {
                      rows[0].click();
                      rows[0].element(by.className('icon-dots-vertical')).click();
                      rows[0].element(by.className('icon-trash')).click();
      Severity: Major
      Found in e2e/client/specs/helpers/desks.ts and 1 other location - About 5 hrs to fix
      e2e/client/specs/helpers/templates.ts on lines 264..272

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

      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

              this.edit = function(name) {
                  this.getRow(name).then((rows) => {
                      rows[0].click();
                      rows[0].element(by.className('icon-dots-vertical')).click();
                      rows[0].element(by.className('icon-pencil')).click();
      Severity: Major
      Found in e2e/client/specs/helpers/desks.ts and 2 other locations - About 4 hrs to fix
      e2e/client/specs/helpers/content_profiles.ts on lines 94..101
      e2e/client/specs/helpers/templates.ts on lines 251..258

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

      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.getTab = function(name) {
                  return this.tabs.filter((elem, index) =>
                      elem.element(by.binding('step.title'))
                          .getText()
                          .then((text) => text.toUpperCase() === name.toUpperCase()),
      Severity: Major
      Found in e2e/client/specs/helpers/desks.ts and 3 other locations - About 2 hrs to fix
      e2e/client/specs/helpers/content_profiles.ts on lines 82..88
      e2e/client/specs/helpers/desks.ts on lines 93..100
      e2e/client/specs/helpers/desks.ts on lines 191..197

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

      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.getRow = function(name) {
                  return this.list
                      .filter((elem, index) =>
                          elem.element(by.binding('desk.name'))
                              .getText()
      Severity: Major
      Found in e2e/client/specs/helpers/desks.ts and 3 other locations - About 2 hrs to fix
      e2e/client/specs/helpers/content_profiles.ts on lines 82..88
      e2e/client/specs/helpers/desks.ts on lines 167..173
      e2e/client/specs/helpers/desks.ts on lines 191..197

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

      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.getStage = function(name) {
                  return this.stages.filter((elem, index) =>
                      elem.element(by.css('[data-test-id="stage-name"]'))
                          .getText()
                          .then((text) => text.toUpperCase() === name.toUpperCase()),
      Severity: Major
      Found in e2e/client/specs/helpers/desks.ts and 3 other locations - About 2 hrs to fix
      e2e/client/specs/helpers/content_profiles.ts on lines 82..88
      e2e/client/specs/helpers/desks.ts on lines 93..100
      e2e/client/specs/helpers/desks.ts on lines 167..173

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

      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

              this.setDeskType = function(deskType) {
                  element(by.model('desk.edit.desk_type')).$('[value="' + deskType + '"]').click();
              };
      Severity: Major
      Found in e2e/client/specs/helpers/desks.ts and 1 other location - About 1 hr to fix
      e2e/client/specs/helpers/templates.ts on lines 92..94

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

      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

              this.setStageOutgoingMacro = function(name) {
                  this.getStageOutgoingMacro().$('[value="' + name + '"]').click();
              };
      Severity: Major
      Found in e2e/client/specs/helpers/desks.ts and 2 other locations - About 55 mins to fix
      e2e/client/specs/helpers/desks.ts on lines 467..469
      e2e/client/specs/helpers/desks.ts on lines 483..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 54.

      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

              this.setStageMovedOntoMacro = function(name) {
                  this.getStageMovedOntoMacro().$('[value="' + name + '"]').click();
              };
      Severity: Major
      Found in e2e/client/specs/helpers/desks.ts and 2 other locations - About 55 mins to fix
      e2e/client/specs/helpers/desks.ts on lines 467..469
      e2e/client/specs/helpers/desks.ts on lines 499..501

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

      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

              this.setStageIncomingMacro = function(name) {
                  this.getStageIncomingMacro().$('[value="' + name + '"]').click();
              };
      Severity: Major
      Found in e2e/client/specs/helpers/desks.ts and 2 other locations - About 55 mins to fix
      e2e/client/specs/helpers/desks.ts on lines 483..485
      e2e/client/specs/helpers/desks.ts on lines 499..501

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

      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

              this.setDeskDefaultContentProfile = function(profile) {
                  el(['field--default-content-profile'], by.cssContainingText('option', profile)).click();
              };
      Severity: Minor
      Found in e2e/client/specs/helpers/desks.ts and 1 other location - About 35 mins to fix
      e2e/client/specs/helpers/desks.ts on lines 281..283

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

      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

              this.setDeskDefaultContentTemplate = function(template) {
                  el(['field--default-content-template'], by.cssContainingText('option', template)).click();
              };
      Severity: Minor
      Found in e2e/client/specs/helpers/desks.ts and 1 other location - About 35 mins to fix
      e2e/client/specs/helpers/desks.ts on lines 289..291

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

      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