emiloberg/node-red-contrib-mopidy

View on GitHub

Showing 9 of 15 total issues

Function exports has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function(RED) {
    'use strict';
    function mopidyOutNode(n) {

        this.RED = RED;
Severity: Minor
Found in src/mopidy-out.js - About 1 day 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 exports has 158 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(RED) {
    'use strict';
    function mopidyOutNode(n) {

        this.RED = RED;
Severity: Major
Found in src/mopidy-out.js - About 6 hrs to fix

    Function mopidyOutNode has 155 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function mopidyOutNode(n) {
    
            this.RED = RED;
            this.servers = servers;
            this.objectPath = objectPath;
    Severity: Major
    Found in src/mopidy-out.js - About 6 hrs to fix

      Function invokeMethod has 82 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              this.invokeMethod = (incomingMsg = {}) => {
                  if (typeof incomingMsg !== 'object') {
                      this.error(this.RED._('mopidy-out.validation.data-must-be-object'));
                      return;
                  }
      Severity: Major
      Found in src/mopidy-out.js - About 3 hrs to fix

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

        module.exports = function(RED) {
            'use strict';
            function mopidyInNode(n) {
        
                this.RED = RED;
        Severity: Minor
        Found in src/mopidy-in.js - About 1 hr to fix

          Function mopidyInNode has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function mopidyInNode(n) {
          
                  this.RED = RED;
                  this.servers = servers;
                  this.objectPath = objectPath;
          Severity: Minor
          Found in src/mopidy-in.js - About 1 hr to fix

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

            module.exports = function(RED) {
                'use strict';
                function mopidyInNode(n) {
            
                    this.RED = RED;
            Severity: Minor
            Found in src/mopidy-in.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 routeMethods has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    this.routeMethods = (req, res) => {
                        let tempServerNode = this.RED.nodes.getNode(req.params.nodeId);
            
                        if (tempServerNode === undefined || tempServerNode === null) {
                            res.status(404).json({
            Severity: Minor
            Found in src/mopidy-out.js - About 1 hr to fix

              Avoid too many return statements within this function.
              Open

                              return;
              Severity: Major
              Found in src/mopidy-out.js - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language