Showing 4 of 13 total issues
Function ODataV42MongoQuery
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function ODataV42MongoQuery(odataQuery:ExpressLikeODataQuery) {
if (JYV_CONFIG.debugMode('query')) {
console.info(`⚙️ Converting OData-V4 Query:`);
console.info(odataQuery);
}
Function ODataV42MongoFilter
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function ODataV42MongoFilter(odataFilter:string, query:MongoFilter = new MongoFilter()) {
if (odataFilter.startsWith("'")&&odataFilter.endsWith("'"))
odataFilter = odataFilter.substring(1, odataFilter.length-1);
var bracketedGroups = odataFilter.match(/\((.*?)\)/g);
if (bracketedGroups && bracketedGroups.length)
Function connect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
export async function connect(connection?:ConnectionInfo): Promise<MongoClient> {
if (!connection) connection = {};
if (!connection.host) connection.host = 'localhost';
var userAndPwdAt = `${connection.user?(connection.user+':'):''}${(connection as any)[connection.user as string]||(connection as any).pwd?(connection as any)[(connection as any).user as string]||connection.pwd:''}`,
mongoConnectionString = `mongodb://`
- 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 connect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
export async function connect(connection?:ConnectionInfo): Promise<MongoClient> {
if (!connection) connection = {};
if (!connection.host) connection.host = 'localhost';
var userAndPwdAt = `${connection.user?(connection.user+':'):''}${connection[connection.user]?connection[connection.user]:''}`,
mongoConnectionString = `mongodb://`
- 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"