Showing 13 of 19 total issues
Function fixAchievementsColission
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function fixAchievementsColission(ach1: UnlockedOrInProgressAchievement, ach2: UnlockedOrInProgressAchievement,
useOldestUnlockTime: boolean) {
if (ach1.currentProgress > ach2.currentProgress) {
return ach1;
} else {
- 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 getAchievementListFromGameFolder
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
private async getAchievementListFromGameFolder(gameFolder: string): Promise<unknown> {
let achievementList: unknown = {};
for (const file of this.achievementLocationFiles) {
try {
- 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 getAll
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
async getAll(schemaLanguage: string, callbackProgress?: (progress:number) => void, maxProgress = 100, baseProgress = 0): Promise<GameData[]> {
const gameDataCollection: GameData[] = [];
try {
const localDatabasePlatforms: Platform[] = <Platform[]> await fs.readdir(this.celesDatabasePath);
- 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 fixGameDataCollectionStatsCollision
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function fixGameDataCollectionStatsCollision(gameDataCollection: GameData[], useOldestUnlockTime: boolean): GameStatsBody {
const mergedSourceStats: { [key: string]: SourceStats } = {};
let maxPlaytime = 0;
for (const gameData of gameDataCollection) {
- 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 scan
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async scan(additionalFoldersToScan: string[]): Promise<ScanResult[]> {
const specificFoldersToScan: string[] = this.getSpecificFoldersToScan();
const foldersToScan: string[] = await this.getFoldersToScan(specificFoldersToScan, additionalFoldersToScan);
const gamesMetadata: ScanResult[] = [];
- 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 generateScrapError
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function generateScrapError(error: Error, pluginName?: string, platform?: Platform, source?: Source,
appId?: string): ScrapError {
Function generateActiveAchievement
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function generateActiveAchievement(name: string, unlockTime = 0, achieved: 1 | 0 = 1, currentProgress = 0,
maxProgress = 0): UnlockedOrInProgressAchievement {
Function generateManualGame
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export async function generateManualGame(achievementWatcherRootPath: string, appId: string, platform: Platform,
apiVersion: string, systemLanguage: string): Promise<GameData> {
Function mergeActiveAchievements
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function mergeActiveAchievements(activeAchievementsCollection: UnlockedOrInProgressAchievement[][],
useOldestUnlockTime: boolean): UnlockedOrInProgressAchievement[] {
const mergedActiveAchievements: { [key: string]: UnlockedOrInProgressAchievement } = {};
for (const activeAchievements of activeAchievementsCollection) {
- 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 mergeGameDataCollections
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function mergeGameDataCollections(gameDataCollections: GameData[][], useOldestUnlockTime = true): GameData[] {
const mergedGameDataCollection: {[key: string]: GameData} = {};
for (const gameDataCollection of gameDataCollections) {
for (const gameData of gameDataCollection) {
- 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 getUnlockedOrInProgressAchievements
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async getUnlockedOrInProgressAchievements(game: ScanResult): Promise<UnlockedOrInProgressAchievement[]> {
const wronglyNormalizedAchievementList: UnlockedOrInProgressAchievement[] = await super.getUnlockedOrInProgressAchievements(game);
const correctlyNormalizedAchievementList: UnlockedOrInProgressAchievement[] = [];
const gameSchema: GameSchema = await getSteamGameSchema(this.achievementWatcherRootPath, game.appId, 'english');
- 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 getUnlockedOrInProgressAchievements
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async getUnlockedOrInProgressAchievements(game: ScanResult): Promise<UnlockedOrInProgressAchievement[]> {
const steamUser: string = (<SteamUser>game.data.userId).user;
let activeAchievements: UnlockedOrInProgressAchievement[] = [];
const cachePaths = {
- 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 scanRegistrySubkeys
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private async scanRegistrySubkeys(root: string, key: string): Promise<ScanResult[]> {
const scanResults: ScanResult[] = [];
const subkeys = await regedit.promises.RegListAllSubkeys(root, key);
/* istanbul ignore else */
- 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"