cibernox/ember-power-select

View on GitHub

Showing 86 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

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

    module.exports = async function () {
      return {
        usePnpm: true,
        scenarios: [
          {
    Severity: Major
    Found in test-app/config/ember-try.js and 1 other location - About 1 day to fix
    docs/config/ember-try.js on lines 6..83

    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 274.

    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

    module.exports = async function () {
      return {
        usePnpm: true,
        scenarios: [
          {
    Severity: Major
    Found in docs/config/ember-try.js and 1 other location - About 1 day to fix
    test-app/config/ember-try.js on lines 6..83

    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 274.

    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

    module.exports = function (environment) {
      const ENV = {
        modulePrefix: 'docs',
        environment,
        rootURL: '/',
    Severity: Major
    Found in docs/config/environment.js and 1 other location - About 1 day to fix
    test-app/config/environment.js on lines 3..51

    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 212.

    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

    module.exports = function (environment) {
      const ENV = {
        modulePrefix: 'test-app',
        environment,
        rootURL: '/',
    Severity: Major
    Found in test-app/config/environment.js and 1 other location - About 1 day to fix
    docs/config/environment.js on lines 3..51

    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 212.

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

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

      get currentSection() {
        let currentRouteName = this.router.currentRouteName;
        for (let i = 0; i < groupedSections.length; i++) {
          let group = groupedSections[i];
          for (let j = 0; j < group.options.length; j++) {
    Severity: Major
    Found in docs/app/controllers/public-pages/cookbook.js and 1 other location - About 4 hrs to fix
    docs/app/controllers/public-pages/docs.js on lines 63..75

    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 128.

    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

      get currentSection() {
        let currentRouteName = this.router.currentRouteName;
        for (let i = 0; i < groupedSections.length; i++) {
          let group = groupedSections[i];
          for (let j = 0; j < group.options.length; j++) {
    Severity: Major
    Found in docs/app/controllers/public-pages/docs.js and 1 other location - About 4 hrs to fix
    docs/app/controllers/public-pages/cookbook.js on lines 37..49

    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 128.

    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

      @action
      createOnEnter(select, e) {
        if (
          e.keyCode === 13 &&
          select.isOpen &&
    docs/app/components/snippets/create-custom-options-1.js on lines 10..23

    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 124.

    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

      @action
      createOnEnter(select, e) {
        if (
          e.keyCode === 13 &&
          select.isOpen &&
    Severity: Major
    Found in docs/app/components/snippets/create-custom-options-1.js and 1 other location - About 4 hrs to fix
    docs/app/controllers/public-pages/cookbook/create-custom-options.js on lines 12..25

    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 124.

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

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

      if (cssPathOrTrigger instanceof HTMLElement) {
        if (cssPathOrTrigger.classList.contains('ember-power-select-trigger')) {
          trigger = cssPathOrTrigger;
        } else {
          trigger = cssPathOrTrigger.querySelector('.ember-power-select-trigger');
    Severity: Major
    Found in ember-power-select/src/test-support.ts and 1 other location - About 3 hrs to fix
    ember-power-select/src/test-support.ts on lines 27..41

    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 108.

    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

      if (cssPathOrTrigger instanceof HTMLElement) {
        if (cssPathOrTrigger.classList.contains('ember-power-select-trigger')) {
          trigger = cssPathOrTrigger;
        } else {
          trigger = cssPathOrTrigger.querySelector('.ember-power-select-trigger');
    Severity: Major
    Found in ember-power-select/src/test-support.ts and 1 other location - About 3 hrs to fix
    ember-power-select/src/test-support.ts on lines 188..202

    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 108.

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

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

        const countries = [
          { name: 'United States', flagUrl: '/flags/us.svg' },
          { name: 'Spain', flagUrl: '/flags/es.svg' },
          { name: 'Portugal', flagUrl: '/flags/pt.svg' },
          { name: 'Russia', flagUrl: '/flags/ru.svg' },
        Severity: Major
        Found in docs/app/components/snippets/how-to-use-it-1.js and 4 other locations - About 2 hrs to fix
        docs/app/components/snippets/css-animation-1.js on lines 3..11
        docs/app/components/snippets/how-to-use-it-2.js on lines 4..12
        docs/app/controllers/public-pages/cookbook/bootstrap-theme.js on lines 3..11
        docs/app/controllers/public-pages/cookbook/material-theme.js on lines 3..11

        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 92.

        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 5 locations. Consider refactoring.
        Open

        const countries = [
          { name: 'United States', flagUrl: '/flags/us.svg' },
          { name: 'Spain', flagUrl: '/flags/es.svg' },
          { name: 'Portugal', flagUrl: '/flags/pt.svg' },
          { name: 'Russia', flagUrl: '/flags/ru.svg' },
        docs/app/components/snippets/css-animation-1.js on lines 3..11
        docs/app/components/snippets/how-to-use-it-1.js on lines 4..12
        docs/app/components/snippets/how-to-use-it-2.js on lines 4..12
        docs/app/controllers/public-pages/cookbook/material-theme.js on lines 3..11

        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 92.

        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 5 locations. Consider refactoring.
        Open

        const countries = [
          { name: 'United States', flagUrl: '/flags/us.svg' },
          { name: 'Spain', flagUrl: '/flags/es.svg' },
          { name: 'Portugal', flagUrl: '/flags/pt.svg' },
          { name: 'Russia', flagUrl: '/flags/ru.svg' },
        Severity: Major
        Found in docs/app/components/snippets/how-to-use-it-2.js and 4 other locations - About 2 hrs to fix
        docs/app/components/snippets/css-animation-1.js on lines 3..11
        docs/app/components/snippets/how-to-use-it-1.js on lines 4..12
        docs/app/controllers/public-pages/cookbook/bootstrap-theme.js on lines 3..11
        docs/app/controllers/public-pages/cookbook/material-theme.js on lines 3..11

        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 92.

        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 5 locations. Consider refactoring.
        Open

        const countries = [
          { name: 'United States', flagUrl: '/flags/us.svg' },
          { name: 'Spain', flagUrl: '/flags/es.svg' },
          { name: 'Portugal', flagUrl: '/flags/pt.svg' },
          { name: 'Russia', flagUrl: '/flags/ru.svg' },
        docs/app/components/snippets/css-animation-1.js on lines 3..11
        docs/app/components/snippets/how-to-use-it-1.js on lines 4..12
        docs/app/components/snippets/how-to-use-it-2.js on lines 4..12
        docs/app/controllers/public-pages/cookbook/bootstrap-theme.js on lines 3..11

        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 92.

        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

        export default class extends Component {
          @(task(function* (term) {
            yield timeout(600);
            let url = `https://api.github.com/search/repositories?q=${term}`;
            return fetch(url)
        Severity: Major
        Found in docs/app/components/snippets/debounce-searches-2.js and 1 other location - About 2 hrs to fix
        docs/app/components/snippets/custom-search-action-2.js on lines 5..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 92.

        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

        Severity
        Category
        Status
        Source
        Language