cibernox/ember-power-select

View on GitHub

Showing 36 of 86 total issues

File group-utils.ts has 1084 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import { A } from '@ember/array';
import { isEqual } from '@ember/utils';

export type MatcherFn = (option: any, text: string) => number;
export function isGroup(entry: any): boolean {
Severity: Major
Found in ember-power-select/src/utils/group-utils.ts - About 2 days to fix

    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,
    Severity: Minor
    Found in ember-power-select/src/utils/group-utils.ts - About 5 hrs to fix

    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 addHandlers has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

      @action
      addHandlers(element: Element) {
        const isGroup = element.getAttribute('data-optgroup') === 'true';
        if (isGroup) {
          return;
    Severity: Minor
    Found in ember-power-select/src/components/power-select/options.ts - About 4 hrs to fix

    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 exports has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = async function () {
      return {
        usePnpm: true,
        scenarios: [
          {
    Severity: Major
    Found in docs/config/ember-try.js - About 3 hrs to fix

      Function exports has 76 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = async function () {
        return {
          usePnpm: true,
          scenarios: [
            {
      Severity: Major
      Found in test-app/config/ember-try.js - About 3 hrs to fix

        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;
        Severity: Minor
        Found in ember-power-select/src/utils/group-utils.ts - About 2 hrs to fix

        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 addHandlers has 61 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          @action
          addHandlers(element: Element) {
            const isGroup = element.getAttribute('data-optgroup') === 'true';
            if (isGroup) {
              return;
        Severity: Major
        Found in ember-power-select/src/components/power-select/options.ts - About 2 hrs to fix

          Function afterInstall has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            afterInstall() {
              let dependencies = this.project.dependencies();
          
              const promises = [];
          
          
          Severity: Major
          Found in ember-power-select/blueprints/ember-power-select/index.js - About 2 hrs to fix

            Function selectChoose has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export async function selectChoose(
              cssPathOrTrigger: string | HTMLElement,
              valueOrSelector: string,
              optionIndex?: number,
            ) {
            Severity: Major
            Found in ember-power-select/src/test-support.ts - About 2 hrs to fix

              Function selectChoose has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

              export async function selectChoose(
                cssPathOrTrigger: string | HTMLElement,
                valueOrSelector: string,
                optionIndex?: number,
              ) {
              Severity: Minor
              Found in ember-power-select/src/test-support.ts - About 2 hrs to fix

              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;
              Severity: Minor
              Found in ember-power-select/src/utils/group-utils.ts - About 2 hrs to fix

              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 afterInstall has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                afterInstall() {
                  let dependencies = this.project.dependencies();
              
                  const promises = [];
              
              
              Severity: Minor
              Found in ember-power-select/blueprints/ember-power-select/index.js - About 2 hrs to fix

              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 handleKeydown has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                @action
                handleKeydown(event: Event): false | void {
                  const e = event as KeyboardEvent;
                  if (e.target === null) return;
                  if (this.args.onKeydown && this.args.onKeydown(e) === false) {
              Severity: Minor
              Found in ember-power-select/src/components/power-select-multiple/input.ts - About 2 hrs to fix

              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 '';
                  }
              Severity: Minor
              Found in ember-power-select/src/utils/group-utils.ts - About 1 hr to fix

              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 selectSearch has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export async function selectSearch(
                cssPathOrTrigger: string | HTMLElement,
                value: string,
              ) {
                let trigger: HTMLElement | null;
              Severity: Minor
              Found in ember-power-select/src/test-support.ts - About 1 hr to fix

                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,
                Severity: Minor
                Found in ember-power-select/src/utils/group-utils.ts - About 1 hr to fix

                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 selectSearch has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                export async function selectSearch(
                  cssPathOrTrigger: string | HTMLElement,
                  value: string,
                ) {
                  let trigger: HTMLElement | null;
                Severity: Minor
                Found in ember-power-select/src/test-support.ts - About 1 hr to fix

                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;
                Severity: Minor
                Found in ember-power-select/src/utils/group-utils.ts - About 1 hr to fix

                  Function findOptionWithOffset has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  export function findOptionWithOffset(
                    options: any,
                    text: string,
                    matcher: MatcherFn,
                    offset: number,
                  Severity: Minor
                  Found in ember-power-select/src/utils/group-utils.ts - About 1 hr to fix

                    Function handleKeydown has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      @action
                      handleKeydown(event: Event): false | void {
                        const e = event as KeyboardEvent;
                        if (e.target === null) return;
                        if (this.args.onKeydown && this.args.onKeydown(e) === false) {
                    Severity: Minor
                    Found in ember-power-select/src/components/power-select-multiple/input.ts - About 1 hr to fix
                      Severity
                      Category
                      Status
                      Source
                      Language