File procedures-table.js
has 1256 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @ts-check
"use strict";
var {datetime, changing, coalesce, splitRawRowIntoRow} = require('best-globals');
var XLSX = require('xlsx');
Function coreFunction
has 407 lines of code (exceeds 25 allowed). Consider refactoring. Open
coreFunction:async function(context, parameters, files){
var be=context.be;
var doing="opening file";
var skipUnknownFieldsAtImport = coalesce(parameters.skipUnknownFieldsAtImport, be.config.skipUnknownFieldsAtImport);
/** @type {string[]} */
Function coreFunction
has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring. Open
coreFunction:async function(context, parameters, files, opts){
var be=context.be;
var mainDefTable=be.tableStructures[parameters.table](context);
var action=parameters.status=='new'?'insert':'update';
if(!mainDefTable.allow[action] && (!opts || !opts.forImport)){
- 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 coreFunction
has 211 lines of code (exceeds 25 allowed). Consider refactoring. Open
coreFunction:async function(context, parameters, files, opts){
var be=context.be;
var mainDefTable=be.tableStructures[parameters.table](context);
var action=parameters.status=='new'?'insert':'update';
if(!mainDefTable.allow[action] && (!opts || !opts.forImport)){
Function tableDatum
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function tableDatum(context, parameters){
var be=context.be;
var tableName=parameters.table;
var defTable=be.tableStructures[tableName];
if(!defTable){
Function coreFunction
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
coreFunction:async function(context,parameters){
var {be} = context;
var {db} = be;
var tableName = parameters.table;
var rows = await be.inTransaction(null, async function(client){
Function coreFunction
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
coreFunction:async function(context, parameters){
var be=context.be;
var db=be.db;
var tableDef=be.tableStructures[parameters.table](context);
var tableDefArray = [tableDef].concat(tableDef.offline.details.map(name=>be.tableStructures[name](context)));
Function coreFunction
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
coreFunction:async function(context, parameters){
context.informProgress({message:"start"});
var {be,client} = context;
if (!be.can(context,'DownloadBackup')) {
throw new Error('Forbiden backup')
- 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 coreFunction
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
coreFunction:async function(context, parameters){
context.informProgress({message:"start"});
var {be,client} = context;
if (!be.can(context,'DownloadBackup')) {
throw new Error('Forbiden backup')
Function coreFunction
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
coreFunction:async function(context, parameters){
var be=context.be;
context.informProgress({message:be.messages.server.deleting})
var be=context.be;
var defTable=be.tableStructures[parameters.table](context);
Function coreFunction
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
coreFunction:async function(context, parameters){
var be=context.be;
var tableName=parameters.table;
var changes = {sql: undefined}
var defTable=be.tableStructures[tableName];
Function testCandidateColumnAndAddIt
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
var testCandidateColumnAndAddIt=function testCandidateColumnAndAddIt(fieldName, iColumn, cellAddress){
cellAddress=cellAddress||iColumn;
if(fieldName == "#cuidado"){
inputCuidado = true;
}else if(fieldName && fieldName!='#ignore'){
Consider simplifying this complex logical expression. Open
if(defField &&
defField.inTable!==false &&
(defField.allow.import || defField.allow.insert && (defField.allow.update || defField.isPk)) &&
(!defField.clientSide || defField.serverSide)
){
Function rowsForUpsert
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var rowsForUpsert=lines.slice(1).map(function(line){
var othersArray = [];
if(separator=='|'){
var row = splitRawRowIntoRow(line);
Function coreFunction
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
coreFunction:function(context, parameters){
var be=context.be;
var defTable=be.tableStructures[parameters.table](context);
if(!defTable.allow.delete){
throw changing(new Error("Deletes not allowed"),{status:403});
Function coreFunction
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
coreFunction:function(context, parameters){
var be=context.be;
var defTable=be.tableStructures['cursors'](context);
var otherFields={username:context.username, machineId:context.machineId, navigator: context.navigator, since:new Date()};
var fieldNames=[];
Function deleteOneRow
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var deleteOneRow=function(row){
//return Promise.resolve().then(function(){
// row.
var dataParams=[];
var whereParts=[];
Function coreFunction
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
coreFunction:function(context, parameters){
var be=context.be;
var defTable=be.tableStructures[parameters.table](context);
if(!defTable.allow.delete){
throw changing(new Error("Deletes not allowed"),{status:403});
- 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 coreFunction
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
coreFunction:async function(context, parameters){
var be=context.be;
var tableName=parameters.table;
var changes = {sql: undefined}
var defTable=be.tableStructures[tableName];
- 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 tableDatum
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function tableDatum(context, parameters){
var be=context.be;
var tableName=parameters.table;
var defTable=be.tableStructures[tableName];
if(!defTable){
- 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
Avoid deeply nested control flow statements. Open
if(typeof cellOfFieldName.v !== 'string'){
throw new Error(be.messages.server.importColumnDoesNotHasStringValue.replace('$1', cellAddress));
}
Avoid deeply nested control flow statements. Open
if(raw!=null && raw!=='' || !bpMode){
var value;
if(raw==null || raw==='' || typeof raw ==="string" && raw.trim() === '') {
value=null;
}else if(typeof raw ==="string" && raw.startsWith('#') && be.config.imports['hashConverters']){
Avoid deeply nested control flow statements. Open
if(!fieldNames4Insert.includes(name)){
fieldNames4Insert.push(name);
values4Insert.push(primaryKeyValues[i]);
}
Consider simplifying this complex logical expression. Open
if(mainDefTable.sql.from && result.row && (!opts || !opts.forImport)){
//var rowFrom = plainUpdate.values.length?result.row:primaryKeyValueObject;
var rowFrom = parameters.status!='new' && !plainUpdate.values.length?
likeAr.toPlainObject(mainDefTable.primaryKey,expectedMainPrimaryKeyValues):
(mainResult||result).row;
Consider simplifying this complex logical expression. Open
if((!mainDefTable || parameters.status!='new')
&& (!mainDefTable || parameters.primaryKeyValues.length!=mainDefTable.primaryKey.length)
&& (parameters.masive && parameters.primaryKeyValues.length>0)
){
return {masive:true};
Consider simplifying this complex logical expression. Open
if(fieldDef.summary
&& (!fieldDef.summary.types4 || fieldDef.summary.types4.includes(row.data_type))
&& (!fieldDef.summary.excludeTypes || !fieldDef.summary.excludeTypes.includes(row.data_type))
){
var sql=fieldDef.summary.sql|| `select ${(fieldDef.summary.expr)} from $2`;
Function coreFunction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
coreFunction:function(context, parameters){
var be=context.be;
var defTable=be.tableStructures['cursors'](context);
var otherFields={username:context.username, machineId:context.machineId, navigator: context.navigator, since:new Date()};
var fieldNames=[];
- 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 coreFunction
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
coreFunction:function(context, parameters){
//return 'ok';
var be=context.be;
var defTable=be.tableStructures['cursors'](context);
var otherFields={username:context.username, machineId:context.machineId, navigator: context.navigator};
- 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
"INSERT INTO "+be.db.quoteIdent(defTable.sql.tableName)+
" ("+fieldNames4Insert.map(function(name,i){ return be.db.quoteIdent(name); }).join(', ')+
") VALUES ("+fieldNames4Insert.map(function(name,i){ return '$'+(i+1); }).join(', ')+
") "+returningClausule,
- 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 121.
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
"INSERT INTO "+be.db.quoteIdent(defTable.sql.tableName)+
" ("+fieldNames.map(function(name,i){ return be.db.quoteIdent(name); }).join(', ')+
") VALUES ("+fieldNames.map(function(name,i){ return '$'+(i+1); }).join(', ')+
") "+returningClausule,
- 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 121.
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
"DELETE FROM "+be.db.quoteIdent(defTable.sql.tableName)+
" WHERE "+fieldNames.map(function(name,i){
return be.db.quoteIdent(name)+' = $'+(i+1)}).join( ' AND '),values
- 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 83.
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
"UPDATE "+be.db.quoteIdent(defTable.sql.tableName)+
" SET "+fieldNames4Update.map(function(name,i){ return be.db.quoteIdent(name)+" = $"+(i+1); }).join(', ')+
- 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 83.
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
for(var name in parameters){
values.push(parameters[name]);
if(name==='table'){name='table_name'}
if(name==='primaryKeyValues'){name='pk_values'}
fieldNames.push(name);
- 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 75.
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
for(var name in parameters){
values.push(parameters[name]);
if(name==='table'){name='table_name'}
if(name==='primaryKeyValues'){name='pk_values'}
fieldNames.push(name);
- 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 75.
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
"SELECT 'ok' FROM "+be.db.quoteIdent(defTable.sql.tableName)+
" WHERE "+defTable.primaryKey.map(function(fieldName, i){
return be.db.quoteIdent(fieldName)+" = $"+(i+1+fieldNames4Update.length);
}).join(" AND ")+" ",
- 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 64.
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
try{
await context.client.query("BEGIN TRANSACTION").execute();
}catch(err2){
err.detail+=' *** in BEGIN TRANSACTION ' + err2.message;
throw err
- 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 60.
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
try{
await context.client.query('ROLLBACK').execute();
}catch(err2){
err.detail+=' *** in ROLLBACK ' + err2.message;
throw err
- 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 60.
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