JamieMason/syncpack

View on GitHub

Showing 26 of 108 total issues

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

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

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

          inspectAll(): Effect.Effect<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 inspectAll has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            inspectAll(): Effect.Effect<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<Instances> {
            Severity: Minor
            Found in src/get-instances/index.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<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 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 withLogger has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function withLogger(program: Effect.Effect<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 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

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

                  function getChild(parent: unknown, prop: string): unknown | Either.Either<never, Error> {
                    // 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

                  Avoid too many return statements within this function.
                  Open

                    if (scoreA < scoreB) return LT;
                  Severity: Major
                  Found in src/version-group/lib/get-preferred-version.ts - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                      if (scoreA > scoreB) return GT;
                    Severity: Major
                    Found in src/version-group/lib/get-preferred-version.ts - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                        if (isShortcut) return `https://github.com/${input}`;
                      Severity: Major
                      Found in src/lib/format-repository-url.ts - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                          if (b === '*') return LT;
                        Severity: Major
                        Found in src/version-group/lib/get-preferred-version.ts - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                            if (gt(cleanA, cleanB)) return GT;
                          Severity: Major
                          Found in src/version-group/lib/get-preferred-version.ts - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                        return Effect.succeed(new NamedVersionStringStrategy(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 Effect.succeed(new UnnamedVersionStringStrategy(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 EQ;
                                Severity: Major
                                Found in src/version-group/lib/get-preferred-version.ts - About 30 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language