Showing 27 of 63 total issues
Function listMismatches
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function listMismatches(ctx: Syncpack.Ctx): Syncpack.Ctx {
const hasUserGroups = ctx.versionGroups.length > 1;
ctx.versionGroups.forEach((versionGroup, i) => {
const invalidGroups: InstanceGroup[] =
Function list
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function list(ctx: Syncpack.Ctx): Syncpack.Ctx {
const hasUserGroups = ctx.versionGroups.length > 1;
ctx.versionGroups.forEach((versionGroup, i) => {
const instanceGroups = versionGroup.getAllInstanceGroups();
Function unSafeGetConfig
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function unSafeGetConfig(
disk: Disk,
fromCli: Partial<Syncpack.Config.Cli>,
): Syncpack.Config.Private {
verbose('cli arguments:', fromCli);
Function getPatterns
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getPatterns(disk: Disk) {
return function getPatterns(
program: Syncpack.Config.SyncpackRc,
): R.Result<string[], BaseError> {
type PatternResult = R.Result<string[], BaseError>;
Function unsafeGetGroups
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function unsafeGetGroups(
config: Syncpack.Config.Private,
packageJsonFiles: PackageJsonFile[],
): GroupsByPropName {
type Key = keyof typeof groupsByName;
Function getPatterns
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
return function getPatterns(
program: Syncpack.Config.SyncpackRc,
): R.Result<string[], BaseError> {
type PatternResult = R.Result<string[], BaseError>;
type SafeGetPatterns = () => PatternResult;
Function format
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function format(ctx: Syncpack.Ctx): Syncpack.Ctx {
const { packageJsonFiles } = ctx;
const { sortAz, sortFirst } = ctx.config;
packageJsonFiles.forEach((packageJsonFile) => {
Function getLowestVersion
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
export function getLowestVersion(
versions: string[],
): R.Result<string, BaseError> {
let lowest: LowestVersion | undefined;
- 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 setVersion
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
setVersion(version: string | Delete): void {
const strategyName = this.pathDef.strategy;
const entry: Entry = [this.name, version === DELETE ? undefined : version];
const file = this.packageJsonFile;
switch (strategyName) {
Function fixMismatches
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function fixMismatches(ctx: Syncpack.Ctx): Syncpack.Ctx {
ctx.versionGroups.forEach((versionGroup) => {
const invalidGroups = versionGroup.getInvalidInstanceGroups();
// Nothing to do if there are no mismatches
Function getFilePaths
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function getFilePaths(
disk: Disk,
program: Syncpack.Config.SyncpackRc,
): SafeFilePaths {
return pipe(program, getPatterns(disk), R.flatMap(resolvePatterns));
Function write
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
write(file, pathDef, [, version]) {
const { contents, shortPath } = file;
const isNestedPath = pathDef.path.includes('.');
if (isNestedPath) {
const fullPath = pathDef.path.split('.');
Function write
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
write(file, pathDef, [, version]) {
const { contents, shortPath } = file;
const isNestedPath = pathDef.path.includes('.');
if (isNestedPath) {
Function write
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
write(file, pathDef, [name, version]) {
const { contents, shortPath } = file;
const isNestedPath = pathDef.path.includes('.');
if (isNestedPath) {
const fullPath = pathDef.path.split('.');
Function getExpectedVersion
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
getExpectedVersion(): R.Result<string | Delete, BaseError> {
const versionGroup = this.versionGroup;
if (versionGroup.isBanned()) return R.Ok(DELETE);
if (versionGroup.isUnpinned())
return pipe(
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 getHighestVersion
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function getHighestVersion(
versions: string[],
): R.Result<string, BaseError> {
let highest: HighestVersion | undefined;
- 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 props
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function props<T>(
keys: string,
predicate: (value: unknown) => value is T,
) {
return function getNestedProp(obj: unknown): O.Option<T> {
- 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 onlyOk
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
onlyOk<Input, Output = Input>(
getResult: (value: Input) => R.Result<Output, BaseError>,
) {
return (inputs: Input[]): R.Result<Output[], BaseError> => {
const outputs: Output[] = [];
- 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 getExpectedVersion
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getExpectedVersion(): R.Result<string | Delete, BaseError> {
const versionGroup = this.versionGroup;
if (versionGroup.isBanned()) return R.Ok(DELETE);
if (versionGroup.isUnpinned())
return pipe(
- 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"