Showing 408 of 408 total issues
Consider simplifying this complex logical expression. Open
if(evento.which==115 && !evento.shiftKey && !evento.ctrlKey && !evento.altKey && !evento.metaKey){ // F4
/** @type {HTMLElement} */
var activeElement = this.activeElement && this.activeElement.tagName!='BODY' && this.activeElement || document.mayBeRepetibleButton;
var info=tableInfo(activeElement);
if(info.table){
Consider simplifying this complex logical expression. Open
if(pol && pol.enabled){
otherColumns.push(`(${(pol.enabled && (pol.update.using || pol.all.using) || 'true' )}) is true as "$allow.update"`);
otherColumns.push(`(${(pol.enabled && (pol.delete.using || pol.all.using) || 'true' )}) is true as "$allow.delete"`);
}
Consider simplifying this complex logical expression. Open
if(!fieldDef.clientSide && fieldDef.inTable!==false && !fieldDef.inJoin && !(tableDef.sql.fields[fieldDef.name]||{}).expr || fieldDef.inTable){
var fieldType=typeDb[fieldDef.typeName]||'"'+fieldDef.typeName+'"';
if(fieldDef.sizeByte==4){
fieldType = 'integer';
}
Consider simplifying this complex logical expression. Open
if(config.nodb){
console.log("server without database");
}else{
if(be.config.login["double-dragon"]){
be.DoubleDragon = {dbParams:{}}
Function updateRowData
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
grid.updateRowData = function updateRowData(depot, skipUpdateStatus){
var grid = this;
var forInsert = false; // not define how to detect
var tr = depot;
grid.setRowStyle(depot,depot.row, skipUpdateStatus);
Function saveRow
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
var saveRow = function(depot, opts){
if(!('saving' in depot)){
depot.saving = Promise.resolve();
}
changeIoStatus(depot,'updating',depot.rowPendingForUpdate);
Function getChild
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getChild<T>(tableName:string, parentKey:Key):Promise<T[]>{
var ldb=this;
var db=await ldb.wait4db
var rows:T[]=[];
var internalKey:string|Key;
Function validateBitacora
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
AppBackend.prototype.validateBitacora = function validateBitacora(procedureDef){
var be = this;
if(procedureDef.bitacora.targetTable in be.tableStructures){
var contextForDump=be.getContextForDump();
var tableDefFields = be.tableStructures[procedureDef.bitacora.targetTable](contextForDump).fields;
Function updateDatabase
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
updateDatabase(updateSql, parametros) {
var id=parametros[0];
var be=this;
var client;
return this.getDbClient().then(function(cli) {
Function prepareAndDisplayGrid
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
myOwn.TableGrid.prototype.prepareAndDisplayGrid = function prepareAndDisplayGrid(){
var grid = this;
grid.displayPreLoadMessage();
var structureRequest = grid.connector.getStructure().then(function(tableDef){
grid.def = tableDef;
Function fields
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
resultTableDef.fields = resultTableDef.fields.map(function(fieldDef){
var resultFieldDef = changing(changing({
visible: true,
allow:{},
defaultForOtherFields: false,
Function constructor
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(){
let be = this;
/** @type {any} */
this.config={};
/** @type {{path:string}[]} */
Function next_number
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
next_number:function(fieldName, aboveDepot, belowDepot){
var manager = aboveDepot.manager ?? belowDepot.manager
if(!manager){
return 1;
}else{
- 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 registerStructureInside
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private async registerStructureInside(tableDef:TableDefinition, wait4db:Promise<IDBDatabase>):Promise<{
wait4db:Promise<IDBDatabase>,
result:RegisterResult
}>{
var ldb=this;
- 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
var sql = `INSERT INTO ${db.quoteIdent(schemaName)}.${db.quoteIdent(tableName)}
(${cleanKeys.join(',')}) VALUES (${cleanValues.join(',')}) returning id`;
- 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
var sql = `UPDATE ${db.quoteIdent(schemaName)}.${db.quoteIdent(tableName)}
SET ${setPairs.join(',')}
WHERE ${filterPairs.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 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("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
Function filterDepots
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
grid.filterDepots = function filterDepots(depotsToFilter){
var grid = this;
var filterRows = grid.view.filter;
var depotsToDisplay;
if(filterRows && filterRows.length){
Function refreshAggregates
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
myOwn.TableGrid.prototype.refreshAggregates = function refreshAggregates(){
var grid = this;
var my = grid.my;
var aggData={};
grid.def.fields.forEach(function(fieldDef){