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;
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 ]);
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) {
- Read upRead up
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) {
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) {
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) {
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)) {
- Read upRead up
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) {
Function invokeMethod
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
JavaReflection.prototype.invokeMethod = function(obj, methodName, paramsClass, params, callback) {
Function setAttribute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
JavaJmx.prototype.setAttribute = function(mbean, attributeName, value, classNameOrCallback, callback) {
Function invoke
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
MBeanServerConnection.prototype.invoke = function(name, operationName, params, signature, callback) {
Function invoke
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
JavaJmx.prototype.invoke = function(mbean, methodName, params, signatureOrCallback, callback) {
Function invoke
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Client.prototype.invoke = function(mbean, methodName, params, signatureOrCallback, callback) {
Function setAttribute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Client.prototype.setAttribute = function(mbean, attribute, value, classNameOrCallback, callback) {
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) {
- Read upRead up
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();
Avoid too many return
statements within this function. Open
return "double";
Avoid too many return
statements within this function. Open
return "java.lang.Object";
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:") {
- Read upRead up
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"