timgabets/atm-states

View on GitHub

Showing 19 of 19 total issues

Function parseState has 402 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  parseState(data){
    /**
     * [addStateLinks add states_to property to the given state object. After running this function, state.states_to contains state exits]
     * @param {[type]} state      [state]
     * @param {[type]} properties [array of properties, containing the state numbers to go, e.g. ['500', '004']]
Severity: Major
Found in lib/states.js - About 2 days to fix

    File states.js has 647 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    
    const LevelsService = require('atm-state-levels');
    const semver = require('semver');
    const pkgjson = require('../package.json');
    
    
    Severity: Major
    Found in lib/states.js - About 1 day to fix

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

          case 'E':
            parsed.set('description', 'Four FDK selection state');
            [ 'screen_number',
              'timeout_next_state',
              'cancel_next_state',
      Severity: Major
      Found in lib/states.js and 2 other locations - About 2 hrs to fix
      lib/states.js on lines 233..247
      lib/states.js on lines 264..278

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

      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 'F':
            parsed.set('description', 'Amount entry state');
            [ 'screen_number',
              'timeout_next_state',
              'cancel_next_state',
      Severity: Major
      Found in lib/states.js and 2 other locations - About 2 hrs to fix
      lib/states.js on lines 217..231
      lib/states.js on lines 264..278

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

      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 'H':
            parsed.set('description', 'Information Entry State');
            [ 'screen_number',
              'timeout_next_state',
              'cancel_next_state',
      Severity: Major
      Found in lib/states.js and 2 other locations - About 2 hrs to fix
      lib/states.js on lines 217..231
      lib/states.js on lines 233..247

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

      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 '?':
            parsed.set('description', 'Set ICC transaction data');
            [ 'next_state',
              'currency_type',
              'transaction_type',
      Severity: Major
      Found in lib/states.js and 1 other location - About 2 hrs to fix
      lib/states.js on lines 474..486

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

      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 '+':
            parsed.set('description', 'Begin ICC Initialization state');
            [ 'icc_init_started_next_state',
              'icc_init_not_started_next_state',
              'icc_init_requirement',
      Severity: Major
      Found in lib/states.js and 1 other location - About 2 hrs to fix
      lib/states.js on lines 446..458

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 78.

      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 'U':
            parsed.set('description', 'Device Fitness Flow Select State');
            [ 'device_number', 
              'device_available_next_state',
              'device_identifier_grafic',
      Severity: Major
      Found in lib/states.js and 1 other location - About 2 hrs to fix
      lib/states.js on lines 535..549

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

      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 ';':
            parsed.set('description', 'ICC Re-initialize state');
            [ 'good_read_next_state',
              'processing_not_performed_next_state',
              'reinit_method',
      Severity: Major
      Found in lib/states.js and 1 other location - About 2 hrs to fix
      lib/states.js on lines 349..360

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

      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 'z':
            parsed.set('description', 'EMV ICC Application Switch state');
            [ 'next_state',
              'terminal_aid_extension_1',
              'next_state_extension_1',
      Severity: Major
      Found in lib/states.js and 1 other location - About 1 hr to fix
      lib/states.js on lines 421..433

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 68.

      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 '>':
            parsed.set('description', 'Cash deposit state');
            [ 'cancel_key_mask',
              'deposit_key_mask',
              'add_more_key_mask',
      Severity: Major
      Found in lib/states.js and 1 other location - About 1 hr to fix
      lib/states.js on lines 460..472

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

      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 check_version has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

        check_version(){
          if(this.settings){
            let settings_version = this.settings.get('states_version');
            try {
              if(settings_version && !semver.lt(settings_version, this.pkg_version)){
      Severity: Minor
      Found in lib/states.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 add has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

        add(data){
          let result = true;
      
          if(typeof data === 'object') {
            for (let i = 0; i < data.length; i++){
      Severity: Minor
      Found in lib/states.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 parseState has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        parseState(data){
          /**
           * [addStateLinks add states_to property to the given state object. After running this function, state.states_to contains state exits]
           * @param {[type]} state      [state]
           * @param {[type]} properties [array of properties, containing the state numbers to go, e.g. ['500', '004']]
      Severity: Minor
      Found in lib/states.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 addStateArray has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        addStateArray(state_array){
          let state_string = '';
      
          let valid = true;
          state_array.forEach(entry => {
      Severity: Minor
      Found in lib/states.js - About 1 hr to fix

        Function convertMapToObject has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          convertMapToObject(map_state){
            let object_state = {};
            for(let [key, value] of map_state)
              if(value instanceof Set){
                // Converting Set to Array
        Severity: Minor
        Found in lib/states.js - About 35 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

        Function convertObjectToMap has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

          convertObjectToMap(object_state){
            let map_state = new Map();
            for(let key in object_state)
              if(key === 'states_to'){
                let states_to = new Set();
        Severity: Minor
        Found in lib/states.js - About 35 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

        Function getNodes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          getNodes(){
            let nodes = [];
        
            this.updateStateLevels();
        
        
        Severity: Minor
        Found in lib/states.js - About 25 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

        Function getEdges has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          getEdges(){
            let edges = [];
        
            for (let i in this.states){
              let state = this.states[i];
        Severity: Minor
        Found in lib/states.js - About 25 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

        Severity
        Category
        Status
        Source
        Language