Showing 100 of 824 total issues
Function loadFromVersion
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
export const loadFromVersion = async (version: string, force = false, log: ILogger = debug): Promise<IStructs> => {
log.debug("Attempting to load structs for version: %s", version);
// Filter the folders in this directory for ones that match the version
const folders = await fs.readdir(new URL(".", import.meta.url), { withFileTypes: true });
- 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 maskImage
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const maskImage = (sourceImage: Image, mask: Image, threshold: number, crop = false): Image => {
sourceImageGuard(mask);
sourceImageGuard(sourceImage);
uint8safeIntegerGuard(threshold);
assert(mask.channels === 1, "Mask image must have exactly one channel");
Function _trimNpmrcFile
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _trimNpmrcFile(options) {
const { sourceNpmrcPath, linesToPrepend, linesToAppend } = options;
const combinedNpmrcFromCache = _combinedNpmrcMap.get(sourceNpmrcPath);
if (combinedNpmrcFromCache !== undefined) {
return combinedNpmrcFromCache;
Function populateSharedDataVolume
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Effect.gen(function* () {
const volumes: MobyApi.Volumes.Volumes = yield* MobyApi.Volumes.Volumes;
const containers: MobyApi.Containers.Containers = yield* MobyApi.Containers.Containers;
yield* Effect.logInfo("Populating shared emulator data volume...");
Function installAndRun
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
function installAndRun(logger, packageName, packageVersion, packageBinName, packageBinArgs, lockFilePath = process.env[INSTALL_RUN_LOCKFILE_PATH_VARIABLE]) {
const rushJsonFolder = findRushJsonFolder();
const rushCommonFolder = path__WEBPACK_IMPORTED_MODULE_3__.join(rushJsonFolder, 'common');
const rushTempFolder = _getRushTempFolder(rushCommonFolder);
const packageInstallFolder = _ensureAndJoinPath(rushTempFolder, 'install-run', `${packageName}@${packageVersion}`);
Function whichSaveIsBetter
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
export const whichSaveIsBetter = async function <T extends INimblebitJsonSave | DecompressedSave>(
save1: T,
save2: T,
forceLoadStructs: boolean = false,
logger: ILogger = debug
- 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 _waitForDependencies
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
private async _waitForDependencies<T extends DependencyLoader>(
dependencyLoader: T,
retries: number,
waitMs: number
): Promise<ReturnType<T>> {
- 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 _run
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _run() {
const [nodePath /* Ex: /bin/node */, scriptPath /* /repo/common/scripts/install-run-rush.js */, ...packageBinArgs /* [build, --to, myproject] */] = process.argv;
// Detect if this script was directly invoked, or if the install-run-rushx script was invokved to select the
// appropriate binary inside the rush package to run
const scriptName = path__WEBPACK_IMPORTED_MODULE_0__.basename(scriptPath);
Function concatenationSubRoutine
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const concatenationSubRoutine = function <T extends GenericBlocks, U extends GenericJsonSave<T>>(
jsonSave: U,
blocksToUse: T,
log: ILogger = debug
): DecompressedSave {
Function retrieveData
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
public retrieveData() {
// Extract the version of the game
const version = this.dependencies.AppUtilClass.method<Il2Cpp.String>("VersionString").invoke().content;
// Extract the FloorType enum fields
- 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 retrieveData
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public retrieveData() {
// Extract the version of the game
const version = this.dependencies.AppUtilClass.method<Il2Cpp.String>("VersionString").invoke().content;
// Extract the FloorType enum fields
Function _waitForDependencies
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
private async _waitForDependencies<T extends DependencyLoader>(
dependencyLoader: T,
retries: number,
waitMs: number
): Promise<ReturnType<T>> {
Function sort
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
public sort(compare: (a: NodeData, b: NodeData) => boolean): DoublyLinkedList<NodeData> {
if (this._head === undefined || this._tail === undefined) {
return this;
}
if (this.length < 2) {
Function readField
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const readField = (field: Il2Cpp.Field): string | number | boolean | NativePointer | undefined | unknown[] => {
switch (field.type.typeEnum) {
case Il2Cpp.Type.enum.void: {
return undefined;
}
Function checkForNewerSave
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export const checkForNewerSave = async (
config: IConfig,
{ saveVersion }: ICheckForNewerSaveParameters,
logger: ILogger = debug
): Promise<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 preHandler
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const preHandler = async function (request: Request, reply: Reply): Promise<void> {
request.log.debug({ req: request }, "preHandler hook fired");
// Parse query params
const hash = request.query.hash;
Function downloadSave
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const downloadSave = async (config: IConfig, logger: ILogger = debug): Promise<DecompressedSave> => {
// Setup logging
const passLogger = logger === debug ? undefined : logger;
logger.info("Starting download of current cloud save data...");
Function useStrategy
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const useStrategy = (): FiniteStateMachine<TinyTowerRebuildAsapStrategyStates, ITinyTowerRebuildEventData> => {
/**
* Rebuild after 50 floors so we get a golden ticket every time. There is no
* reason that this can't be a function that takes in the above event data
* and makes a decision using more data, but for this example this will do.
Function dropChannel
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const dropChannel = (
sourceImage: Image,
dropChannel: number,
newFormat?: ImageType
): { modifiedSourceImage: Image; droppedChannelImage: Image } => {
Function retrieveData
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public retrieveData() {
// Extract the version of the game
const version = this.dependencies.AppUtilClass.method<Il2Cpp.String>("VersionString").invoke().content;
// Extract some constants about accessories (maybe move these to costume structs?)