Showing 527 of 527 total issues
Function exports
has 832 lines of code (exceeds 25 allowed). Consider refactoring. Open
.then((Taggable, Role, knex) => {
SCli.debug(__MODULE_NAME, 'READY');
/**
Identical blocks of code found in 2 locations. Consider refactoring. Open
dust.filters.media = function (value) {
var returnString = '';
if (value.mime === 'video/youtube') {
returnString += '<iframe type="text/html" src="https://www.youtube.com/embed/' + isYoutube(value.source) + '" frameborder="0"></iframe>';
} else if (value.mime === 'video/vimeo') {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 648.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
dust.filters.media = function (value) {
var returnString = '';
if (value.mime === 'video/youtube') {
returnString += '<iframe type="text/html" src="https://www.youtube.com/embed/' + isYoutube(value.source) + '" frameborder="0"></iframe>';
} else if (value.mime === 'video/vimeo') {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 648.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function exports
has 623 lines of code (exceeds 25 allowed). Consider refactoring. Open
.then((knex) => {
return knex
.schema
.dropTableIfExists('objection')
.then(() => {
Function exports
has 492 lines of code (exceeds 25 allowed). Consider refactoring. Open
.then((knex) => {
SCli.debug(__MODULE_NAME, 'Knex initted');
return Schema
Function exports
has a Cognitive Complexity of 112 (exceeds 5 allowed). Consider refactoring. Open
.then((knex) => {
return knex
.schema
.dropTableIfExists('objection')
.then(() => {
- 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 index.js
has 853 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint no-underscore-dangle:0 */
/* jslint node:true, esnext:true */
/* globals LACKEY_PATH */
'use strict';
Function exports
has 377 lines of code (exceeds 25 allowed). Consider refactoring. Open
.then((Taggable, User, Taxonomy, TaxonomyType, Template, knexSchema, QueryBuilder, configuration) => {
SCli.debug(__MODULE_NAME, 'READY');
class ContentModel extends Model {
Function exports
has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring. Open
.then((Taggable, Role, knex) => {
SCli.debug(__MODULE_NAME, 'READY');
/**
- 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 exports
has 363 lines of code (exceeds 25 allowed). Consider refactoring. Open
.then((ContentModel, Taxonomy, TaxonomyType, Template, User, Preview) => {
class PageController {
static preview(req, res, next) {
File structure.ui.js
has 740 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint no-cond-assign:0, no-new:0, no-unused-vars:0 */
/* jslint browser:true, node:true, esnext:true */
'use strict';
/*
Copyright 2016 Enigma Marketing Services Limited
Function exports
has 335 lines of code (exceeds 25 allowed). Consider refactoring. Open
.then((Taggable, QueryBuilder) => {
SCli.debug(__MODULE_NAME, 'READY');
class MediaModel extends Model {
Function format
has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring. Open
module.exports.format = (req, res, next) => {
var isYAML = (/(.*).yaml/).test(req.path),
isJSON = !isYAML && ((/(.*).json$/).test(req.path) || (/^\/api\//).test(req.path)),
isXLS = !isJSON && !isYAML && (/(.*).xlsx/).test(req.path),
isHTML = !isJSON && !isYAML && !isXLS;
- 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 table.js
has 643 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* jslint node:true, esnext:true, es6:true, browser:true, loopfunc:true*/
/* eslint no-param-reassign:0 no-alert:0 */
'use strict';
/*
Copyright 2016 Enigma Marketing Services Limited
File index.js
has 636 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint no-underscore-dangle:0 */
/* jslint node:true, esnext:true */
/* globals LACKEY_PATH */
'use strict';
Function exports
has 271 lines of code (exceeds 25 allowed). Consider refactoring. Open
.then((Taggable, TaxonomyType) => {
SCli.debug(__MODULE_NAME, 'READY');
/**
Function print
has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring. Open
function print(chunk, data, type, editMode, dust, log, config) {
let source;
SCli.debug('lackey-cms/modules/cms/server/lib/dust/media', 'Print', JSON.stringify(data, null, 4));
- 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
Similar blocks of code found in 5 locations. Consider refactoring. Open
return Schema
//
// TABLE Users
//
.table(knex, 'users', table => {
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 230.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function exports
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
.then((knex) => {
class ContentQueryBuilder {
constructor() {
- 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
Similar blocks of code found in 2 locations. Consider refactoring. Open
invalidateToken(token) {
SCli.debug(__MODULE_NAME, 'invalidateToken');
let self = this;
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 218.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76