cibernox/ember-power-select

View on GitHub

Showing 86 of 86 total issues

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

Identical blocks of code found in 2 locations. Consider refactoring.
Open

function routes() {
  this.timing = 2000;
  this.get('/users');

  this.passthrough('http://api.github.com/search/repositories');
Severity: Major
Found in docs/mirage/config.js and 1 other location - About 1 hr to fix
test-app/mirage/config.js on lines 17..24

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

function routes() {
  this.timing = 2000;
  this.get('/users');

  this.passthrough('http://api.github.com/search/repositories');
Severity: Major
Found in test-app/mirage/config.js and 1 other location - About 1 hr to fix
docs/mirage/config.js on lines 17..24

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 65.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    export default class extends Component {
      countries = [
        { name: 'United States' },
        { name: 'Spain' },
        { name: 'Portugal' },
    Severity: Major
    Found in docs/app/components/snippets/the-search-3.js and 1 other location - About 1 hr to fix
    docs/app/components/snippets/the-search-4.js on lines 3..13

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 63.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

    export default class extends Component {
      countries = [
        { name: 'United States' },
        { name: 'Spain' },
        { name: 'Portugal' },
    Severity: Major
    Found in docs/app/components/snippets/the-search-4.js and 1 other location - About 1 hr to fix
    docs/app/components/snippets/the-search-3.js on lines 3..13

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 63.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          {
            groupName: 'Other',
            options: [
              { route: 'public-pages.docs.test-helpers', text: 'Test helpers' },
              { route: 'public-pages.docs.troubleshooting', text: 'Troubleshooting' },
        Severity: Major
        Found in docs/app/controllers/public-pages/docs.js and 1 other location - About 1 hr to fix
        docs/app/controllers/public-pages/docs.js on lines 20..28

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 61.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          {
            groupName: 'Basic customization',
            options: [
              { route: 'public-pages.docs.the-list', text: 'The list' },
              { route: 'public-pages.docs.the-trigger', text: 'The trigger' },
        Severity: Major
        Found in docs/app/controllers/public-pages/docs.js and 1 other location - About 1 hr to fix
        docs/app/controllers/public-pages/docs.js on lines 47..55

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 61.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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;
        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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        export async function nativeMouseUp(
          selectorOrDomElement: Parameters<typeof triggerEvent>[0],
          options?: Parameters<typeof triggerEvent>[2],
        ) {
          return triggerEvent(selectorOrDomElement, 'mouseup', options);
        Severity: Major
        Found in ember-power-select/src/test-support/helpers.ts and 2 other locations - About 1 hr to fix
        ember-power-select/src/test-support/helpers.ts on lines 20..25
        ember-power-select/src/test-support/helpers.ts on lines 34..39

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 58.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        export async function nativeMouseDown(
          selectorOrDomElement: Parameters<typeof triggerEvent>[0],
          options?: Parameters<typeof triggerEvent>[2],
        ) {
          return triggerEvent(selectorOrDomElement, 'mousedown', options);
        Severity: Major
        Found in ember-power-select/src/test-support/helpers.ts and 2 other locations - About 1 hr to fix
        ember-power-select/src/test-support/helpers.ts on lines 27..32
        ember-power-select/src/test-support/helpers.ts on lines 34..39

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 58.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        export async function triggerKeydown(
          domElement: Parameters<typeof triggerKeyEvent>[0],
          k: Parameters<typeof triggerKeyEvent>[2],
        ) {
          return triggerKeyEvent(domElement, 'keydown', k);
        Severity: Major
        Found in ember-power-select/src/test-support/helpers.ts and 2 other locations - About 1 hr to fix
        ember-power-select/src/test-support/helpers.ts on lines 20..25
        ember-power-select/src/test-support/helpers.ts on lines 27..32

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 58.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

        module.exports = function (environment) {
          const ENV = {
            modulePrefix: 'docs',
            environment,
            rootURL: '/',
        Severity: Minor
        Found in docs/config/environment.js - About 1 hr to fix

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

          module.exports = function (environment) {
            const ENV = {
              modulePrefix: 'test-app',
              environment,
              rootURL: '/',
          Severity: Minor
          Found in test-app/config/environment.js - About 1 hr to fix

            Function handleKeydown has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
            Open

              @action
              handleKeydown(select: Select, e: KeyboardEvent): false | void {
                if (this.args.onKeydown && this.args.onKeydown(select, e) === false) {
                  e.stopPropagation();
                  return false;
            Severity: Minor
            Found in ember-power-select/src/components/power-select-multiple.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 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];
            Severity: Minor
            Found in ember-power-select/src/utils/group-utils.ts - About 1 hr to fix

              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) {
              Severity: Minor
              Found in ember-power-select/src/utils/group-utils.ts - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language