Showing 187 of 448 total issues
Function getGameType
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
getGameType(): GameType {
// NOTE(cemmer): priority here matters!
if (this.isBios()) {
return GameType.BIOS;
}
- 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 fromFiles
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
static fromFiles(files: File[]): IndexedFiles {
const crc32RawMap = new Map<string, File[]>();
const crc32WithoutHeaderMap = new Map<string, File[]>();
const md5RawMap = new Map<string, File[]>();
const md5WithoutHeaderMap = new Map<string, File[]>();
Function entryOf
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async entryOf<A extends Archive>(
archiveEntryProps: ArchiveEntryProps<A>,
checksumBitmask: number = ChecksumBitmask.NONE,
): Promise<ArchiveEntry<A>> {
let finalSize = archiveEntryProps.size;
Function fileOf
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
static async fileOf(
fileProps: FileProps,
checksumBitmask: number = ChecksumBitmask.NONE,
): Promise<File> {
let finalSize = fileProps.size;
Function getGameType
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
getGameType(): GameType {
// NOTE(cemmer): priority here matters!
if (this.isBios()) {
return GameType.BIOS;
}
Consider simplifying this complex logical expression. Open
if (
(!finalCrcWithHeader && checksumBitmask & ChecksumBitmask.CRC32) ||
(!finalMd5WithHeader && checksumBitmask & ChecksumBitmask.MD5) ||
(!finalSha1WithHeader && checksumBitmask & ChecksumBitmask.SHA1) ||
(!finalSha256WithHeader && checksumBitmask & ChecksumBitmask.SHA256)
Consider simplifying this complex logical expression. Open
if (
(!finalCrcWithHeader && checksumBitmask & ChecksumBitmask.CRC32) ||
(!finalMd5WithHeader && checksumBitmask & ChecksumBitmask.MD5) ||
(!finalSha1WithHeader && checksumBitmask & ChecksumBitmask.SHA1) ||
(!finalSha256WithHeader && checksumBitmask & ChecksumBitmask.SHA256)
Function clean
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
async clean(dirsToClean: string[], filesToExclude: File[]): Promise<string[]> {
// If nothing was written, then don't clean anything
if (filesToExclude.length === 0) {
this.progressBar.logTrace('no files were written, not cleaning output');
return [];
Function generate
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
async generate(
scannedRomFiles: File[],
cleanedOutputFiles: string[],
datStatuses: DATStatus[],
): Promise<void> {
Function validate
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
validate(dat: DAT, parentsToCandidates: Map<Parent, ReleaseCandidate[]>): string[] {
if (parentsToCandidates.size === 0) {
this.progressBar.logTrace(
`${dat.getNameShort()}: no parents to validate merged & split ROM sets for`,
);
Function create
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
async create(
originalDat: DAT,
parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
): Promise<string | undefined> {
if (!this.options.shouldFixdat()) {
Function games
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
const games = cmproDatGames.flatMap((game) => {
const gameName = game.name ?? game.comment;
let gameRoms: ROMProps[] = [];
if (game.rom) {
Function addArchiveEntries
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static async addArchiveEntries(
zipFile: Archiver,
inputToOutput: [File, ArchiveEntry<Zip>][],
): Promise<void> {
let zipFileError: Error | undefined;
Function parseXmlDat
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private parseXmlDat(datFile: File, fileContents: string): DAT | undefined {
this.progressBar.logTrace(
`${datFile.toString()}: attempting to parse ${fsPoly.sizeReadable(fileContents.length)} of XML`,
);
Function hashArchiveFiles
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async hashArchiveFiles(
dat: DAT,
parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
): Promise<Map<Parent, ReleaseCandidate[]>> {
return new Map(
Function toCsv
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
async toCsv(options: Options): Promise<string> {
const foundReleaseCandidates = DATStatus.getValuesForAllowedTypes(
options,
this.foundRomTypesToReleaseCandidates,
);
- 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 clean
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
async clean(dirsToClean: string[], filesToExclude: File[]): Promise<string[]> {
// If nothing was written, then don't clean anything
if (filesToExclude.length === 0) {
this.progressBar.logTrace('no files were written, not cleaning output');
return [];
- 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 16 (exceeds 5 allowed). Consider refactoring. Open
private static async applyPatch(
patchFile: FilePoly,
sourceFile: FilePoly,
targetFile: FilePoly,
): Promise<void> {
- 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 validate
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
validate(dat: DAT, parentsToCandidates: Map<Parent, ReleaseCandidate[]>): string[] {
if (parentsToCandidates.size === 0) {
this.progressBar.logTrace(
`${dat.getNameShort()}: no parents to validate merged & split ROM sets for`,
);
- 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 constructor
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(
dat: DAT,
options: Options,
parentsToReleaseCandidates: Map<Parent, ReleaseCandidate[]>,
) {