Showing 187 of 448 total issues
Function parseDatFile
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async parseDatFile(datFile: File): Promise<DAT | undefined> {
let dat: DAT | undefined;
if (
!dat &&
Function romsWithFiles
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
unpatchedReleaseCandidate.getRomsWithFiles().map(async (romWithFiles) => {
// Apply the new filename
let rom = romWithFiles.getRom();
let inputFile = romWithFiles.getInputFile();
let outputFile = romWithFiles.getOutputFile();
Function delete
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
async delete(
inputRoms: File[],
movedRoms: File[],
datsToWrittenFiles: Map<DAT, File[]>,
): Promise<string[]> {
Function addCommands
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
const addCommands = (yargsObj: Argv, previousCommands: string[] = []): Argv => {
commands
// Don't allow/show duplicate commands, i.e. don't give `igir copy copy` as an option
.filter(([command]) => !previousCommands.includes(command))
// Don't allow/show conflicting commands, i.e. don't give `igir copy move` as an option
Function process
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
async process(inputRomFiles: File[]): Promise<File[]> {
if (inputRomFiles.length === 0) {
return inputRomFiles;
}
Function rows
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
.map((game) => {
let status = GameStatus.MISSING;
if (this.ignoredHashCodesToGames.has(game.hashCode())) {
status = GameStatus.IGNORED;
Function applyPatchWindow
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private static async applyPatchWindow(
sourceFile: FilePoly,
targetFile: FilePoly,
header: VcdiffHeader,
copyCache: VcdiffCache,
- 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 entriesFromArchiveExtension
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private async entriesFromArchiveExtension(
filePath: string,
checksumBitmask: number,
fileExt = filePath.replace(/.+?(?=(\.[a-zA-Z0-9]+)+)/, ''),
): Promise<ArchiveEntry<Archive>[] | 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 applyCommandOpen
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async applyCommandOpen(patchFile: FilePoly, targetFile: FilePoly): Promise<void> {
const multiFile = (await patchFile.readNext(1)).readUInt8();
if (multiFile > 0) {
throw new ExpectedError(
`Multi-file NINJA patches aren't supported: ${this.getFile().toString()}`,
Function parseCueFile
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static async parseCueFile<T extends Archive>(
archive: T,
file: CueFile,
binFilePath: string,
checksumBitmask: number,
Function correctExtensions
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async correctExtensions(
dat: DAT,
parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
): Promise<Map<Parent, ReleaseCandidate[]>> {
return new Map(
Function buildCorrectedRom
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async buildCorrectedRom(
dat: DAT,
parent: Parent,
releaseCandidate: ReleaseCandidate,
romWithFiles: ROMWithFiles,
Function filterOutPartiallyConsumedArchives
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
private filterOutPartiallyConsumedArchives(movedRoms: File[], inputRoms: File[]): string[] {
const groupedInputRoms = MovedROMDeleter.groupFilesByFilePath(inputRoms);
const groupedMovedRoms = MovedROMDeleter.groupFilesByFilePath(movedRoms);
return [...groupedMovedRoms.entries()]
Function hashedReleaseCandidates
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
releaseCandidates.map(async (releaseCandidate) => {
const hashedRomsWithFiles = await Promise.all(
releaseCandidate.getRomsWithFiles().map(async (romWithFiles) => {
const inputFile = romWithFiles.getInputFile();
if (!(inputFile instanceof ArchiveFile)) {
Function getOrComputeArchiveChecksums
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getOrComputeArchiveChecksums<T extends Archive>(
archive: T,
checksumBitmask: number,
): Promise<ArchiveEntry<Archive>[]> {
// NOTE(cemmer): we're explicitly not catching ENOENT errors here, we want it to bubble up
Function parseGdi
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
private static async parseGdi<T extends Archive>(
archive: T,
gdiFilePath: string,
binRawFilePaths: string[],
checksumBitmask: number,
Function parseXmlDat
has a Cognitive Complexity of 13 (exceeds 5 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`,
);
- 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 create
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
async create(
dat: DAT,
parentsToCandidates: Map<Parent, ReleaseCandidate[]>,
): Promise<string | undefined> {
if (!this.options.shouldDir2Dat()) {
Function trashOrDelete
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async trashOrDelete(filePaths: string[]): Promise<void> {
// Prefer recycling...
for (let i = 0; i < filePaths.length; i += Defaults.OUTPUT_CLEANER_BATCH_SIZE) {
const filePathsChunk = filePaths.slice(i, i + Defaults.OUTPUT_CLEANER_BATCH_SIZE);
this.progressBar.logInfo(
Function extractAndPatchToFile
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
async extractAndPatchToFile(destinationPath: string): Promise<void> {
const start = this.getFileHeader()?.getDataOffsetBytes() ?? 0;
const patch = this.getPatch();
// Simple case: create a file without removing its header