wescopeland/retroachievements-js

View on GitHub

Showing 7 of 12 total issues

File retro-achievements-client.ts has 442 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import urlcat from 'urlcat';
import fetch from 'isomorphic-unfetch';
import camelcaseKeys from 'camelcase-keys';

import * as fromModels from './models';
Severity: Minor
Found in src/retro-achievements-client.ts - About 6 hrs to fix

    RetroAchievementsClient has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export class RetroAchievementsClient {
      private baseUrl = 'https://retroachievements.org/API';
      private apiKey: string;
      private userName: string;
    
    
    Severity: Minor
    Found in src/retro-achievements-client.ts - About 2 hrs to fix

      Function getUserProgressForGameId has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async getUserProgressForGameId(
          userName: string,
          gameId: number
        ): Promise<fromModels.GameInfoAndUserProgress> {
          const requestUrl = urlcat(
      Severity: Minor
      Found in src/retro-achievements-client.ts - About 1 hr to fix

        Function getUserSummary has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async getUserSummary(userName: string): Promise<fromModels.UserSummary> {
            const requestUrl = urlcat(this.baseUrl, 'API_GetUserSummary.php', {
              ...this.buildAuthParameters(),
              u: userName,
              g: 0,
        Severity: Minor
        Found in src/retro-achievements-client.ts - About 1 hr to fix

          Function getExtendedGameInfoByGameId has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async getExtendedGameInfoByGameId(
              gameId: number
            ): Promise<fromModels.GameInfoExtended> {
              const requestUrl = urlcat(this.baseUrl, 'API_GetGameExtended.php', {
                ...this.buildAuthParameters(),
          Severity: Minor
          Found in src/retro-achievements-client.ts - About 1 hr to fix

            Function getUserProgressForGames has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async getUserProgressForGames(
                userName: string,
                gameIds: number[]
              ): Promise<fromModels.UserProgressForGame[]> {
                const requestUrl = urlcat(this.baseUrl, 'API_GetUserProgress.php', {
            Severity: Minor
            Found in src/retro-achievements-client.ts - About 1 hr to fix

              Function getExtendedGameInfoByGameId has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                async getExtendedGameInfoByGameId(
                  gameId: number
                ): Promise<fromModels.GameInfoExtended> {
                  const requestUrl = urlcat(this.baseUrl, 'API_GetGameExtended.php', {
                    ...this.buildAuthParameters(),
              Severity: Minor
              Found in src/retro-achievements-client.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