zuazo/node-jmx

View on GitHub

Showing 24 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

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

          self.mbeanServerConnection.queryMBeans(null, mbean, function(instance) {
            instance.getObjectName(function(err, objectName) {
              if (checkError(err, self)) return;
              self.mbeanServerConnection.setAttribute(objectName, attribute, callback);
            });
    Severity: Major
    Found in lib/javaJmx.js and 1 other location - About 1 hr to fix
    lib/javaJmx.js on lines 73..78

    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

      self.mbeanServerConnection.queryMBeans(null, mbean, function(instance) {
        instance.getObjectName(function(err, objectName) {
          if (checkError(err, self)) return;
          self.mbeanServerConnection.getAttribute(objectName, attributeName, callback);
        });
    Severity: Major
    Found in lib/javaJmx.js and 1 other location - About 1 hr to fix
    lib/javaJmx.js on lines 165..170

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

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

            MBeanServerConnection.prototype.getDefaultDomain = function(callback) {
              this.javaReflection.invokeMethod(
                this.mbeanServerConnection,
                "getDefaultDomain",
                [], // methodParamsClass
            Severity: Major
            Found in lib/adapters/mbeanServerConnection.js and 2 other locations - About 45 mins to fix
            lib/adapters/mbeanServerConnection.js on lines 121..129
            lib/adapters/mbeanServerConnection.js on lines 131..139

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

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

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

              MBeanServerConnection.prototype.getDomains = function(callback) {
                this.javaReflection.invokeMethod(
                  this.mbeanServerConnection,
                  "getDomains",
                  [], // methodParamsClass
              Severity: Major
              Found in lib/adapters/mbeanServerConnection.js and 2 other locations - About 45 mins to fix
              lib/adapters/mbeanServerConnection.js on lines 111..119
              lib/adapters/mbeanServerConnection.js on lines 131..139

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

              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

              MBeanServerConnection.prototype.getMBeanCount = function(callback) {
                this.javaReflection.invokeMethod(
                  this.mbeanServerConnection,
                  "getMBeanCount",
                  [], // methodParamsClass
              Severity: Major
              Found in lib/adapters/mbeanServerConnection.js and 2 other locations - About 45 mins to fix
              lib/adapters/mbeanServerConnection.js on lines 111..119
              lib/adapters/mbeanServerConnection.js on lines 121..129

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

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

                          Severity
                          Category
                          Status
                          Source
                          Language