File select.component.ts
has 395 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {
AfterContentInit,
AfterViewInit,
ChangeDetectorRef,
Component,
MdlSelectComponent
has 32 functions (exceeds 20 allowed). Consider refactoring. Open
@Component({
selector: "mdl-select",
templateUrl: "select.component.html",
encapsulation: ViewEncapsulation.None,
providers: [MDL_SELECT_VALUE_ACCESSOR],
Function writeValue
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public writeValue(value: string | string[] | undefined): void {
if (this.multiple) {
this.model = this.model || [];
if (!value || this.model === value) {
// skip ngModel update when undefined value or multiple selects initialized with same array
- 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 renderValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private renderValue(value: string | string[] | undefined) {
if (this.multiple) {
this.text = ((value as string[]) || [])
.map((valueItem: string) => this.textByValue[stringifyValue(valueItem)])
.join(", ");
- 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 onArrow
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private onArrow($event: KeyboardEvent, offset: number) {
const arr = this.optionComponents
?.toArray()
.filter(({ disabled }) => !disabled);
if (!arr) {
- 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 onKeyDown
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@HostListener("keydown", ["$event"])
public onKeyDown($event: KeyboardEvent): void {
if (!this.disabled && this.popoverComponent?.isVisible && !this.multiple) {
if (isKey($event, KEYS.upArrow)) {
this.onArrow($event, -1);
- 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"