streetmix/streetmix

View on GitHub
client/src/util/__tests__/width_units.test.js

Summary

Maintainability
F
1 wk
Test Coverage

File width_units.test.js has 299 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { processWidthInput, prettifyWidth } from '../width_units'
import {
  SETTINGS_UNITS_IMPERIAL,
  SETTINGS_UNITS_METRIC
} from '../../users/constants'
Severity: Minor
Found in client/src/util/__tests__/width_units.test.js - About 3 hrs to fix

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

  it('parses a value with a space between it and the meters unit (3 m)', () => {
    const value = '3 m'

    const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)
    expect(input1).toEqual(3)
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 7 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 306..316
client/src/util/__tests__/width_units.test.js on lines 330..340
client/src/util/__tests__/width_units.test.js on lines 342..352
client/src/util/__tests__/width_units.test.js on lines 354..364
client/src/util/__tests__/width_units.test.js on lines 366..376
client/src/util/__tests__/width_units.test.js on lines 378..388
client/src/util/__tests__/width_units.test.js on lines 390..400

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

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

  it('parses a decimal with `ft` unit and no space (3.75ft)', () => {
    const value = '3.75ft'

    // Even in metric mode, the `ft` should cause the value to be interpreted
    // as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses feet and inches with support for leading zero (0\'-3")', () => {
    const value = "0'-3"

    // Even in metric mode, the `ft` should cause the value to be interpreted
    // as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270

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

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

  it('parses a value with a double-prime symbol (3")', () => {
    const value = '3"'

    // Even in metric mode, the double-prime symbol should cause the value
    // to be interpreted as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses feet and inches with prime and double-prime symbols and hyphen separator (3\'-9")', () => {
    const value = '3\'-9"'

    // Even in metric mode, the `ft` should cause the value to be interpreted
    // as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses a decimal with `ft` unit (3.75 ft)', () => {
    const value = '3.75 ft'

    // Even in metric mode, the `ft` should cause the value to be interpreted
    // as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses a value with meters unit (3m)', () => {
    const value = '3m'

    const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)
    expect(input1).toEqual(3)
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 7 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 318..328
client/src/util/__tests__/width_units.test.js on lines 330..340
client/src/util/__tests__/width_units.test.js on lines 342..352
client/src/util/__tests__/width_units.test.js on lines 354..364
client/src/util/__tests__/width_units.test.js on lines 366..376
client/src/util/__tests__/width_units.test.js on lines 378..388
client/src/util/__tests__/width_units.test.js on lines 390..400

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

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

  it('parses a value with centimeters unit (150cm)', () => {
    const value = '150cm'

    const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)
    expect(input1).toEqual(1.5)
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 7 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 306..316
client/src/util/__tests__/width_units.test.js on lines 318..328
client/src/util/__tests__/width_units.test.js on lines 330..340
client/src/util/__tests__/width_units.test.js on lines 342..352
client/src/util/__tests__/width_units.test.js on lines 354..364
client/src/util/__tests__/width_units.test.js on lines 378..388
client/src/util/__tests__/width_units.test.js on lines 390..400

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

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

  it('parses `inch` unit', () => {
    const value = '36 inches'

    // Even in metric mode, the `inch` should cause the value to be
    // interpreted as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses feet and inches with prime and double-prime symbols (3\'9")', () => {
    const value = '3\'9"'

    // Even in metric mode, the `ft` should cause the value to be interpreted
    // as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses feet and inches with support for leading zero (0\'6")', () => {
    const value = "0'6"

    // Even in metric mode, the `ft` should cause the value to be interpreted
    // as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses a value with the Cyrillic meters unit (3 м)', () => {
    const value = '3 м'

    const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)
    expect(input1).toEqual(3)
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 7 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 306..316
client/src/util/__tests__/width_units.test.js on lines 318..328
client/src/util/__tests__/width_units.test.js on lines 330..340
client/src/util/__tests__/width_units.test.js on lines 342..352
client/src/util/__tests__/width_units.test.js on lines 354..364
client/src/util/__tests__/width_units.test.js on lines 366..376
client/src/util/__tests__/width_units.test.js on lines 378..388

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

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

  it("parses a value with a prime symbol (3')", () => {
    const value = "3'"

    // Even in metric mode, the prime symbol should cause the value to be
    // interpreted as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses feet and inches with prime and double-prime symbols and space separator (3\' 9")', () => {
    const value = '3\' 9"'

    // Even in metric mode, the `ft` should cause the value to be interpreted
    // as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses a decimal value with meters unit (3.0m)', () => {
    const value = '3.0m'

    const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)
    expect(input1).toEqual(3)
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 7 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 306..316
client/src/util/__tests__/width_units.test.js on lines 318..328
client/src/util/__tests__/width_units.test.js on lines 342..352
client/src/util/__tests__/width_units.test.js on lines 354..364
client/src/util/__tests__/width_units.test.js on lines 366..376
client/src/util/__tests__/width_units.test.js on lines 378..388
client/src/util/__tests__/width_units.test.js on lines 390..400

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

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

  it("parses feet and inches with prime and hyphen separator, lacking a final double-prime symbol (3'-9)", () => {
    const value = "3'-9"

    // Even in metric mode, the `ft` should cause the value to be interpreted
    // as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses `feet` unit (3 feet)', () => {
    const value = '3 feet'

    // Even in metric mode, the `feet` should cause the value to be interpreted
    // as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses `inches` unit', () => {
    const value = '6 inches'

    // Even in metric mode, the `inches` should cause the value to be
    // interpreted as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses a decimal value with a space between it and the meters unit (3.0 m)', () => {
    const value = '3.0 m'

    const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)
    expect(input1).toEqual(3)
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 7 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 306..316
client/src/util/__tests__/width_units.test.js on lines 318..328
client/src/util/__tests__/width_units.test.js on lines 330..340
client/src/util/__tests__/width_units.test.js on lines 354..364
client/src/util/__tests__/width_units.test.js on lines 366..376
client/src/util/__tests__/width_units.test.js on lines 378..388
client/src/util/__tests__/width_units.test.js on lines 390..400

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

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

  it('parses a value with millimeters unit (150mm)', () => {
    const value = '150mm'

    const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)
    expect(input1).toEqual(0.15)
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 7 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 306..316
client/src/util/__tests__/width_units.test.js on lines 318..328
client/src/util/__tests__/width_units.test.js on lines 330..340
client/src/util/__tests__/width_units.test.js on lines 342..352
client/src/util/__tests__/width_units.test.js on lines 354..364
client/src/util/__tests__/width_units.test.js on lines 366..376
client/src/util/__tests__/width_units.test.js on lines 390..400

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

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

  it("parses a decimal with prime symbol (3.75')", () => {
    const value = "3.75'"

    // Even in metric mode, the prime symbol should cause the value to be
    // interpreted as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses `in.` unit', () => {
    const value = '24 in.'

    // Even in metric mode, the `in.` should cause the value to be
    // interpreted as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it("parses feet and inches with prime and space separator, lacking a final double-prime symbol (3' 9)", () => {
    const value = "3' 9"

    // Even in metric mode, the `ft` should cause the value to be interpreted
    // as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses a decimal with `ft.` unit (3.75 ft.)', () => {
    const value = '3.75 ft.'

    // Even in metric mode, the `ft` should cause the value to be interpreted
    // as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses `in` unit', () => {
    const value = '12 in'

    // Even in metric mode, the `in` should cause the value to be interpreted
    // as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 200..210
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it("parses feet and inches with prime symbol, lacking a final double-prime symbol (3'9)", () => {
    const value = "3'9"

    // Even in metric mode, the `ft` should cause the value to be interpreted
    // as imperial units
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 18 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 36..46
client/src/util/__tests__/width_units.test.js on lines 48..58
client/src/util/__tests__/width_units.test.js on lines 80..90
client/src/util/__tests__/width_units.test.js on lines 92..102
client/src/util/__tests__/width_units.test.js on lines 104..114
client/src/util/__tests__/width_units.test.js on lines 116..126
client/src/util/__tests__/width_units.test.js on lines 128..138
client/src/util/__tests__/width_units.test.js on lines 140..150
client/src/util/__tests__/width_units.test.js on lines 152..162
client/src/util/__tests__/width_units.test.js on lines 164..174
client/src/util/__tests__/width_units.test.js on lines 176..186
client/src/util/__tests__/width_units.test.js on lines 188..198
client/src/util/__tests__/width_units.test.js on lines 212..222
client/src/util/__tests__/width_units.test.js on lines 224..234
client/src/util/__tests__/width_units.test.js on lines 236..246
client/src/util/__tests__/width_units.test.js on lines 248..258
client/src/util/__tests__/width_units.test.js on lines 260..270
client/src/util/__tests__/width_units.test.js on lines 272..282

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

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

  it('parses a value with decimeters unit (150dm)', () => {
    const value = '150dm'

    const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)
    expect(input1).toEqual(15)
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 7 other locations - About 2 hrs to fix
client/src/util/__tests__/width_units.test.js on lines 306..316
client/src/util/__tests__/width_units.test.js on lines 318..328
client/src/util/__tests__/width_units.test.js on lines 330..340
client/src/util/__tests__/width_units.test.js on lines 342..352
client/src/util/__tests__/width_units.test.js on lines 366..376
client/src/util/__tests__/width_units.test.js on lines 378..388
client/src/util/__tests__/width_units.test.js on lines 390..400

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

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

  it('parses a value with trailing period (3.)', () => {
    const value = '3.'

    const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)
    expect(input1).toEqual(3)
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 3 other locations - About 1 hr to fix
client/src/util/__tests__/width_units.test.js on lines 16..24
client/src/util/__tests__/width_units.test.js on lines 60..68
client/src/util/__tests__/width_units.test.js on lines 70..78

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

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

  it('parses a decimal with trailing zeroes (3.00)', () => {
    const value = '3.00'

    const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)
    expect(input1).toEqual(3)
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 3 other locations - About 1 hr to fix
client/src/util/__tests__/width_units.test.js on lines 16..24
client/src/util/__tests__/width_units.test.js on lines 26..34
client/src/util/__tests__/width_units.test.js on lines 70..78

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

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

  it('parses a value (3)', () => {
    const value = '3'

    const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)
    expect(input1).toEqual(3)
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 3 other locations - About 1 hr to fix
client/src/util/__tests__/width_units.test.js on lines 26..34
client/src/util/__tests__/width_units.test.js on lines 60..68
client/src/util/__tests__/width_units.test.js on lines 70..78

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

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

  it('parses a decimal without units (3.75)', () => {
    const value = '3.75'

    const input1 = processWidthInput(value, SETTINGS_UNITS_METRIC)
    expect(input1).toEqual(3.75)
Severity: Major
Found in client/src/util/__tests__/width_units.test.js and 3 other locations - About 1 hr to fix
client/src/util/__tests__/width_units.test.js on lines 16..24
client/src/util/__tests__/width_units.test.js on lines 26..34
client/src/util/__tests__/width_units.test.js on lines 60..68

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

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