JamieMason/syncpack

View on GitHub

Showing 31 of 115 total issues

Function createVersionGroups has 135 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function createVersionGroups(
  ctx: Ctx,
): Effect.Effect<never, VersionGroup.ConfigError, VersionGroup.Any[]> {
  const { rcFile } = ctx.config;
  const versionGroups: Effect.Effect<never, VersionGroup.ConfigError, VersionGroup.Any>[] = [
Severity: Major
Found in src/version-group/create-version-groups.ts - About 5 hrs to fix

    Function inspectAll has 101 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      inspectAll(): Effect.Effect<never, never, Report.Version.Group[]> {
        return Effect.all(
          Object.entries(groupBy('name', this.instances)).flatMap(([name, instances]) => {
            const localInstance = getLocalInstance(instances);
    
    
    Severity: Major
    Found in src/version-group/standard.ts - About 4 hrs to fix

      Function createSemverGroups has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function createSemverGroups(
        ctx: Ctx,
      ): Effect.Effect<never, SemverGroup.ConfigError, SemverGroup.Any[]> {
        const { rcFile } = ctx.config;
        const semverGroups: Effect.Effect<never, SemverGroup.ConfigError, SemverGroup.Any>[] = [
      Severity: Major
      Found in src/semver-group/create-semver-groups.ts - About 3 hrs to fix

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

        import * as Schema from '@effect/schema/Schema';
        import chalk from 'chalk';
        import { Data, Effect, identity, pipe } from 'effect';
        import https from 'https';
        import ora from 'ora';
        Severity: Minor
        Found in src/bin-update/effects.ts - About 3 hrs to fix

          Function inspectAll has 68 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            inspectAll(): Effect.Effect<never, never, Report.Version.Group[]> {
              return Effect.all(
                Object.entries(groupBy('name', this.instances)).flatMap(([name, instances]) =>
                  pipe(
                    findSnappedToInstance(name, this.config.snapTo, instances),
          Severity: Major
          Found in src/version-group/snapped-to.ts - About 2 hrs to fix

            Function promptForUpdates has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              promptForUpdates(outdated: Releases[]): Effect.Effect<never, PromptCancelled, void> {
                return pipe(
                  Effect.Do,
                  Effect.bind('releasesByType', () => groupByReleaseType(outdated)),
                  // Create choices to ask if they want major, minor, patch etc
            Severity: Major
            Found in src/bin-update/effects.ts - About 2 hrs to fix

              Function inspectAll has 64 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                inspectAll(): Effect.Effect<never, never, Report.Version.Group[]> {
                  return Effect.all(
                    Object.entries(groupBy('name', this.instances)).flatMap(([name, instances]) =>
                      pipe(
                        instances,
              Severity: Major
              Found in src/version-group/same-range.ts - About 2 hrs to fix

                Function getInstances has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function getInstances(
                  ctx: Ctx,
                  io: Io,
                  errorHandlers: ErrorHandlers,
                ): Effect.Effect<never, never, Instances> {
                Severity: Minor
                Found in src/get-instances/index.ts - About 1 hr to fix

                  Function promptForReleaseType has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function promptForReleaseType(
                    releaseType: ReleaseType,
                    doState: { releasesByType: ReleasesByType; releaseTypeAnswers: string[] },
                  ): Effect.Effect<never, PromptCancelled, Releases[]> {
                    const { releasesByType, releaseTypeAnswers } = doState;
                  Severity: Minor
                  Found in src/bin-update/effects.ts - About 1 hr to fix

                    Function fetchLatestVersions has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      fetchLatestVersions(
                        instance: Instance,
                      ): Effect.Effect<never, HttpError | NpmRegistryError, Releases> {
                        return pipe(
                          fetchJson(`https://registry.npmjs.org/${instance.name}`),
                    Severity: Minor
                    Found in src/bin-update/effects.ts - About 1 hr to fix

                      Function getInstances has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        getInstances(enabledTypes: Strategy.Any[]): Effect.Effect<never, never, Instance[]> {
                          if (!this._instances) {
                            return pipe(
                              Effect.all(
                                enabledTypes.map((strategy) =>
                      Severity: Minor
                      Found in src/get-package-json-files/package-json-file.ts - About 1 hr to fix

                        Function showHelpOnError has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export function showHelpOnError(program: Command) {
                          program.showHelpAfterError(chalk`
                        1. The following options were replaced in syncpack@9.0.0:
                        {red
                          -p, --prod              include dependencies
                        Severity: Minor
                        Found in src/lib/show-help-on-error.ts - About 1 hr to fix

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

                          function fetchJson(url: string): Effect.Effect<never, HttpError | NpmRegistryError, unknown> {
                            return pipe(
                              Effect.async<never, HttpError, string>((resume) => {
                                // setTimeout(
                                //   () => {
                          Severity: Minor
                          Found in src/bin-update/effects.ts - About 1 hr to fix

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

                            export function withLogger(program: Effect.Effect<never, never, unknown>) {
                              const logger = Logger.make(({ logLevel, message }) => {
                                if (logLevel === LogLevel.Info) {
                                  globalThis.console.info(message);
                                } else if (logLevel === LogLevel.Debug) {
                            Severity: Minor
                            Found in src/lib/with-logger.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 compareSemver has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function compareSemver(a: string, b: string): -1 | 0 | 1 {
                              if (a.startsWith('workspace:')) return LT;
                              if (b.startsWith('workspace:')) return GT;
                              if (a === b) return EQ;
                              if (a === '*') return GT;
                            Severity: Minor
                            Found in src/version-group/lib/get-preferred-version.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 getChild has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function getChild(parent: unknown, prop: string): unknown | Either.Either<Error, never> {
                              // quit if any ancestor was already not found
                              if (Either.isEither(parent) && Either.isLeft(parent)) return parent;
                              // ensure we have a plain value and not an Ok
                              const value =
                            Severity: Minor
                            Found in src/lib/get.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 formatRepositoryUrl has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export function formatRepositoryUrl(input: string | undefined): string | undefined {
                              if (!input) return undefined;
                            
                              const extractedUrl = input.match(/https?:\/\/[^\s]+/)?.[0];
                              if (extractedUrl) {
                            Severity: Minor
                            Found in src/lib/format-repository-url.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

                            Avoid too many return statements within this function.
                            Open

                                return `https://${withoutAffix}`;
                            Severity: Major
                            Found in src/lib/format-repository-url.ts - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                          return Effect.succeed(new VersionsByNameStrategy(name, path));
                              Severity: Major
                              Found in src/config/get-custom-types.ts - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return createError(config, ERR_STRATEGY);
                                Severity: Major
                                Found in src/config/get-custom-types.ts - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language