achievement-watcher/celes

View on GitHub

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 {
Severity: Minor
Found in src/lib/utils/merger.ts - About 1 hr to fix

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 {
Severity: Minor
Found in src/lib/plugins/utils/SteamEmulatorScraper.ts - About 1 hr to fix

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);
Severity: Minor
Found in src/lib/utils/CelesDbConnector.ts - About 55 mins to fix

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) {
Severity: Minor
Found in src/lib/utils/merger.ts - About 55 mins to fix

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[] = [];
Severity: Minor
Found in src/lib/plugins/utils/SteamEmulatorScraper.ts - About 45 mins to fix

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 {
Severity: Minor
Found in src/lib/utils/generator.ts - About 35 mins to fix

    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 {
    Severity: Minor
    Found in src/lib/utils/generator.ts - About 35 mins to fix

      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> {
      Severity: Minor
      Found in src/lib/utils/gameDataUtils.ts - About 35 mins to fix

        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) {
        Severity: Minor
        Found in src/lib/utils/merger.ts - About 35 mins to fix

        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) {
        Severity: Minor
        Found in src/lib/utils/merger.ts - About 35 mins to fix

        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');
        Severity: Minor
        Found in src/lib/plugins/SSE.ts - About 25 mins to fix

        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 = {
        Severity: Minor
        Found in src/lib/plugins/Steam.ts - About 25 mins to fix

        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 */
        Severity: Minor
        Found in src/lib/plugins/GreenLuma.ts - About 25 mins to fix

        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

        Severity
        Category
        Status
        Source
        Language