hokulea/aria-voyager

View on GitHub

Showing 50 of 50 total issues

Function testMenuPointerNavigation has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export async function testMenuPointerNavigation(
  assert: Assert,
  selectors: Partial<Selectors> = DEFAULT_SELECTORS
): Promise<void> {
  const { elements, selectors: allSelectors } = setupMenuTest(assert, selectors);
Severity: Minor
Found in packages/ember-aria-voyager/package/src/test-support/menu.ts - About 1 hr to fix

    Function testListboxForKeyboardMultiSelection has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export async function testListboxForKeyboardMultiSelection(
      assert: Assert,
      elements: {
        target: HTMLElement;
        list: HTMLElement;

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

          if (!this.listbox) {
            this.updater = new ReactiveUpdateStrategy();
      
            this.listbox = new Listbox(element as HTMLElement, {
              updater: this.updater
      packages/ember-aria-voyager/package/src/modifiers/menu.ts on lines 31..37

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

      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 (!this.menu) {
            this.updater = new ReactiveUpdateStrategy();
      
            this.menu = new Menu(element as HTMLElement, {
              updater: this.updater
      Severity: Major
      Found in packages/ember-aria-voyager/package/src/modifiers/menu.ts and 1 other location - About 1 hr to fix
      packages/ember-aria-voyager/package/src/modifiers/listbox.ts on lines 115..121

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

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

        navigateWithPointer(event: PointerEvent) {
          // hover ...
          if (event.type === 'pointerover') {
            // close sibling menus
            this.control.items
      Severity: Minor
      Found in packages/aria-voyager/src/navigation-patterns/menu-navigation.ts - About 1 hr to fix

        Function testListboxForPointerMultiSelection has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export async function testListboxForPointerMultiSelection(
          assert: Assert,
          elements: {
            target: HTMLElement;
            list: HTMLElement;

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

          export async function select(
            target: Target,
            options: string | string[],
            {
              keepPreviouslySelected = false,

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

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

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

            export function getOptions(parent: HTMLElement, selector: string): HTMLElement[] {
              return [...parent.querySelectorAll(selector)] as HTMLElement[];
            }
            packages/ember-aria-voyager/package/src/test-support/-private/composite.ts on lines 1..3

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

            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 function getItems(parent: HTMLElement, selector: string): HTMLElement[] {
              return [...parent.querySelectorAll(selector)] as HTMLElement[];
            }
            packages/ember-aria-voyager/package/src/test-support/-private/selection.ts on lines 14..16

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

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

            function createIndexEmitter<T>(listbox: Listbox, options: NamedArgs<ListboxSignature<T>>) {
              const findByIndex = (index: number) => {
                return (options as WithItems<T>).items[index] ?? undefined;
              };
            
            
            Severity: Minor
            Found in packages/ember-aria-voyager/package/src/modifiers/listbox.ts - About 55 mins 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

            export function isEndEvent(event: Event): boolean {
              return event instanceof KeyboardEvent && event.type === 'keydown' && event.key === 'End';
            }
            Severity: Minor
            Found in packages/aria-voyager/src/navigation-patterns/end-navigation.ts and 1 other location - About 55 mins to fix
            packages/aria-voyager/src/navigation-patterns/home-navigation.ts on lines 4..6

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

            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 function isHomeEvent(event: Event): boolean {
              return event instanceof KeyboardEvent && event.type === 'keydown' && event.key === 'Home';
            }
            packages/aria-voyager/src/navigation-patterns/end-navigation.ts on lines 4..6

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

            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

              matches(event: Event): boolean {
                return matchesKeys(event, this.keyOrKeys) && this.control.enabledItems.length > 0;
              }
            packages/aria-voyager/src/navigation-patterns/previous-navigation.ts on lines 19..21

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

            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

              matches(event: Event): boolean {
                return matchesKeys(event, this.keyOrKeys) && this.control.enabledItems.length > 0;
              }
            packages/aria-voyager/src/navigation-patterns/next-navigation.ts on lines 19..21

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

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

              navigateWithPointer(event: PointerEvent) {
                // hover ...
                if (event.type === 'pointerover') {
                  // close sibling menus
                  this.control.items
            Severity: Minor
            Found in packages/aria-voyager/src/navigation-patterns/menu-navigation.ts - About 45 mins 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 modify has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              modify(
                element: Element,
                _: PositionalArgs<MenuSignature<T>>,
                options: NamedArgs<MenuSignature<T>>
              ) {
            Severity: Minor
            Found in packages/ember-aria-voyager/package/src/modifiers/menu.ts - About 45 mins 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

              modify(
                element: Element,
                _: PositionalArgs<ListboxSignature<T>>,
                options: NamedArgs<ListboxSignature<T>>
              ) {
            Severity: Minor
            Found in packages/ember-aria-voyager/package/src/modifiers/listbox.ts and 1 other location - About 35 mins to fix
            packages/ember-aria-voyager/package/src/modifiers/menu.ts on lines 26..61

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

            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

              matches(event: Event): boolean {
                return isEndEvent(event) && this.control.enabledItems.length > 0;
              }
            Severity: Minor
            Found in packages/aria-voyager/src/navigation-patterns/end-navigation.ts and 1 other location - About 35 mins to fix
            packages/aria-voyager/src/navigation-patterns/home-navigation.ts on lines 13..15

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

            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

              matches(event: Event): boolean {
                return isHomeEvent(event) && this.control.enabledItems.length > 0;
              }
            packages/aria-voyager/src/navigation-patterns/end-navigation.ts on lines 13..15

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

            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