Showing 53 of 286 total issues
Function type
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function type (val) {
switch (Object.prototype.toString.call(val)) {
case '[object Date]':
return 'Date';
case '[object RegExp]':
- Read upRead up
- Create a ticketCreate a ticket
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 _reduceRectItemToArea
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Screenshot.prototype._reduceRectItemToArea = function (item, area) {
if (item.x < area.x) {
item.width -= Math.abs(item.x - area.x);
item.x = area.x;
- Create a ticketCreate a ticket
Function logMethod
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function logMethod (name, method) {
var result = function () {
var args = Array.prototype.slice.call(arguments);
var event = {
name: name,
- Create a ticketCreate a ticket
Function deviceInfo
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function deviceInfo () {
return {
userAgent: window.navigator.userAgent,
app: {
- Create a ticketCreate a ticket
Function _stitchImages
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Screenshot.prototype._stitchImages = function (area, sections, devicePixelRatio) {
var image;
image = PNGImage.createImage(
- Create a ticketCreate a ticket
Function _gatherViewPortSections
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Screenshot.prototype._gatherViewPortSections = function (section, padding, initData, index) {
var viewPorts = [],
sectionWidth = section.width,
- Create a ticketCreate a ticket
Function saveScreenshot
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
ActiveWindow.prototype.saveScreenshot = function (path, options) {
return when(this.captureDocument(options), function (buffer) {
if (this._driver.isSync()) {
fs.writeFileSync(path, buffer);
} else {
- Read upRead up
- Create a ticketCreate a ticket
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 compareArea
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Chain.prototype.compareArea = function (title, x, y, width, height, options, callBack) {
- Create a ticketCreate a ticket
Function init
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
init: function (needsStitching) {
var initData = {
viewPort: {},
document: {},
- Read upRead up
- Create a ticketCreate a ticket
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 drawRect
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function drawRect (image, x, y, width, height, color) {
- Create a ticketCreate a ticket
Function compareArea
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
ActiveWindow.prototype.compareArea = function (title, x, y, width, height, options) {
- Create a ticketCreate a ticket
Function _reduceRectItemToArea
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Screenshot.prototype._reduceRectItemToArea = function (item, area) {
if (item.x < area.x) {
item.width -= Math.abs(item.x - area.x);
item.x = area.x;
- Read upRead up
- Create a ticketCreate a ticket
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 captureArea
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Chain.prototype.captureArea = function (x, y, width, height, options, callBack) {
- Create a ticketCreate a ticket
Function _validateArea
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Screenshot.prototype._validateArea = function (area, padding, initData) {
if (area.width < 0) {
throw new Error('Width of area to capture cannot be negative.');
}
- Read upRead up
- Create a ticketCreate a ticket
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
Consider simplifying this complex logical expression. Open
} else if (res.statusCode >= 500 && res.statusCode < 600) { // 500s
body = JSON.parse(res.body);
hasScreenshot = body && body.value && body.value.screen;
hasLogFolder = this._options && this._options.logDir;
- Create a ticketCreate a ticket
Function parsedRequest
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Connection.prototype.parsedRequest = function (session, method, path, options, retryCounter) {
- Create a ticketCreate a ticket
Function captureArea
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ActiveWindow.prototype.captureArea = function (x, y, width, height, options) {
- Create a ticketCreate a ticket
Function waitForElementVisible
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Nightwatch.prototype.waitForElementVisible = function (selector, time, abortOnFailure, cb, message) {
- Create a ticketCreate a ticket
Function elementClickAt
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Chain.prototype.elementClickAt = function (selector, xOffset, yOffset, button, callBack) {
- Create a ticketCreate a ticket
Function waitUntil
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Utils.prototype.waitUntil = function (fn, timeOut, wait, message, timeOutFn) {
- Create a ticketCreate a ticket