Showing 11 of 13 total issues
File postmate.js
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
require('json.date-extensions');
/**
* The type of messages our frames our sending
* @type {String}
Function exports
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (config) {
config.set({
sauceLabs: {
testName: 'Encrypted Postmate',
startConnect: false,
Function sendHandshake
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
sendHandshake(url) {
const childOrigin = resolveOrigin(url);
const messageType = this.messageType;
let attempt = 0;
let responseInterval;
Function constructor
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(info) {
this.model = info.model;
this.parent = info.parent;
this.parentOrigin = info.parentOrigin;
this.child = info.child;
Function constructor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
constructor(info) {
this.parent = info.parent;
this.frame = info.frame;
this.child = info.child;
this.childOrigin = info.childOrigin;
- 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
}[message.data.postmate]) return false;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
if (typeof message.data.postmate === 'object') return true;
Function handleHandshakeData
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
handleHandshakeData(data) {
// Extend model with the one provided by the parent
const defaults = data.model;
if (defaults) {
- 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 sanitize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function sanitize(message, allowedOrigin, messageType) {
if (message.origin !== allowedOrigin) return false;
if (typeof message.data !== 'object') return false;
if (!('postmate' in message.data)) return false;
if (message.data.type !== messageType) return false;
- 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 resolveOrigin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function resolveOrigin(url) {
const a = document.createElement('a');
a.href = url;
- 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"