rdepena/node-dualshock-controller

View on GitHub

Showing 17 of 24 total issues

Function Controller has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Controller = function() {
    'use strict';
    Emitter.call(this);

    const controllerConfig = config.getControllerConfig(),
Severity: Major
Found in src/controller.js - About 4 hrs to fix

    Function Buttons has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    var Buttons = function(controller) {
    
        var buttons = config.getControllerConfig().buttons;
    
        // convert strings to numbers, e.g. "0x01" to 0x01
    Severity: Minor
    Found in src/buttons.js - About 3 hrs 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 Controller has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    const Controller = function() {
        'use strict';
        Emitter.call(this);
    
        const controllerConfig = config.getControllerConfig(),
    Severity: Minor
    Found in src/controller.js - About 3 hrs 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 Buttons has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var Buttons = function(controller) {
    
        var buttons = config.getControllerConfig().buttons;
    
        // convert strings to numbers, e.g. "0x01" to 0x01
    Severity: Major
    Found in src/buttons.js - About 2 hrs to fix

      Function exports has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function(grunt) {
          grunt.initConfig({
              watch: {
                  files: files,
                  tasks: ['default']
      Severity: Major
      Found in gruntfile.js - About 2 hrs to fix

        Function printcontrollerEvents has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var printcontrollerEvents = function(controller, controllerConfiguration) {
            'use strict';
            controller.on('left:move', function(data) {
                console.log('left Moved');
                console.log(data);
        Severity: Minor
        Found in examples/consolePrintControllerEvents.js - About 2 hrs to fix

          Function outputSmoothing has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          var outputSmoothing = function(smoothInput) {
              'use strict';
          
              var buffer = {},
                  maxFrames = 5;
          Severity: Minor
          Found in src/smoothing.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 motionProcessor has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var motionProcessor = function(controller) {
          
              var varianceThreshhold = 1,
                  smoothInput = config.getOptions().accelerometerSmoothing,
                  outputSmoothing = new Smoothing(smoothInput),
          Severity: Minor
          Found in src/gyro.js - About 1 hr to fix

            Function Status has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
            Open

            var Status = function(controller) {
            
                var buffer = {},
                    status = config.getControllerConfig().status;
            
            
            Severity: Minor
            Found in src/status.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 processButton has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var processButton = function(button, data) {
                    //make sure the data contains a value for the specified block
                    //and bitwise operation for the button value
            
                    var block = data[button.buttonBlock] & button.mask;
            Severity: Minor
            Found in src/buttons.js - About 1 hr to fix

              Function TouchPad has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports = function TouchPad(controller) {
                  const touchPad = config.getControllerConfig().touchPad;
                  let pBuffer = {};
              
                  function processIsActive(buffer, tpAxis) {
              Severity: Minor
              Found in src/touchpad.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 Analogs has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var Analogs = function(controller) {
              
                  var varianceThreshhold = 1,
                      smoothInput = config.getOptions().analogStickSmoothing,
                      outputSmoothing = new Smoothing(smoothInput),
              Severity: Minor
              Found in src/analogs.js - About 1 hr to fix

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

                var outputSmoothing = function(smoothInput) {
                    'use strict';
                
                    var buffer = {},
                        maxFrames = 5;
                Severity: Minor
                Found in src/smoothing.js - About 1 hr to fix

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

                  module.exports = function TouchPad(controller) {
                      const touchPad = config.getControllerConfig().touchPad;
                      let pBuffer = {};
                  
                      function processIsActive(buffer, tpAxis) {
                  Severity: Minor
                  Found in src/touchpad.js - About 1 hr to fix

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

                    var motionProcessor = function(controller) {
                    
                        var varianceThreshhold = 1,
                            smoothInput = config.getOptions().accelerometerSmoothing,
                            outputSmoothing = new Smoothing(smoothInput),
                    Severity: Minor
                    Found in src/gyro.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 setOptions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                        setOptions: function(opts) {
                            //no options were passed
                            options = opts || {};
                    
                            // Defaults:
                    Severity: Minor
                    Found in src/config.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

                    Function Analogs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    var Analogs = function(controller) {
                    
                        var varianceThreshhold = 1,
                            smoothInput = config.getOptions().analogStickSmoothing,
                            outputSmoothing = new Smoothing(smoothInput),
                    Severity: Minor
                    Found in src/analogs.js - About 45 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