rimiti/hl7-object-parser

View on GitHub
__tests__/class/decoder.js

Summary

Maintainability
F
4 days
Test Coverage

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

it(`Encoder - Field attribute missing`, () => {
  const s26 = `MSH|^~\\&|mllp_http_proxy|proxy00-prodaz|mllp_http_proxypartenaire|proxy00-prodpartenaire|20161231110000||SIU^S26|256660|P|2.5.1|||||FRA|UTF-8|\rSCH||49849903800^DimSolution||||100|||||^^30^20161231110000|||||10101041431^KAYSSIEH^BASSEL||||ODS|||||Booked|\rPID|||123456^^^ODS^^PI||DO BAIRRO^Dimitri^^^^^L||19920506|M|Nom usuel||Avenue des Champs-Élysées^^Paris^^75000^^^^^||0100000000^^^dimitri.dobairro@dimsolution.com^^^^~0200000000^^^^^^^|\rRGS|1\rAIG|1|||10101041431@750057689\rNTE|||My comment`;
  const obj = decode(s26, s26FieldMissing);
  expect(obj.msh.message_datetime).toEqual('20161231110000');
  expect(obj.msh.message_type).toEqual('SIU');
Severity: Major
Found in __tests__/class/decoder.js and 6 other locations - About 4 days to fix
__tests__/siu/index.js on lines 9..44
__tests__/siu/index.js on lines 46..81
__tests__/siu/index.js on lines 83..118
__tests__/siu/index.js on lines 120..155
__tests__/siu/index.js on lines 157..192
__tests__/siu/index.js on lines 194..229

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

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