timgabets/electron-atm

View on GitHub

Showing 39 of 39 total issues

Function getPaymentScheme has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  getPaymentScheme(cardnumber){
    if(cardnumber[0] === '4')
      return 'VISA';

    switch(cardnumber.substr(0, 2)){
Severity: Minor
Found in src/services/cards.js - About 1 hr to fix

Function buildFITsList has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function buildFITsList(){
    fits.get().forEach( (fit) => {
      fit_record = '<tr>';

      fit_record += '<td>'
Severity: Minor
Found in src/listeners/fits.js - About 1 hr to fix

Function processCustomizationCommand has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  processCustomizationCommand(data){
    switch(data.message_identifier){
    case 'Screen Data load':
      if(this.screens.add(data.screens))
        return this.replySolicitedStatus('Ready'); 
Severity: Minor
Found in src/controllers/atm.js - About 1 hr to fix

Function processInformationEntryState has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  processInformationEntryState(state){
    this.display.setScreenByNumber(state.get('screen_number'));
    let active_mask = '0';
    [ state.get('FDK_A_next_state'),
      state.get('FDK_B_next_state'),
Severity: Minor
Found in src/controllers/atm.js - About 1 hr to fix

Function processCustomizationCommand has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  processCustomizationCommand(data){
    switch(data.message_identifier){
    case 'Screen Data load':
      if(this.screens.add(data.screens))
        return this.replySolicitedStatus('Ready'); 
Severity: Minor
Found in src/controllers/atm.js - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function getTerminalStateReply has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  getTerminalStateReply(command_code){
    let reply = {};

    if(command_code)
      reply.terminal_command = command_code;
Severity: Minor
Found in src/controllers/atm.js - About 1 hr to fix

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

        case '3': // Display data as keyed in. Store data in general-purpose Buffer B
          this.buffer_B = this.buffer_B.substr(0, this.buffer_B.length - 1);
          buffer = this.buffer_B;
          break;
Severity: Minor
Found in src/controllers/atm.js and 1 other location - About 55 mins to fix
src/controllers/atm.js on lines 1015..1018

Duplicated Code

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

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

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

Tuning

This issue has a mass of 54.

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

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

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

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

Refactorings

Further Reading

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

        case '1': // Display data as keyed in. Store data in general-purpose Buffer C
          this.buffer_C = this.buffer_C.substr(0, this.buffer_C.length - 1);
          buffer = this.buffer_C;
          break;
Severity: Minor
Found in src/controllers/atm.js and 1 other location - About 55 mins to fix
src/controllers/atm.js on lines 1024..1027

Duplicated Code

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

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

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

Tuning

This issue has a mass of 54.

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

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

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

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

Refactorings

Further Reading

Function processStateX has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  processStateX(state, extension_state){
    this.display.setScreenByNumber(state.get('screen_number'));
    this.setFDKsActiveMask(state.get('FDK_active_mask'));

    let button = this.buttons_pressed.shift();
Severity: Minor
Found in src/controllers/atm.js - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

  setTerminalKey(key){
    this.keys.pin_key.key = key;
    this.settings.set('pin_key', key);
  }
Severity: Minor
Found in src/services/crypto.js and 1 other location - About 40 mins to fix
src/services/crypto.js on lines 27..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 48.

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

  setMasterKey(key){
    this.keys.master_key.key = key;
    this.settings.set('master_key', key);
  }
Severity: Minor
Found in src/services/crypto.js and 1 other location - About 40 mins to fix
src/services/crypto.js on lines 36..39

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

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

    case 'Screen Data load':
      if(this.screens.add(data.screens))
        return this.replySolicitedStatus('Ready'); 
      else
        return this.replySolicitedStatus('Command Reject');
Severity: Minor
Found in src/controllers/atm.js and 2 other locations - About 35 mins to fix
src/controllers/atm.js on lines 212..216
src/controllers/atm.js on lines 218..222

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

    case 'State Tables load':
      if(this.states.add(data.states))
        return this.replySolicitedStatus('Ready'); 
      else
        return this.replySolicitedStatus('Command Reject');
Severity: Minor
Found in src/controllers/atm.js and 2 other locations - About 35 mins to fix
src/controllers/atm.js on lines 206..210
src/controllers/atm.js on lines 218..222

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

    case 'FIT Data load':
      if(this.FITs.add(data.FITs))
        return this.replySolicitedStatus('Ready');
      else
        return this.replySolicitedStatus('Command Reject');
Severity: Minor
Found in src/controllers/atm.js and 2 other locations - About 35 mins to fix
src/controllers/atm.js on lines 206..210
src/controllers/atm.js on lines 212..216

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

Avoid too many return statements within this function.
Open

        return this.replySolicitedStatus('Ready');
Severity: Major
Found in src/controllers/atm.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return this.replySolicitedStatus('Command Reject');
Severity: Major
Found in src/controllers/atm.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return this.replySolicitedStatus('Command Reject');
Severity: Major
Found in src/controllers/atm.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

      return this.replySolicitedStatus('Command Reject');
Severity: Major
Found in src/controllers/atm.js - About 30 mins to fix

Avoid too many return statements within this function.
Open

        return this.replySolicitedStatus('Ready');
Severity: Major
Found in src/controllers/atm.js - About 30 mins to fix
Severity
Category
Status
Source
Language