File Finder.js
has 781 lines of code (exceeds 250 allowed). Consider refactoring. Open
var ut = require("./Utils.js");
const CLASS = require("./CoreClass.js");
const FILE = require("./File.js");
const Logger = require("./Logger.js")();
var CONST = require("./CoreConst.js");
Function SearchAPI
has 153 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SearchAPI(data){
// AnalyzerDatabase (specialize InMemoryDb)
var _db = this._db = data;
this._queryCache = [];
Function __checkDeepField
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
__checkDeepField(object,search, offset=0){
let ref=object, i=offset;
if(object == null) return false;
- 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 _getTestFn
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
_getTestFn(dataModel, pattern, caseSensitive, lazy=false){
//if(lazy===true) console.debug("LAZY mode detected !");
if(pattern==undefined || pattern.length==0){
- 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 _getTestFn
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
_getTestFn(dataModel, pattern, caseSensitive, lazy=false){
//if(lazy===true) console.debug("LAZY mode detected !");
if(pattern==undefined || pattern.length==0){
Function show
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
FinderResult.prototype.show = function(){
let sub = [];
this.data.map((k,x)=>{
if(x instanceof CLASS.Method){
Function SearchAPI
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
function SearchAPI(data){
// AnalyzerDatabase (specialize InMemoryDb)
var _db = this._db = data;
this._queryCache = [];
- 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 sshow
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
FinderResult.prototype.sshow = function(){
let sub = [];
this.data.map((k,x)=>{
if(x instanceof CLASS.Method){
sub.push({
Function caller
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
FinderResult.prototype.caller = function(){
let meth = new MemoryDb.Index(), obj=null;
this.data.map((k,v)=>{
obj=this.data[i];
Function __checkDeepField
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
__checkDeepField(object,search, offset=0){
let ref=object, i=offset;
if(object == null) return false;
Function _find
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_find(index, model, pattern, caseSensitive, lazy=false, includeMissing=false){
if(pattern === null || pattern === undefined) return new FinderResult(index,this);
this.cache.push({ index:index, model:model, case:caseSensitive, lazy:lazy });
- 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(ref[search.field[i]][k] instanceof CLASS.ObjectType){
//console.log(search.field[i], ref[search.field[i]][k].name, search.field[i+1]);
return this.__checkDeepField( this.__DB.classes.getEntry(ref[search.field[i]][k].name), search, i+1);
}
else if(ref[search.field[i]][k] instanceof CLASS.BasicType){
Avoid too many return
statements within this function. Open
return null;
Avoid too many return
statements within this function. Open
return new SearchPattern({
pattern: pattern.substr(4),
isModifier: false,
hasTag: true,
fn:this._test.hasTag
Avoid too many return
statements within this function. Open
return this.__checkDeepField( this.__DB.classes.getEntry(ref[search.field[i]].name), search, i+1);
Avoid too many return
statements within this function. Open
return new SearchPattern({
pattern: pattern,
field: token,
isStructField: struct,
isDeepSearch: isDeepSearch,
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return new FinderResult(new MemoryDb.Index(), this);
Avoid too many return
statements within this function. Open
return this.__checkDeepField(ref[search.field[i]], search, i+1);
Avoid too many return
statements within this function. Open
return search.fn(ref);
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return this.__checkDeepField(ref[search.field[i]], search, i+1);
Avoid too many return
statements within this function. Open
return new FinderResult(this._findObject(index, spatt, includeMissing), this);
Function union
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
FinderResult.prototype.union = function(resultSet){
if(typeof resultSet === 'string' || resultSet instanceof String){
let res = this._finder._find(resultSet);
res.data.map((k,v)=>{
- 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
this.getter = function(pattern=null){
let res = null;
if(pattern != null){
res = finder._find(
_db.call, DataModel.call,
- 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 147.
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
this.setter = function(pattern=null){
let res = null;
if(pattern != null){
res = finder._find(
_db.call, DataModel.call,
- 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 147.
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
else if(x instanceof CLASS.XRef){
sub.push({ Subject: x.calleed.signature() });
if(x.empty)
sub.push({ Subject: "\t No reference found" });
else
- 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 108.
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
else if(x instanceof CLASS.XRef){
sub.push({ Subject: x.calleed.signature() });
if(x.empty)
sub.push({ Subject: "\t No reference found" });
else
- 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 108.
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
MissingObjectAPI.prototype.method = function(pattern){
let db = this.search("_log_tag:METHOD");
return this._search._finder._find(db.data, DataModel.method, pattern, this._search._caseSensitive, true, true);
}
- 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 76.
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
MissingObjectAPI.prototype.field = function(pattern){
let db = this.search("_log_tag:FIELD");
return this._search._finder._find(db.data, DataModel.field, pattern, this._search._caseSensitive, true, true);
}
- 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 76.
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