jiahaog/nativefier

View on GitHub

Showing 79 of 148 total issues

Function getVersionString has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function getVersionString(
  executablePath: string,
  versionString: string,
): string | undefined {
  let rcedit = path.resolve(
Severity: Minor
Found in src/helpers/upgrade/rceditGet.ts - About 1 hr to fix

    Function onNewWindowHelper has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    export function onNewWindowHelper(
      options: WindowOptions,
      setupWindow: (options: WindowOptions, window: BrowserWindow) => void,
      details: HandlerDetails,
      parent?: BrowserWindow,
    Severity: Minor
    Found in app/src/helpers/windowEvents.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

    Function setDockBadge has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      ? (count?: number | string, bounce = false): void => {
          if (count !== undefined) {
            app.dock.setBadge(count.toString());
            if (bounce && typeof count === 'number' && count > currentBadgeCount)
              app.dock.bounce();
    Severity: Minor
    Found in app/src/main.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 linkIsInternal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export function linkIsInternal(
      currentUrl: string,
      newUrl: string,
      internalUrlRegex: string | RegExp | undefined,
      isStrictInternalUrlsEnabled: boolean | undefined,
    Severity: Minor
    Found in app/src/helpers/helpers.ts - About 35 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 getVersionString has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    export function getVersionString(
      executablePath: string,
      versionString: string,
    ): string | undefined {
      let rcedit = path.resolve(
    Severity: Minor
    Found in src/helpers/upgrade/rceditGet.ts - About 35 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 getExecutableArch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    function getExecutableArch(
      exeBytes: Uint8Array,
      platform: string,
    ): string | undefined {
      switch (platform) {
    Severity: Minor
    Found in src/helpers/upgrade/executableHelpers.ts - About 35 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

    Avoid too many return statements within this function.
    Open

        return { action: 'allow' };
    Severity: Major
    Found in app/src/helpers/windowEvents.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return;
      Severity: Major
      Found in src/build/buildIcon.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return false;
        Severity: Major
        Found in app/src/helpers/helpers.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return;
          Severity: Major
          Found in src/build/buildIcon.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return domainify(currentUrl) === domainify(newUrl);
            Severity: Major
            Found in app/src/helpers/helpers.ts - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                    return;
              Severity: Major
              Found in src/build/buildIcon.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return { action: 'deny' };
                Severity: Major
                Found in app/src/helpers/windowEvents.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return;
                  Severity: Major
                  Found in src/build/buildIcon.ts - About 30 mins to fix

                    Function initContextMenu has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export function initContextMenu(
                      options: OutputOptions,
                      window?: BrowserWindow,
                    ): void {
                      log.debug('initContextMenu');
                    Severity: Minor
                    Found in app/src/components/contextMenu.ts - About 25 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 maybeCopyScripts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    async function maybeCopyScripts(
                      srcs: string[] | undefined,
                      dest: string,
                    ): Promise<void> {
                      if (!srcs || srcs.length === 0) {
                    Severity: Minor
                    Found in src/build/prepareElectronApp.ts - About 25 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 copyIconsIfNecessary has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    async function copyIconsIfNecessary(
                      options: AppOptions,
                      appPath: string,
                    ): Promise<void> {
                      log.debug('Copying icons if necessary');
                    Severity: Minor
                    Found in src/build/buildNativefierApp.ts - About 25 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 getChromeVersionForElectronVersion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export async function getChromeVersionForElectronVersion(
                      electronVersion: string,
                      url = ELECTRON_VERSIONS_URL,
                    ): Promise<string> {
                      if (!electronVersion || electronVersion === DEFAULT_ELECTRON_VERSION) {
                    Severity: Minor
                    Found in src/infer/browsers/inferChromeVersion.ts - About 25 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 findUpgradeAppResourcesDir has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    function findUpgradeAppResourcesDir(searchDir: string): string | null {
                      searchDir = dirExists(searchDir) ? searchDir : path.dirname(searchDir);
                      log.debug(`Searching for nativfier.json in ${searchDir}`);
                      const children = fs.readdirSync(searchDir, { withFileTypes: true });
                      if (fileExists(path.join(searchDir, 'nativefier.json'))) {
                    Severity: Minor
                    Found in src/helpers/upgrade/upgrade.ts - About 25 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

                    Severity
                    Category
                    Status
                    Source
                    Language