Showing 527 of 527 total issues
Function generateAbstractBlock
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
static generateAbstractBlock(block, parentBounds) {
var container = top.document.createElement('figure'),
bounds = block.getAbsoluteBoundingRect(),
promise = Promise.resolve();
container.setAttribute('class', 'block');
Function viewAs
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.viewAs = (req, res, next) => {
return SUtils
.cmsMod('core')
.model('role')
Function end
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
res.end = function (chunk, encoding) {
let sent = false;
try {
Function byTypeAndParam
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
static byTypeAndParam(type, paramName, paramValue) {
let self = this;
return this
Function translate
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.translate = (req, res, next) => {
req.locale = module.exports.defaultLocale;
let route = req.route || req.path,
Function _initModules
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
_initModules() {
SCli.log(__MODULE_NAME, '5. Initing modules');
let _this = this,
current = Promise.resolve();
Function replace
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
replace(newTag) {
let self = this;
Object.keys(this.attributes)
.forEach(attr => {
newTag.setAttribute(attr, self.attributes[attr]);
Function getOptions
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
getOptions() {
let options = this.options,
v = this._viewing,
firstOfMonth = new Date(Date.UTC(v.getUTCFullYear(), v.getUTCMonth(), 1, options.current.getUTCHours(), options.current.getUTCMinutes(), 0, 0)),
dow = firstOfMonth.getUTCDay() - 1,
Function query
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
static query(query, populate, options) {
let self = this;
SCli.debug(__MODULE_NAME, 'query', this.model.tableName);
if (!self.model) {
return Promise.reject('This model doesn\'t supply mongo model reference for shared methods');
Function exports
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (options) => {
return require('../configuration')()
.then((config) => {
if (!transport) {
SCli.debug(__MODULE_NAME, 'createTransport', config.get('mailer.type'));
Function exports
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (app) => {
SCli.debug('lackey-cms/server/basics', 'Setting up');
// Showing stack errors
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (serviceLower === 'youtube') {
videoID = youtube_parser(videoID);
} else if (serviceLower === 'vimeo') {
videoID = vimeo_parser(videoID);
} else if (serviceLower === 'htmlvideo') {
- 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 59.
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
} else if (serviceLower === 'vine') {
videoID = vine_parser(videoID);
} else if (serviceLower === 'prezi') {
videoID = prezi_parser(videoID);
} else if (serviceLower === 'htmlvideo') {
- 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 59.
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 sendConfirmationEmail
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
sendConfirmationEmail: (req, res) => {
let lib, config;
SCli.debug(__MODULE_NAME, 'Respond');
configuration()
.then((cfg) => {
Function exports
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = (dust) => {
function renderBlock(block, chunk, context) {
var output = '';
chunk.tap(function (data) {
Function moveBlock
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
moveBlock(blockElement, beforeBlockElement) {
let self = this,
parentPath = blockElement.getAttribute('data-lky-parent'),
blockIndex = parseInt(blockElement.getAttribute('data-lky-index')),
blockPath = parentPath + '.' + blockIndex,
Function KnexStore
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function KnexStore(opts) {
var self = this,
options = opts || {};
Store.call(self, options);
Function _preQuery
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
static _preQuery(innerQuery, options) {
let query = innerQuery ? JSON.parse(JSON.stringify(innerQuery)) : {},
opts = options ? options : {};
Function open
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
static open(name, vars, controller) {
return template.render(name, vars, {
returnRoot: true
})
.then((root) => {
Function input
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Upload.prototype.input = function (HTMLElement, onClick) {
this._hover = this.hover.bind(this);
this._drop = this.drop.bind(this);
this._pick = this.pick.bind(this);