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>[] = [
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);
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>[] = [
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),
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,
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> {
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) =>
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
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;
- Read upRead up
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) {
- Read upRead up
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) {
- Read upRead up
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 =
- Read upRead up
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;
Avoid too many return
statements within this function. Open
if (scoreA > scoreB) return GT;
Avoid too many return
statements within this function. Open
if (isShortcut) return `https://github.com/${input}`;
Avoid too many return
statements within this function. Open
if (b === '*') return LT;
Avoid too many return
statements within this function. Open
if (gt(cleanA, cleanB)) return GT;
Avoid too many return
statements within this function. Open
return Effect.succeed(new NamedVersionStringStrategy(name, path));
Avoid too many return
statements within this function. Open
return Effect.succeed(new UnnamedVersionStringStrategy(name, path));
Avoid too many return
statements within this function. Open
return EQ;