exiguus/js.device.selector

View on GitHub
src/js/device.selector.class.test.js

Summary

Maintainability
A
0 mins
Test Coverage

File device.selector.class.test.js has 464 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

import 'babel-polyfill';
import DeviceSelector from './device.selector.class';

describe('DeviceSelector class', () => {
  let markup;
Severity: Minor
Found in src/js/device.selector.class.test.js - About 7 hrs to fix

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

      it('DeviceSelector settings is eq Object', () => {
        const deviceSelector = new DeviceSelector({
          'selector': {
            'name': '.namespace__m-device-selector',
            'parent': {
    Severity: Major
    Found in src/js/device.selector.class.test.js and 1 other location - About 7 hrs to fix
    src/js/device.selector.class.test.js on lines 224..267

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

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

      it('DeviceSelector options is eq Object', () => {
        const deviceSelector = new DeviceSelector({
          'selector': {
            'name': '.namespace__m-device-selector',
            'parent': {
    Severity: Major
    Found in src/js/device.selector.class.test.js and 1 other location - About 7 hrs to fix
    src/js/device.selector.class.test.js on lines 365..408

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

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

      it('DeviceSelector get displayType return string', () => {
        const deviceSelector = new DeviceSelector({
          'selector': {
            'name': '.namespace__m-device-selector',
            'parent': {
    Severity: Major
    Found in src/js/device.selector.class.test.js and 1 other location - About 4 hrs to fix
    src/js/device.selector.class.test.js on lines 435..458

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

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

      it('DeviceSelector get deviceType return string', () => {
        const deviceSelector = new DeviceSelector({
          'selector': {
            'name': '.namespace__m-device-selector',
            'parent': {
    Severity: Major
    Found in src/js/device.selector.class.test.js and 1 other location - About 4 hrs to fix
    src/js/device.selector.class.test.js on lines 485..508

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

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

      it('DeviceSelector get displayType is function', () => {
        const deviceSelector = new DeviceSelector({
          'selector': {
            'name': '.namespace__m-device-selector',
            'parent': {
    Severity: Major
    Found in src/js/device.selector.class.test.js and 4 other locations - About 3 hrs to fix
    src/js/device.selector.class.test.js on lines 199..222
    src/js/device.selector.class.test.js on lines 269..292
    src/js/device.selector.class.test.js on lines 340..363
    src/js/device.selector.class.test.js on lines 410..433

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

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

      it('DeviceSelector settings is Object', () => {
        const deviceSelector = new DeviceSelector({
          'selector': {
            'name': '.namespace__m-device-selector',
            'parent': {
    Severity: Major
    Found in src/js/device.selector.class.test.js and 4 other locations - About 3 hrs to fix
    src/js/device.selector.class.test.js on lines 199..222
    src/js/device.selector.class.test.js on lines 269..292
    src/js/device.selector.class.test.js on lines 410..433
    src/js/device.selector.class.test.js on lines 460..483

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

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

      it('DeviceSelector get deviceType is function', () => {
        const deviceSelector = new DeviceSelector({
          'selector': {
            'name': '.namespace__m-device-selector',
            'parent': {
    Severity: Major
    Found in src/js/device.selector.class.test.js and 4 other locations - About 3 hrs to fix
    src/js/device.selector.class.test.js on lines 199..222
    src/js/device.selector.class.test.js on lines 269..292
    src/js/device.selector.class.test.js on lines 340..363
    src/js/device.selector.class.test.js on lines 460..483

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

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

      it('DeviceSelector options is Object', () => {
        const deviceSelector = new DeviceSelector({
          'selector': {
            'name': '.namespace__m-device-selector',
            'parent': {
    Severity: Major
    Found in src/js/device.selector.class.test.js and 4 other locations - About 3 hrs to fix
    src/js/device.selector.class.test.js on lines 269..292
    src/js/device.selector.class.test.js on lines 340..363
    src/js/device.selector.class.test.js on lines 410..433
    src/js/device.selector.class.test.js on lines 460..483

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

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

      it('DeviceSelector defaults is Object', () => {
        const deviceSelector = new DeviceSelector({
          'selector': {
            'name': '.namespace__m-device-selector',
            'parent': {
    Severity: Major
    Found in src/js/device.selector.class.test.js and 4 other locations - About 3 hrs to fix
    src/js/device.selector.class.test.js on lines 199..222
    src/js/device.selector.class.test.js on lines 340..363
    src/js/device.selector.class.test.js on lines 410..433
    src/js/device.selector.class.test.js on lines 460..483

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

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

      it('DeviceSelector settings is eq Object', () => {
        const deviceSelector = new DeviceSelector();
        expect(deviceSelector._settings).toEqual({
          selector: {
            name: '[data-device-selector]',
    Severity: Major
    Found in src/js/device.selector.class.test.js and 1 other location - About 3 hrs to fix
    src/js/device.selector.class.test.js on lines 50..73

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

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

      it('DeviceSelector defaults is eq Object', () => {
        const deviceSelector = new DeviceSelector();
        expect(deviceSelector._defaults).toEqual({
          selector: {
            name: '[data-device-selector]',
    Severity: Major
    Found in src/js/device.selector.class.test.js and 1 other location - About 3 hrs to fix
    src/js/device.selector.class.test.js on lines 75..98

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

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

      beforeEach(function() {
        markup = '<div id="customParent">' +
          '<div data-device-selector>' +
            '<div data-device-selector-item ' +
              'data-device-selector-devicetype="mobile"></div>' +
    Severity: Major
    Found in src/js/device.selector.class.test.js and 1 other location - About 2 hrs to fix
    src/js/device.selector.class.test.js on lines 151..167

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

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

      beforeEach(function() {
        markup = '<div class="namespace">' +
        '<div class="namespace__m-device-selector">' +
          '<div class="namespace__m-device-selector__item" ' +
              'data-ds-devicetype="m"></div>' +
    Severity: Major
    Found in src/js/device.selector.class.test.js and 1 other location - About 2 hrs to fix
    src/js/device.selector.class.test.js on lines 7..23

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

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

      it('DeviceSelector get deviceType return string', () => {
        const deviceSelector = new DeviceSelector();
        expect(typeof deviceSelector.deviceType()).toBe('string');
      });
    Severity: Minor
    Found in src/js/device.selector.class.test.js and 1 other location - About 35 mins to fix
    src/js/device.selector.class.test.js on lines 120..123

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

      it('DeviceSelector get displayType return string', () => {
        const deviceSelector = new DeviceSelector();
        expect(typeof deviceSelector.displayType()).toBe('string');
      });
    Severity: Minor
    Found in src/js/device.selector.class.test.js and 1 other location - About 35 mins to fix
    src/js/device.selector.class.test.js on lines 110..113

    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