dalexhd/SteamSpeak

View on GitHub

Showing 51 of 107 total issues

Function checkDescriptionBanner has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

const checkDescriptionBanner = async (
    client: TeamSpeakClient | undefined,
    presenceString: string | undefined,
    data: SteamUser.PersonaData,
    steamId: string
Severity: Minor
Found in packages/server/src/core/Steam/modules/richPresence.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 authenticate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

export const authenticate = async function (
    req: Request,
    res: Response,
    next: NextFunction
): Promise<any> {
Severity: Minor
Found in packages/server/src/core/Website/api/middlewares/authentication.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

Consider simplifying this complex logical expression.
Open

    if (
        data.diff?.game_played_app_id?.to === info.appId ||
        (data.diff?.rich_presence?.from.find((e) => e.key === 'game:state')?.value === 'game' &&
            data.diff?.rich_presence?.to.find((e) => e.key === 'game:state')?.value === 'lobby' &&
            data.diff?.rich_presence?.from.find((e) => e.key === 'game:mode')?.value === 'competitive' &&
Severity: Major
Found in packages/server/src/core/Steam/games/csgo.ts - About 40 mins to fix

    Avoid too many return statements within this function.
    Open

                    return lang.steam.status.Playing;
    Severity: Major
    Found in packages/server/src/utils/steam/components/friends.ts - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return undefined;
      Severity: Major
      Found in packages/server/src/utils/steam/components/friends.ts - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return `${lang.steam.status.Playing} ${lang.message.to} ${app.appinfo.common.name}`;
        Severity: Major
        Found in packages/server/src/utils/steam/components/friends.ts - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return `${lang.steam.status.Playing} ${lang.message.to} ${steamData.game_name}`;
          Severity: Major
          Found in packages/server/src/utils/steam/components/friends.ts - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return 'xs';
            Severity: Major
            Found in packages/client/src/store/getters.js - About 30 mins to fix

              Method continuize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def continuize
                  i = 0
              
                  loop do
                    if i > self.length
              Severity: Minor
              Found in scripts/util/core_ext/string.rb - 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

              Method components has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def components
                  return @components if defined?(@components)
              
                  @components =
                    if new_feature?
              Severity: Minor
              Found in scripts/util/metadata/commit.rb - 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

              Method bump_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                def bump_type(other_version)
                  # Return nil if the other version is not greater than the current version
                  if other_version <= self
                    return nil
                  end
              Severity: Minor
              Found in scripts/util/version.rb - 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