File group-utils.ts
has 1083 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { isEqual } from '@ember/utils';
export type MatcherFn = (option: any, text: string) => number;
export function isGroup(entry: any): boolean {
return !!entry && !!entry.groupName && !!entry.options;
Function findOptionWithOffset
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
export function findOptionWithOffset(
options: any,
text: string,
matcher: MatcherFn,
offset: 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 optionAtIndex
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
export function optionAtIndex(
originalCollection: any,
index: number,
): { disabled: boolean; option: any } {
let counter = 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 indexOfOption
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export function indexOfOption(collection: any, option: any): number {
let index = 0;
return (function walk(collection): number {
if (!collection) {
return -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"
Further reading
Function pathForOption
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
export function pathForOption(collection: any, option: any): string {
return (function walk(collection): string {
if (!collection) {
return '';
}
- 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 filterOptions
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export function filterOptions(
options: any,
text: string,
matcher: MatcherFn,
skipDisabled = 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 optionAtIndex
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function optionAtIndex(
originalCollection: any,
index: number,
): { disabled: boolean; option: any } {
let counter = 0;
Function findOptionWithOffset
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function findOptionWithOffset(
options: any,
text: string,
matcher: MatcherFn,
offset: number,
Function countOptions
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function countOptions(collection: any): number {
let counter = 0;
(function walk(collection): void {
if (!collection) {
return;
- 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 walk
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
(function walk(
collection,
ancestorIsDisabled,
): { disabled: boolean; option: any } | void {
if (!collection || index < 0) {
Function walk
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
(function walk(options: any, ancestorIsDisabled: boolean): any {
const length = options.length;
for (let i = 0; i < length; i++) {
const entry = options.objectAt ? options.objectAt(i) : options[i];
Avoid deeply nested control flow statements. Open
if (counter < offset) {
if (!foundBeforeOffset) {
foundBeforeOffset = entry;
}
} else {
Function findOptionWithOffset
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
options: any,
text: string,
matcher: MatcherFn,
offset: number,
skipDisabled = false,