menhera-org/TabArray

View on GitHub

Showing 1,356 of 1,356 total issues

Function format has a Cognitive Complexity of 77 (exceeds 5 allowed). Consider refactoring.
Open

  public static format(...args: unknown[]): unknown[] {
    if (args.length < 1) {
      return args;
    }
    const firstArg = args.shift();
Severity: Minor
Found in src/lib/console/ConsoleFormatter.ts - About 1 day 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 sync has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
Open

  public async sync(): Promise<void> {
    const [syncedIdentitiesData, syncedIdentityMap, identities] = await Promise.all([
      this._syncedIdentitiesStorage.getAll(),
      this._syncedIdentityMapStorage.getValue(),
      contextualIdentityFactory.getAll(),
Severity: Minor
Found in src/lib/sync/ContainerSyncService.ts - About 1 day 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 constructor has 143 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  public constructor() {
    super();
    this.attachShadow({ mode: 'open' });
    if (!this.shadowRoot) {
      throw new Error('Shadow root is null');
Severity: Major
Found in src/components/help-banner.ts - About 5 hrs to fix

    Function constructor has 136 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public constructor(contextualIdentity?: ContextualIdentity, parentTabGroupId?: string) {
        super();
        this._contextualIdentity = contextualIdentity;
        this.attachShadow({ mode: 'open' });
        if (!this.shadowRoot) {
    Severity: Major
    Found in src/components/container-editor.ts - About 5 hrs to fix

      Function sync has 126 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public async sync(): Promise<void> {
          const [syncedIdentitiesData, syncedIdentityMap, identities] = await Promise.all([
            this._syncedIdentitiesStorage.getAll(),
            this._syncedIdentityMapStorage.getValue(),
            contextualIdentityFactory.getAll(),
      Severity: Major
      Found in src/lib/sync/ContainerSyncService.ts - About 5 hrs to fix

        Function resetIndexTabs has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
        Open

        const resetIndexTabs = async (browserWindows: browser.Windows.Window[]) => {
          const indexTabOption = await config['tab.groups.indexOption'].getValue();
          if (indexTabOption == 'never') return;
          const indexTabIds = new Set<number>();
          const existingIndexTabIds = await indexTabService.getIndexTabIds();
        Severity: Minor
        Found in src/background/background-index-tab.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

        File panel-windows.ts has 367 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* -*- indent-tabs-mode: nil; tab-width: 2; -*- */
        /* vim: set ts=2 sw=2 et ai : */
        /**
          Container Tab Groups
          Copyright (C) 2023 Menhera.org
        Severity: Minor
        Found in src/components/panel-windows.ts - About 4 hrs to fix

          Function setupUaOverrides has 112 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const setupUaOverrides = (window: Window & typeof globalThis, navigatorPrototypeWrapped: any) => {
            try {
              // eslint-disable-next-line @typescript-eslint/no-explicit-any
              const windowWrapped = window.wrappedJSObject as any;
          
          
          Severity: Major
          Found in src/content/overrides/content.ts - About 4 hrs to fix

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

                element.addEventListener('dragover', (ev) => {
                  if (!ev.dataTransfer) return;
                  const json = ev.dataTransfer.getData('application/json');
                  if (!json) return;
                  const data = JSON.parse(json);
            Severity: Major
            Found in src/pages/popup-v2/legacy/PopupRenderer.ts and 1 other location - About 4 hrs to fix
            src/pages/popup-v2/legacy/PopupRenderer.ts on lines 200..208

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

            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

                  tabElement.addEventListener('dragover', (ev) => {
                    if (!ev.dataTransfer) return;
                    const json = ev.dataTransfer.getData('application/json');
                    if (!json) return;
                    const data = JSON.parse(json);
            Severity: Major
            Found in src/pages/popup-v2/legacy/PopupRenderer.ts and 1 other location - About 4 hrs to fix
            src/pages/popup-v2/legacy/PopupRenderer.ts on lines 228..236

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

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

              public async attachBrowserTab(tabId: number, attachInfo: browser.Tabs.OnAttachedAttachInfoType): Promise<void> {
                if (null == this._params) return;
                if (null == attachInfo.newWindowId) return;
                const newWindowId = attachInfo.newWindowId;
                let movedTab: browser.Tabs.Tab | null = null;
            Severity: Minor
            Found in src/lib/states/BrowserStateStore.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 renderContainerWithTabs has 104 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public renderContainerWithTabs(windowId: number, displayedContainer: DisplayedContainer, tabs: CompatTab[], isPrivate = false, tabAttributeMap?: TabAttributeMap): MenulistContainerElement {
                if (isPrivate && !displayedContainer.cookieStore.isPrivate) {
                  throw new Error('Cannot render container with tabs for private window with non-private container');
                }
                if (tabAttributeMap) {
            Severity: Major
            Found in src/pages/popup-v2/legacy/PopupRenderer.ts - About 4 hrs to fix

              Function getBrowserState has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                public getBrowserState(params: BrowserStateConstructParams): BrowserStateDao {
                  const displayedContainers = [... params.displayedContainers];
                  params.tabGroupDirectorySnapshot.sortDisplayedContainers(displayedContainers);
                  const value: BrowserStateDao = {
                    currentWindowId: browser.windows.WINDOW_ID_NONE,
              Severity: Minor
              Found in src/lib/states/BrowserStateService.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 parse has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
              Open

                public parse(listing: string): PackageDirectory {
                  const JAR_SCHEME = 'jar:';
                  const lines = listing.split('\n').map(line => line.trim()).filter(line => line != '');
                  const packageDirectory: PackageDirectory = {
                    packageLocationUrl: "",
              Severity: Minor
              Found in src/lib/package/DirectoryListingParser.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 3 locations. Consider refactoring.
              Open

              export const PrivateBrowsingButton = ({onClick}: {onClick?: () => void}) => {
                const tooltipText = i18n.getMessage('privateBrowsing');
                const iconUrl = '/img/firefox-icons/private-browsing-icon.svg';
                return <Button onClick={onClick} tooltipText={tooltipText} name={tooltipText} iconUrl={iconUrl} useIconMask={false}></Button>
              };
              Severity: Major
              Found in src/pages/navigation/navigation-components.tsx and 2 other locations - About 3 hrs to fix
              src/pages/navigation/navigation-components.tsx on lines 74..78
              src/pages/navigation/navigation-components.tsx on lines 80..84

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

              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 const CreateContainerButton = ({onClick}: {onClick?: () => void}) => {
                const tooltipText = i18n.getMessage('buttonNewContainer');
                const iconUrl = '/img/firefox-icons/plus.svg';
                return <Button onClick={onClick} tooltipText={tooltipText} name={tooltipText} iconUrl={iconUrl} useIconMask={true}></Button>
              };
              Severity: Major
              Found in src/pages/navigation/navigation-components.tsx and 2 other locations - About 3 hrs to fix
              src/pages/navigation/navigation-components.tsx on lines 68..72
              src/pages/navigation/navigation-components.tsx on lines 80..84

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

              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 const TemporatyContainerButton = ({onClick}: {onClick?: () => void}) => {
                const tooltipText = i18n.getMessage('buttonNewTemporaryContainer');
                const iconUrl = '/img/material-icons/timelapse.svg';
                return <Button onClick={onClick} tooltipText={tooltipText} name={tooltipText} iconUrl={iconUrl} useIconMask={true}></Button>
              };
              Severity: Major
              Found in src/pages/navigation/navigation-components.tsx and 2 other locations - About 3 hrs to fix
              src/pages/navigation/navigation-components.tsx on lines 68..72
              src/pages/navigation/navigation-components.tsx on lines 74..78

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

              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

              File BrowserStateStore.ts has 310 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /* -*- indent-tabs-mode: nil; tab-width: 2; -*- */
              /* vim: set ts=2 sw=2 et ai : */
              /**
                Container Tab Groups
                Copyright (C) 2023 Menhera.org
              Severity: Minor
              Found in src/lib/states/BrowserStateStore.ts - About 3 hrs to fix

                Function build has 85 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public build(): CtgFragmentElement {
                    const fragment = document.createElement('ctg-fragment') as CtgFragmentElement;
                    fragment.id = this.getFragmentId();
                
                    const helpBanner = new HelpBannerElement();
                Severity: Major
                Found in src/pages/popup-v2/fragments/HelpFragmentBuilder.ts - About 3 hrs to fix

                  Function format has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    public static format(...args: unknown[]): unknown[] {
                      if (args.length < 1) {
                        return args;
                      }
                      const firstArg = args.shift();
                  Severity: Major
                  Found in src/lib/console/ConsoleFormatter.ts - About 3 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language