Showing 7 of 12 total issues
File retro-achievements-client.ts
has 442 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import urlcat from 'urlcat';
import fetch from 'isomorphic-unfetch';
import camelcaseKeys from 'camelcase-keys';
import * as fromModels from './models';
RetroAchievementsClient
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class RetroAchievementsClient {
private baseUrl = 'https://retroachievements.org/API';
private apiKey: string;
private userName: string;
Function getUserProgressForGameId
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getUserProgressForGameId(
userName: string,
gameId: number
): Promise<fromModels.GameInfoAndUserProgress> {
const requestUrl = urlcat(
Function getUserSummary
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getUserSummary(userName: string): Promise<fromModels.UserSummary> {
const requestUrl = urlcat(this.baseUrl, 'API_GetUserSummary.php', {
...this.buildAuthParameters(),
u: userName,
g: 0,
Function getExtendedGameInfoByGameId
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getExtendedGameInfoByGameId(
gameId: number
): Promise<fromModels.GameInfoExtended> {
const requestUrl = urlcat(this.baseUrl, 'API_GetGameExtended.php', {
...this.buildAuthParameters(),
Function getUserProgressForGames
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
async getUserProgressForGames(
userName: string,
gameIds: number[]
): Promise<fromModels.UserProgressForGame[]> {
const requestUrl = urlcat(this.baseUrl, 'API_GetUserProgress.php', {
Function getExtendedGameInfoByGameId
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
async getExtendedGameInfoByGameId(
gameId: number
): Promise<fromModels.GameInfoExtended> {
const requestUrl = urlcat(this.baseUrl, 'API_GetGameExtended.php', {
...this.buildAuthParameters(),
- 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"