Showing 9 of 9 total issues
Function fixOptions
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
const fixOptions = <T extends IUseOptions>( object: T , options: IOptions ) => {
prepareOptionObject( object );
if ( object.modulopt ) {
Object.keys( options ).map( ( key: string ) => {
- 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 fixOptions
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
const fixOptions = <T extends IUseOptions>( object: T , options: IOptions ) => {
prepareOptionObject( object );
if ( object.modulopt ) {
Object.keys( options ).map( ( key: string ) => {
Function sortEntries
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const sortEntries = ( config: IUseOptions , optionVector: any[] ) => {
const sortFunction = ( a: any[] , b: any[] ) => {
const result = a[ 0 ] > b[ 0 ] ? 1 : a[ 0 ] < b[ 0 ] ? -1 : 0;
return result;
};
- 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 masksMappedByName
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private masksMappedByName( masks: IOptions , cb = defaultCall , previousKey = "" ) {
const mapped: IOptions = {};
for ( const [ key , value ] of Object.entries( masks ) ) {
if ( typeof value === "string" || previousKey ) {
- 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( !isSubObject( refererObj , subObj ) ) {
checkValidCall( { data : object , key , kind : "free" , value } );
}
Function assignValuePerBit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public assignValuePerBit(
modulopt: IHoldModulopt ,
row: any ,
cpt: number ,
totalOffset: number
- 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 isSubObject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const isSubObject = ( object1: any , object2: any ) => {
for ( const key in object2 ) {
// stop if the key exists in the subobject but not in the main object
if ( object2.hasOwnProperty( key ) && !object1.hasOwnProperty( key ) ) {
- 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 constructMessage
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const constructMessage = ( check: IFailingCheck , verb: string ): string => {
const { data , key , kind , value } = check;
let messageParts: string[] = [ "MODULOPT UKNOWN" ];
- 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 guessMaskFromMask
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private guessMaskFromMask( setMask: string ): string {
const result = [];
let i = 0;
setMask = stripDots( setMask );
- 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"