Showing 187 of 448 total issues
Function build
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async build(
dat: DAT,
parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
crcToPatches: Map<string, Patch[]>,
): Promise<Map<Parent, ReleaseCandidate[]>> {
Function sortMap
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
private sortMap(checksumsToFiles: ChecksumsToFiles): void {
const outputDir = path.resolve(this.options.getOutputDirRoot());
const outputDirDisk = FsPoly.diskResolved(outputDir);
[...checksumsToFiles.values()].forEach((files) =>
Function loadFile
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
async loadFile(cacheFilePath: string): Promise<void> {
this.cache = await new Cache<CacheValue>({
filePath: cacheFilePath,
fileFlushMillis: 60_000,
saveOnExit: true,
Function scanPaths
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
private static async scanPaths(
globPatterns: string[],
walkCallback?: FsWalkCallback,
requireFiles = true,
): Promise<string[]> {
- 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 applyPatch
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static async applyPatch(
patchFile: FilePoly,
sourceFile: FilePoly,
targetFile: FilePoly,
): Promise<void> {
Function getEmptyDirs
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static async getEmptyDirs(dirsToClean: string | string[]): Promise<string[]> {
if (Array.isArray(dirsToClean)) {
return (
await Promise.all(
dirsToClean.map(async (dirToClean) => DirectoryCleaner.getEmptyDirs(dirToClean)),
Function applyPatchWindow
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static async applyPatchWindow(
sourceFile: FilePoly,
targetFile: FilePoly,
header: VcdiffHeader,
copyCache: VcdiffCache,
Function shouldFilterOut
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private shouldFilterOut(dat: DAT): boolean {
const datNameRegex = this.options.getDatNameRegex();
if (datNameRegex && !datNameRegex.some((regex) => regex.test(dat.getName()))) {
return true;
}
Function parseDatFiles
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async parseDatFiles(datFiles: File[]): Promise<DAT[]> {
this.progressBar.logTrace(
`parsing ${datFiles.length.toLocaleString()} DAT file${datFiles.length !== 1 ? 's' : ''}`,
);
this.progressBar.setSymbol(ProgressBarSymbol.DAT_PARSING);
Function constructor
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected constructor(fileProps: FileProps) {
this.filePath = path.normalize(fileProps.filePath);
this.size = fileProps.size ?? 0;
this.checksumBitmask = fileProps.checksumBitmask;
this.crc32 = fileProps.crc32?.toLowerCase().replace(/^0x/, '').padStart(8, '0');
Function sortAndFilter
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private sortAndFilter(
dat: DAT,
parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
): Map<Parent, ReleaseCandidate[]> {
const output = new Map<Parent, ReleaseCandidate[]>();
- 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 render
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
render(force = false): void {
this.singleBarFormatted?.getSingleBar().update(this.payload);
const callback = (): void => {
// Dequeue all log messages
- 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 process
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async process(inputRomFiles: File[]): Promise<File[]> {
if (inputRomFiles.length === 0) {
return inputRomFiles;
}
- 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 parseObject
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private parseObject(): CMProObject {
if (this.contents.charAt(this.pos) === '(') {
this.pos += 1;
}
this.skipWhitespace();
- 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 addWaitingMessage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
addWaitingMessage(waitingMessage: string): void {
if (!this.singleBarFormatted) {
return;
}
this.waitingMessages.set(waitingMessage, TimePoly.hrtimeMillis());
- 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 writeCopyData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async writeCopyData(
sourceFile: FilePoly,
targetFile: FilePoly,
targetWindowPosition: number,
size: number,
- 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 findFiles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
findFiles(file: File | ROM): File[] | undefined {
const sha256 = file.sha256?.replace(/[^0-9a-f]/gi, '');
if (sha256 && this.sha256.has(sha256)) {
return this.sha256.get(sha256);
}
- 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 parseDatFile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private async parseDatFile(datFile: File): Promise<DAT | undefined> {
let dat: DAT | undefined;
if (
!dat &&
- 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 getEtaFormatted
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private getEtaFormatted(etaSeconds: number): string {
// Rate limit how often the ETA can change
// Update only every 5s if the ETA is >60s
const elapsedMs = TimePoly.hrtimeMillis(this.lastEtaTime);
if (etaSeconds > 60 && elapsedMs < 5000) {
- 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 walk
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static async walk(pathLike: PathLike, callback?: FsWalkCallback): Promise<string[]> {
let output: string[] = [];
let entries: fs.Dirent[];
try {
- 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"