Showing 60 of 126 total issues
File fragments.js
has 774 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
var documents = require('./documents');
var DateUtils = require('./utils/date');
var WithFragments = documents.WithFragments;
File api.js
has 526 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
var Requests = require('./requests'),
Cookies = require('./cookies'),
documents = require('./documents'),
Function linkedDocuments
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
linkedDocuments: function() {
var i, j, link;
var result = [];
var Fragments = require('./fragments');
for (var field in this.data) {
- 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
File browser.js
has 394 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*eslint-env node, mocha */
/*global chai, Prismic */
/*eslint no-unused-vars: 0 */
var assert = chai.assert;
File documents.js
has 341 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
var DateUtils = require('./utils/date');
/**
Function getText
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
getText: function(name, after) {
var Fragments = require('./fragments');
var fragment = this.get(name);
if (fragment instanceof Fragments.StructuredText) {
- 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
exports
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
module.exports = {
/**
* Convert a predicate (array of 3 elements) into a query for prismic.io (string)
*/
Function asHtml
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
asHtml: function(linkResolver, htmlSerializer) {
var blockGroups = [],
blockGroup,
block,
html = [];
- 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 serialize
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function serialize(element, content, htmlSerializer) {
// Return the user customized output (if available)
if (htmlSerializer) {
var custom = htmlSerializer(element, content);
if (custom) {
- 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
prototype
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
WithFragments.prototype = {
/**
* Gets the fragment in the current Document object. Since you most likely know the type
* of this fragment, it is advised that you use a dedicated method, like get StructuredText() or getDate(),
* for instance.
Function insertSpans
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
function insertSpans(text, spans, linkResolver, htmlSerializer) {
if (!spans || !spans.length) {
return htmlEscape(text);
}
Function submit
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
submit: function(callback) {
var self = this;
var url = this.form.action;
if (this.data) {
- 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 ajaxRequest
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
var ajaxRequest = (function() {
if(typeof XMLHttpRequest != 'undefined' && 'withCredentials' in new XMLHttpRequest()) {
return function(url, callback) {
var xhr = new XMLHttpRequest();
- 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 parse
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
parse: function(data) {
var refs,
master,
forms = {},
form,
prototype
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
Api.prototype = {
// Predicates
AT: "at",
ANY: "any",
Function nodeJSRequest
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
var nodeJSRequest = (function() {
if(typeof require == 'function' && require('http')) {
var http = require('http'),
https = require('https'),
url = require('url'),
Function serialize
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
function serialize(element, content, htmlSerializer) {
// Return the user customized output (if available)
if (htmlSerializer) {
var custom = htmlSerializer(element, content);
if (custom) {
Function asHtml
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
asHtml: function(linkResolver, htmlSerializer) {
var blockGroups = [],
blockGroup,
block,
html = [];
Function initField
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initField(field) {
var classForType = {
"Color": Color,
"Number": Num,
Function linkedDocuments
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
linkedDocuments: function() {
var i, j, link;
var result = [];
var Fragments = require('./fragments');
for (var field in this.data) {