Showing 10 of 17 total issues
Function plugin
has 169 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function plugin(opts) {
opts = normalize(opts);
return function(files, metalsmith, done) {
// normalize each collections' backend options
Function getBlockCompilerOnSteroids
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
Open
function getBlockCompilerOnSteroids(opts) {
opts = normalize(opts);
return function blockCompilerOnSteroids(files, file, data) {
return rhoSteroid(
- 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 getBlockCompilerOnSteroids
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getBlockCompilerOnSteroids(opts) {
opts = normalize(opts);
return function blockCompilerOnSteroids(files, file, data) {
return rhoSteroid(
Function blockCompilerOnSteroids
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return function blockCompilerOnSteroids(files, file, data) {
return rhoSteroid(
{
renderImg: function(escapedAlt, src, flags) {
if (checkOwnUrl(src)) {
Function registerPostOnCategory
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function registerPostOnCategory(collectionId, categoryName, postData) {
// check if exists, if not append it to proper tree
var categoryHierarchy = getCollectionContentHierarchy(categoryName);
var collection = _.findWhere(collections, {id: collectionId});
Function build
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function build() {
if (config.args.skipBackend === true) {
debug("Skipping backend build because it is disabled by parameters.");
return Promise.resolve();
}
Function plugin
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function plugin(options) {
options = normalize(options);
return function(files, metalsmith, done) {
var processedCollections = metalsmith.metadata().collections;
Function downloadFrontendAssets
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function downloadFrontendAssets() {
if (config.args.skipFrontend === true) {
debug("Skipping frontend asset generation due to config.");
return Promise.resolve();
}
Function normalizeUrl
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function normalizeUrl(urlWithReference) {
var surlWithReference = s(urlWithReference);
var atCount = surlWithReference.count("@");
if (atCount === 1 || atCount > 2) {
throw new Error("Can't parse id identifiers: " + urlWithReference);
Function getConfig
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
function getConfig() {
if (cachedConfig === null) {
var customConfig = {};
var defaultConfig = require("../conf/default.js");
- 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"