zuazo/node-jmx

View on GitHub

Showing 19 of 24 total issues

Function invoke has 42 lines of code (exceeds 25 allowed). Consider refactoring.
Open

JavaJmx.prototype.invoke = function(mbean, methodName, params, signatureOrCallback, callback) {

  function generateJavaSignature(params) {
    var self = this;

Severity: Minor
Found in lib/javaJmx.js - About 1 hr to fix

    Function connect has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    MBeanServerConnection.prototype.connect = function(jmxServiceUrl) {
    
      function GetCredentials(callback) {
        var self = this;
        var credentials = java.newArray("java.lang.String", [ self.username, self.password ]);
    Severity: Minor
    Found in lib/adapters/mbeanServerConnection.js - About 1 hr to fix

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

      JavaJmx.prototype.setAttribute = function(mbean, attributeName, value, classNameOrCallback, callback) {
        function setAttribute(mbean, attributeName, value, callback) {
          java.newInstance("javax.management.Attribute", attributeName, value, function(err, attribute) {
            if (checkError(err, self)) return;
            self.mbeanServerConnection.queryMBeans(null, mbean, function(instance) {
      Severity: Minor
      Found in lib/javaJmx.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 invokeMethod has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      JavaReflection.prototype.invokeMethod = function(obj, methodName, paramsClass, params, callback) {
        var self = this;
      
        function getMethod(obj, methodName, paramsClass, callback) {
      
      
      Severity: Minor
      Found in lib/adapters/javaReflection.js - About 1 hr to fix

        Function queryMBeans has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        MBeanServerConnection.prototype.queryMBeans = function(objName, query, callback, end_callback) {
        
          function createQueryObject(callback) {
            if (query) {
              java.newInstance("javax.management.ObjectName", query, function(err, queryObject) {
        Severity: Minor
        Found in lib/adapters/mbeanServerConnection.js - About 1 hr to fix

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

          JavaJmx.prototype.setAttribute = function(mbean, attributeName, value, classNameOrCallback, callback) {
            function setAttribute(mbean, attributeName, value, callback) {
              java.newInstance("javax.management.Attribute", attributeName, value, function(err, attribute) {
                if (checkError(err, self)) return;
                self.mbeanServerConnection.queryMBeans(null, mbean, function(instance) {
          Severity: Minor
          Found in lib/javaJmx.js - About 1 hr to fix

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

            function v8ToJavaClass(param) {
              if (isString(param)) {
                return "java.lang.String";
              }
              if (isLong(param)) {
            Severity: Minor
            Found in lib/adapters/helpers/conversions.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

            Function Client has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function Client(serviceOrHost, port, protocol, urlPath, username, password) {
            Severity: Minor
            Found in lib/client.js - About 45 mins to fix

              Function invokeMethod has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              JavaReflection.prototype.invokeMethod = function(obj, methodName, paramsClass, params, callback) {
              Severity: Minor
              Found in lib/adapters/javaReflection.js - About 35 mins to fix

                Function setAttribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                JavaJmx.prototype.setAttribute = function(mbean, attributeName, value, classNameOrCallback, callback) {
                Severity: Minor
                Found in lib/javaJmx.js - About 35 mins to fix

                  Function invoke has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  MBeanServerConnection.prototype.invoke = function(name, operationName, params, signature, callback) {
                  Severity: Minor
                  Found in lib/adapters/mbeanServerConnection.js - About 35 mins to fix

                    Function invoke has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    JavaJmx.prototype.invoke = function(mbean, methodName, params, signatureOrCallback, callback) {
                    Severity: Minor
                    Found in lib/javaJmx.js - About 35 mins to fix

                      Function invoke has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      Client.prototype.invoke = function(mbean, methodName, params, signatureOrCallback, callback) {
                      Severity: Minor
                      Found in lib/client.js - About 35 mins to fix

                        Function setAttribute has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        Client.prototype.setAttribute = function(mbean, attribute, value, classNameOrCallback, callback) {
                        Severity: Minor
                        Found in lib/client.js - About 35 mins to fix

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

                          MBeanServerConnection.prototype.queryMBeans = function(objName, query, callback, end_callback) {
                          
                            function createQueryObject(callback) {
                              if (query) {
                                java.newInstance("javax.management.ObjectName", query, function(err, queryObject) {
                          Severity: Minor
                          Found in lib/adapters/mbeanServerConnection.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

                          Avoid too many return statements within this function.
                          Open

                              return param.getClassSync().getNameSync();
                          Severity: Major
                          Found in lib/adapters/helpers/conversions.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return "double";
                            Severity: Major
                            Found in lib/adapters/helpers/conversions.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return "java.lang.Object";
                              Severity: Major
                              Found in lib/adapters/helpers/conversions.js - About 30 mins to fix

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

                                function JmxServiceUrlBuilder(serviceOrHost, port, protocol, urlPath)  {
                                  if (typeof serviceOrHost !== "string") {
                                    throw Error("JmxServiceUrlBuilder(): first argument, serviceOrHost, should be a string");
                                  }
                                  if (serviceOrHost.substr(0, 12) === "service:jmx:") {
                                Severity: Minor
                                Found in lib/adapters/helpers/jmxServiceUrlBuilder.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