packages/miew/src/gfx/colorers/OccupancyColorer.test.js

Summary

Maintainability
D
3 days
Test Coverage

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

  describe('.id', () => {
    const oColorer = new OccupancyColorer()

    it("have .id property type 'string'", () => {
      expect(oColorer).to.have.property('id')
Severity: Major
Found in packages/miew/src/gfx/colorers/OccupancyColorer.test.js and 10 other locations - About 5 hrs to fix
packages/miew/src/gfx/colorers/CarbonColorer.test.js on lines 46..58
packages/miew/src/gfx/colorers/ChainColorer.test.js on lines 67..79
packages/miew/src/gfx/colorers/ConformationColorer.test.js on lines 58..70
packages/miew/src/gfx/colorers/ElementColorer.test.js on lines 83..95
packages/miew/src/gfx/colorers/HydrophobicityColorer.test.js on lines 89..101
packages/miew/src/gfx/colorers/MoleuleColorer.test.js on lines 106..118
packages/miew/src/gfx/colorers/ResidueTypeColorer.test.js on lines 57..69
packages/miew/src/gfx/colorers/SecondaryStructureColorer.test.js on lines 124..136
packages/miew/src/gfx/colorers/SequenceColorer.test.js on lines 116..128
packages/miew/src/gfx/colorers/UniformColorer.test.js on lines 21..33

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 153.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

  class FirstPalette {
    defaultGradientColor = 0xffffff

    getGradientColor(value, gradientName) {
      if (value === left && gradientName === opts.gradient) {
Severity: Major
Found in packages/miew/src/gfx/colorers/OccupancyColorer.test.js and 2 other locations - About 3 hrs to fix
packages/miew/src/gfx/colorers/HydrophobicityColorer.test.js on lines 15..30
packages/miew/src/gfx/colorers/SequenceColorer.test.js on lines 15..30

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

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

  describe('.shortName', () => {
    it("have .shortName property type 'string'", () => {
      const oColorer = new OccupancyColorer()
      expect(oColorer).to.have.property('shortName')
      expect(oColorer.shortName).to.be.a('string')
Severity: Major
Found in packages/miew/src/gfx/colorers/OccupancyColorer.test.js and 21 other locations - About 2 hrs to fix
packages/miew/src/gfx/colorers/CarbonColorer.test.js on lines 60..66
packages/miew/src/gfx/colorers/CarbonColorer.test.js on lines 68..74
packages/miew/src/gfx/colorers/ChainColorer.test.js on lines 81..87
packages/miew/src/gfx/colorers/ChainColorer.test.js on lines 89..95
packages/miew/src/gfx/colorers/ConformationColorer.test.js on lines 72..78
packages/miew/src/gfx/colorers/ConformationColorer.test.js on lines 80..86
packages/miew/src/gfx/colorers/ElementColorer.test.js on lines 97..103
packages/miew/src/gfx/colorers/ElementColorer.test.js on lines 105..111
packages/miew/src/gfx/colorers/HydrophobicityColorer.test.js on lines 103..109
packages/miew/src/gfx/colorers/HydrophobicityColorer.test.js on lines 111..117
packages/miew/src/gfx/colorers/MoleuleColorer.test.js on lines 120..126
packages/miew/src/gfx/colorers/MoleuleColorer.test.js on lines 128..134
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 135..141
packages/miew/src/gfx/colorers/ResidueTypeColorer.test.js on lines 71..77
packages/miew/src/gfx/colorers/ResidueTypeColorer.test.js on lines 79..85
packages/miew/src/gfx/colorers/SecondaryStructureColorer.test.js on lines 138..144
packages/miew/src/gfx/colorers/SecondaryStructureColorer.test.js on lines 146..152
packages/miew/src/gfx/colorers/SequenceColorer.test.js on lines 130..136
packages/miew/src/gfx/colorers/SequenceColorer.test.js on lines 138..144
packages/miew/src/gfx/colorers/UniformColorer.test.js on lines 35..41
packages/miew/src/gfx/colorers/UniformColorer.test.js on lines 43..49

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

  describe('.name', () => {
    it("have .name property type 'string'", () => {
      const oColorer = new OccupancyColorer()
      expect(oColorer).to.have.property('name')
      expect(oColorer.name).to.be.a('string')
Severity: Major
Found in packages/miew/src/gfx/colorers/OccupancyColorer.test.js and 21 other locations - About 2 hrs to fix
packages/miew/src/gfx/colorers/CarbonColorer.test.js on lines 60..66
packages/miew/src/gfx/colorers/CarbonColorer.test.js on lines 68..74
packages/miew/src/gfx/colorers/ChainColorer.test.js on lines 81..87
packages/miew/src/gfx/colorers/ChainColorer.test.js on lines 89..95
packages/miew/src/gfx/colorers/ConformationColorer.test.js on lines 72..78
packages/miew/src/gfx/colorers/ConformationColorer.test.js on lines 80..86
packages/miew/src/gfx/colorers/ElementColorer.test.js on lines 97..103
packages/miew/src/gfx/colorers/ElementColorer.test.js on lines 105..111
packages/miew/src/gfx/colorers/HydrophobicityColorer.test.js on lines 103..109
packages/miew/src/gfx/colorers/HydrophobicityColorer.test.js on lines 111..117
packages/miew/src/gfx/colorers/MoleuleColorer.test.js on lines 120..126
packages/miew/src/gfx/colorers/MoleuleColorer.test.js on lines 128..134
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 143..149
packages/miew/src/gfx/colorers/ResidueTypeColorer.test.js on lines 71..77
packages/miew/src/gfx/colorers/ResidueTypeColorer.test.js on lines 79..85
packages/miew/src/gfx/colorers/SecondaryStructureColorer.test.js on lines 138..144
packages/miew/src/gfx/colorers/SecondaryStructureColorer.test.js on lines 146..152
packages/miew/src/gfx/colorers/SequenceColorer.test.js on lines 130..136
packages/miew/src/gfx/colorers/SequenceColorer.test.js on lines 138..144
packages/miew/src/gfx/colorers/UniformColorer.test.js on lines 35..41
packages/miew/src/gfx/colorers/UniformColorer.test.js on lines 43..49

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

    it("returns default color which is set for this palette if atom's occupancy is not specified", () => {
      const atom = { occupancy: undefined }

      const color = oColorer.getAtomColor(atom)
      expect(color).to.equal(palette.defaultGradientColor)
Severity: Major
Found in packages/miew/src/gfx/colorers/OccupancyColorer.test.js and 1 other location - About 1 hr to fix
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 113..118

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

    it("returns default color which is set for this palette if residue's occupancy is not specified", () => {
      const residue = { occupancy: undefined }

      const color = oColorer.getResidueColor(residue)
      expect(color).to.equal(palette.defaultGradientColor)
Severity: Major
Found in packages/miew/src/gfx/colorers/OccupancyColorer.test.js and 1 other location - About 1 hr to fix
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 63..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 63.

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

    it('returns left color of gradient for atom with the highest occupancy', () => {
      const atom = { occupancy: 1.0 }
      const color = oColorer.getAtomColor(atom)
      expect(color).to.equal(lGradientColor)
    })
Severity: Major
Found in packages/miew/src/gfx/colorers/OccupancyColorer.test.js and 4 other locations - About 1 hr to fix
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 51..55
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 57..61
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 83..87
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 89..93

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

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

    it('returns middle color of gradient for residue with the middle occupancy', () => {
      const residue = { occupancy: 0.5 }
      const color = oColorer.getResidueColor(residue)
      expect(color).to.equal(cGradientColor)
    })
Severity: Major
Found in packages/miew/src/gfx/colorers/OccupancyColorer.test.js and 4 other locations - About 1 hr to fix
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 45..49
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 51..55
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 57..61
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 83..87

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

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

    it('returns middle color of gradient for atom with the middle occupancy', () => {
      const atom = { occupancy: 0.5 }
      const color = oColorer.getAtomColor(atom)
      expect(color).to.equal(cGradientColor)
    })
Severity: Major
Found in packages/miew/src/gfx/colorers/OccupancyColorer.test.js and 4 other locations - About 1 hr to fix
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 45..49
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 57..61
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 83..87
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 89..93

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

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

    it('returns right color of gradient for atom with the lowest occupancy', () => {
      const atom = { occupancy: 0.0 }
      const color = oColorer.getAtomColor(atom)
      expect(color).to.equal(rGradientColor)
    })
Severity: Major
Found in packages/miew/src/gfx/colorers/OccupancyColorer.test.js and 4 other locations - About 1 hr to fix
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 45..49
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 51..55
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 83..87
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 89..93

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

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

    it('returns left color of gradient for residue with the highest occupancy', () => {
      const residue = { occupancy: 1.0 }
      const color = oColorer.getResidueColor(residue)
      expect(color).to.equal(lGradientColor)
    })
Severity: Major
Found in packages/miew/src/gfx/colorers/OccupancyColorer.test.js and 4 other locations - About 1 hr to fix
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 45..49
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 51..55
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 57..61
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 89..93

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

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

    beforeEach(() => {
      paletteStub = sinon.stub(palettes, 'first').value(palette)
      oColorer = new OccupancyColorer(opts)
    })
Severity: Major
Found in packages/miew/src/gfx/colorers/OccupancyColorer.test.js and 3 other locations - About 35 mins to fix
packages/miew/src/gfx/colorers/HydrophobicityColorer.test.js on lines 37..40
packages/miew/src/gfx/colorers/HydrophobicityColorer.test.js on lines 56..59
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 37..40

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

    beforeEach(() => {
      paletteStub = sinon.stub(palettes, 'first').value(palette)
      oColorer = new OccupancyColorer(opts)
    })
Severity: Major
Found in packages/miew/src/gfx/colorers/OccupancyColorer.test.js and 3 other locations - About 35 mins to fix
packages/miew/src/gfx/colorers/HydrophobicityColorer.test.js on lines 37..40
packages/miew/src/gfx/colorers/HydrophobicityColorer.test.js on lines 56..59
packages/miew/src/gfx/colorers/OccupancyColorer.test.js on lines 75..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 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