Showing 10 of 37 total issues
Function requestHide
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
static requestHide(element:HTMLElement, desiredDuration:number,
effect:VisibleEffect, effectTiming:CssEffectTiming):Promise<VisibleResult> {
global.assert(element);
global.assert(desiredDuration);
- 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 requestHide
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
static requestHide(element:HTMLElement, desiredDuration:number,
effect:VisibleEffect, effectTiming:CssEffectTiming):Promise<VisibleResult> {
global.assert(element);
global.assert(desiredDuration);
Function requestShow
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
static requestShow(element:HTMLElement, desiredDuration:number, effect:VisibleEffect, effectTiming:CssEffectTiming):Promise<VisibleResult> {
global.assert(element);
global.assert(desiredDuration);
global.assert(effect);
Function computePropertyValue
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
computePropertyValue(fractionComplete:number, element:HTMLElement):string {
if (fractionComplete >= 1) {
return 'translate3d(0,0,0)';
}
var offset = `${(1 - fractionComplete) * 100}`;
Function getToggleState
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
static getToggleState(action:VisibleAction, state:VisibleState):boolean {
if (action === VisibleAction.SHOW) {
return true;
} if (action === VisibleAction.HIDE) {
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 requestShow
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static requestShow(element:HTMLElement, desiredDuration:number, effect:VisibleEffect, effectTiming:CssEffectTiming):Promise<VisibleResult> {
global.assert(element);
global.assert(desiredDuration);
global.assert(effect);
- 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 too many return
statements within this function. Open
return Promise.resolve(VisibleResult.IMMEDIATE);
Function computePropertyValue
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
computePropertyValue(fractionComplete:number, element:HTMLElement):string {
if (ShrinkEffect.isHorizontal(this.orientation)) {
return fractionComplete <= 0 ? '0' : element.scrollWidth * fractionComplete + 'px';
} else {
return fractionComplete <= 0 ? '0' : element.scrollHeight * fractionComplete + 'px';
- 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 computeFractionComplete
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
computeFractionComplete(element:HTMLElement):number {
if (ShrinkEffect.isHorizontal(this.orientation)) {
if (element.scrollWidth > 0) {
return Math.min(1, element.clientWidth / element.scrollWidth);
}
- 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 getDefaultDisplay
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static getDefaultDisplay(nodeName:string):string {
let storedValue:string = Dom._elemDisplay[nodeName];
if (storedValue) {
return storedValue;
} 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"