Skip to content

Commit

Permalink
Refactor: remove unused Options from CandidatePatchGenerator (#1173)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmercm committed Jun 22, 2024
1 parent 12ce729 commit 5ebee0c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/igir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export default class Igir {
const candidates = await new CandidateGenerator(this.options, progressBar)
.generate(dat, indexedRoms);

const patchedCandidates = await new CandidatePatchGenerator(this.options, progressBar)
const patchedCandidates = await new CandidatePatchGenerator(progressBar)
.generate(dat, candidates, patches);

const preferredCandidates = await new CandidatePreferer(this.options, progressBar)
Expand Down
6 changes: 1 addition & 5 deletions src/modules/candidatePatchGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import ROM from '../types/dats/rom.js';
import ArchiveEntry from '../types/files/archives/archiveEntry.js';
import File from '../types/files/file.js';
import { ChecksumBitmask } from '../types/files/fileChecksums.js';
import Options from '../types/options.js';
import Patch from '../types/patches/patch.js';
import ReleaseCandidate from '../types/releaseCandidate.js';
import ROMWithFiles from '../types/romWithFiles.js';
Expand All @@ -21,11 +20,8 @@ import Module from './module.js';
* {@link ReleaseCandidate} of that {@link Game}.
*/
export default class CandidatePatchGenerator extends Module {
private readonly options: Options;

constructor(options: Options, progressBar: ProgressBar) {
constructor(progressBar: ProgressBar) {
super(progressBar, CandidatePatchGenerator.name);
this.options = options;
}

/**
Expand Down
3 changes: 2 additions & 1 deletion src/types/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -902,7 +902,8 @@ export default class Options implements OptionsProps {
return (await Options.scanPaths(outputDirs, walkCallback, false))
.map((filePath) => path.normalize(filePath))
.filter((filePath) => !writtenFilesNormalized.has(filePath))
.filter((filePath) => !cleanExcludedFilesNormalized.has(filePath));
.filter((filePath) => !cleanExcludedFilesNormalized.has(filePath))
.sort();
}

getCleanDryRun(): boolean {
Expand Down
2 changes: 1 addition & 1 deletion test/modules/candidatePatchGenerator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function runPatchCandidateGenerator(

const patches = await new PatchScanner(options, new ProgressBarFake()).scan();

return new CandidatePatchGenerator(options, new ProgressBarFake())
return new CandidatePatchGenerator(new ProgressBarFake())
.generate(dat, parentsToCandidates, patches);
}

Expand Down
2 changes: 1 addition & 1 deletion test/modules/candidateWriter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ async function candidateWriter(
.generate(dat, indexedRomFiles);
if (patchGlob) {
const patches = await new PatchScanner(options, new ProgressBarFake()).scan();
candidates = await new CandidatePatchGenerator(options, new ProgressBarFake())
candidates = await new CandidatePatchGenerator(new ProgressBarFake())
.generate(dat, candidates, patches);
}
candidates = await new CandidateCombiner(options, new ProgressBarFake())
Expand Down

0 comments on commit 5ebee0c

Please sign in to comment.