Showing 59 of 59 total issues
Similar blocks of code found in 3 locations. Consider refactoring. Open
fields: function (done) {
dao.getFieldsByModelID(model.data.modelID).then(function (data) {
done(null, data);
}, function (err) {
done(err, null);
- 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 67.
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 3 locations. Consider refactoring. Open
children: function (done) {
dao.getChildJoinsByModelID(model.data.modelID).then(function (data) {
done(null, data);
}, function (err) {
done(err, null);
- 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 67.
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 3 locations. Consider refactoring. Open
steps: function (done) {
dao.getStepsByModelID(model.data.modelID).then(function (data) {
done(null, data);
}, function (err) {
done(err, null);
- 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 67.
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 childUpdate
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function childUpdate(modelDefinition, row, forceDelete) {
return new BluebirdPromise(function (resolve, reject) {
logger.debug('starting childUpdate() for ', modelDefinition.name);
if (!modelDefinition.children) {
Function exports
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (grunt) {
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
Function insertData
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function insertData(modelDefinition, row) {
return new BluebirdPromise(function (resolve, reject) {
logger.debug('starting insertData() for ', modelDefinition.name);
//console.log(row);
Function mapFields
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mapFields(pageDefinition, modelFields) {
pageDefinition.hasFormView = false;
pageDefinition.hasTableView = false;
pageDefinition.hasNavigation = false;
Function addLogins
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addLogins(app) {
app.get('/logout', function (req, res) {
req.logout();
res.redirect('/');
});
Function getSqlReadyRow
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
var sqlReadyRow = (function getSqlReadyRow() {
function included(field) {
function isDefinedAndFalse(value) {
if (value === undefined) {
return false;
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (join.table in tables) {
var toTable = tables[join.table];
step.join = {
name: step.join,
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 61.
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
if (modelDefinition.basisTable in tables) {
var tableDefinition = tables[modelDefinition.basisTable];
modelDefinition.basisTable = {
name: tableDefinition.name,
dbName: tableDefinition.dbName
- 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 61.
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 getDefinition
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getDefinition(artifactType, artifactName) {
//console.log('getDefinition %s %s', artifactType, artifactName);
if (artifactName === undefined) {
throw Error('Failed to get undefined ' + artifactType);
}
Function getArtifactFromSrc
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getArtifactFromSrc(artifactType, moduleName, artifactName) {
return new BluebirdPromise(function (resolve, reject) {
return getRawArtifactFromSrc(artifactType, moduleName, artifactName)
.then(function(jsonData) {
switch (artifactType) {
Function setup
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
var setup = function (custom) {
var defaultConfig = {
/**
* The absolute path to the root of this web server
*/
Function getArtifactFromCache
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getArtifactFromCache(artifactType, moduleName, artifactName) {
// TODO Double check variables for injection
return new BluebirdPromise(function (resolve, reject) {
var file = getArtifactDirectory() + 'dist/' + artifactType + 's/' + artifactName + '.json';
logger.debug('reading file from ' + file);
Function prunePageDefinitionForClient
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.prunePageDefinitionForClient = function (topOriginal) {
function mapModel(original) {
var pruned = {
name: original.name,
fields: _.map(original.fields, function(field) {
Function mergeModelIntoPage
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mergeModelIntoPage(modelDefinition, pageDefinition) {
pageDefinition.model = pageDefinition.model || pageDefinition.name;
pageDefinition.viewMode = pageDefinition.viewMode || 'form';
mapFields(pageDefinition, modelDefinition.fields);
Function columns
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
step.join.columns = _.map(join.columns, function (onClause) {
var fromColumn;
if (onClause.from) {
fromColumn = _.find(fromTable.columns, function (column) {
if (column.name === onClause.from) {
Function deleteData
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function deleteData(modelDefinition, row) {
return new BluebirdPromise(function (resolve, reject) {
// Delete my children first
childUpdate(modelDefinition, row, true)
.then(function () {
Similar blocks of code found in 2 locations. Consider refactoring. Open
app.get('/', function (req, res) {
req.pageName = 'Home'; // TODO get this 'Home' from the menu default
pageController.desktop(req, res, app.locals);
});
- 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 51.
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