Showing 187 of 448 total issues
Function getGames
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
getGames(): Game[] {
if (Array.isArray(this.game)) {
if (this.game.length > 0) {
return this.game;
}
- 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 fromFilePoly
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static async fromFilePoly(patchFile: FilePoly): Promise<VcdiffHeader> {
const header = await patchFile.readNext(3);
if (!header.equals(VcdiffHeader.FILE_SIGNATURE)) {
await patchFile.close();
throw new ExpectedError(`Vcdiff patch header is invalid: ${patchFile.getPathLike()}`);
- 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 parse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public parse(): DATProps {
this.pos = 0;
const result: CMProObject = {};
while (this.pos < this.contents.length) {
- 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 mergeParent
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private mergeParent(dat: DAT, parent: Parent, gameNamesToGames: Map<string, Game>): Game[] {
let games = parent.getGames();
// Sanitization
games = games.map((game) =>
- 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 infer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
infer(dat: DAT): DAT {
if (dat.hasParentCloneInfo() && !this.options.getDatIgnoreParentClone()) {
this.progressBar.logTrace(`${dat.getNameShort()}: DAT has parent/clone info, skipping`);
return 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 fromFilePoly
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static async fromFilePoly(inputRomFile: File, patchFile: FilePoly): Promise<PPFHeader> {
const header = (await patchFile.readNext(5)).toString();
if (!header.startsWith(PPFHeader.FILE_SIGNATURE.toString())) {
throw new ExpectedError(`PPF patch header is invalid: ${patchFile.getPathLike()}`);
}
- 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 globPath
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private static async globPath(
inputPath: string,
walkCallback: FsWalkCallback,
): Promise<string[]> {
// Windows will report that \\.\nul doesn't exist, catch it explicitly
- 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 preferLanguagesSort
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private preferLanguagesSort(a: ReleaseCandidate, b: ReleaseCandidate): number {
const preferLanguages = this.options.getPreferLanguages();
if (preferLanguages.length === 0) {
return 0;
}
- 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 mv
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static async mv(oldPath: string, newPath: string, attempt = 1): Promise<void> {
try {
return await fs.promises.rename(oldPath, newPath);
} catch (error) {
// These are the same error codes that `graceful-fs` catches
- 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 sanitizeDat
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private sanitizeDat(dat: DAT): DAT {
const games = dat.getGames().map((game) => {
const roms = game
.getRoms()
// Games have to have at least one ROM with a non-empty checksum
- 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 getRegions
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getRegions(): string[] {
const releaseRegions = this.getReleases().map((release) => release.getRegion().toUpperCase());
if (releaseRegions.length > 0) {
return releaseRegions;
}
- 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 archiveEntryPriority
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static archiveEntryPriority(file: File): number {
if (!(file instanceof ArchiveEntry)) {
return 0;
}
if (file.getArchive() instanceof Zip) {
- 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 parse
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
parse(argv: string[]): Options {
const groupRomInput = 'ROM input options:';
const groupDatInput = 'DAT input options:';
const groupPatchInput = 'Patch input options:';
const groupRomOutputPath = 'ROM output path options (processed in order):';
- 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 getHelpWidth
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static getHelpWidth(argv: string[]): number {
// Look for --help/-h with a numerical value
for (let i = 0; i < argv.length; i += 1) {
if (argv[i].toLowerCase() === '--help' || argv[i].toLowerCase() === '-h') {
const helpFlagVal = Number.parseInt(argv[i + 1], 10);
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static async applyPatch(
patchFile: FilePoly,
targetFile: FilePoly,
offsetSize: number,
eofString: 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 parseQuotedString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private parseQuotedString(): string {
if (this.contents.charAt(this.pos) !== '"') {
throw new ExpectedError('invalid quoted string');
}
this.pos += 1;
- 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 extractEntryToStreamCached
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private async extractEntryToStreamCached<T>(
entryPath: string,
callback: (stream: Readable) => Promise<T> | T,
): Promise<T> {
await this.tempSingletonMutex.runExclusive(async () => {
- 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 sanitizeGlobPattern
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static async sanitizeGlobPattern(globPattern: string): Promise<string> {
const pathsSplit = globPattern.split(/[\\/]/);
for (let i = 0; i < pathsSplit.length; i += 1) {
const subPath = pathsSplit.slice(0, i + 1).join('/');
if (subPath !== '' && !(await fsPoly.exists(subPath))) {
- 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 parseGdi
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static async parseGdi<T extends Archive>(
archive: T,
gdiFilePath: string,
binRawFilePaths: string[],
checksumBitmask: 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
Avoid too many return
statements within this function. Open
return GameType.DEMO;