dalexhd/SteamSpeak

View on GitHub

Showing 51 of 107 total issues

Function getPresenceString has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
Open

SteamUser.prototype.getPresenceString = async function (
    steamData: SteamUser.PersonaData,
    groupNumber: number
): Promise<string | undefined> {
    if (steamData.rich_presence.length > 0) {
Severity: Minor
Found in packages/server/src/utils/steam/components/friends.ts - About 6 hrs 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

File tailwind.config.js has 355 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable */
/*

Tailwind - The Utility-First CSS Framework

Severity: Minor
Found in packages/client/tailwind.config.js - About 4 hrs to fix

    Function getPresenceString has 83 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    SteamUser.prototype.getPresenceString = async function (
        steamData: SteamUser.PersonaData,
        groupNumber: number
    ): Promise<string | undefined> {
        if (steamData.rich_presence.length > 0) {
    Severity: Major
    Found in packages/server/src/utils/steam/components/friends.ts - About 3 hrs to fix

      Class Release has 26 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Release
        include Comparable
      
        attr_reader :codename,
          :commits,
      Severity: Minor
      Found in scripts/util/metadata/release.rb - About 3 hrs to fix

        Method to_toml has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

          def to_toml(hash_style: :expanded)
            if is_a?(Hash)
              values =
                (hash_style == :flatten ? flatten : self).
                  select { |_k, v| !v.nil? }.
        Severity: Minor
        Found in scripts/util/core_ext/object.rb - About 2 hrs 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 get_new_version has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_new_version(last_version, commits)
          next_version =
            if commits.any? { |c| breaking_change?(c) }
              next_version = "#{last_version.major + 1}.0.0"
        
        
        Severity: Minor
        Found in scripts/release-prepare.rb - About 2 hrs 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

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

        export default {
            name: 'easing',
            // no easing, no acceleration
            linear(t, b, c, d) {
                return (c * t) / d + b;
        Severity: Minor
        Found in packages/client/src/assets/utils/easing.js - About 2 hrs to fix

          Method initialize has 56 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def initialize(release_hash, last_version)
              @codename = release_hash["codename"] || ""
              @description = release_hash["description"] || ""
              @date = release_hash.fetch("date").to_date
              @last_version = last_version
          Severity: Major
          Found in scripts/util/metadata/release.rb - About 2 hrs to fix

            Function syncNumbers has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const syncNumbers = async (): Promise<void> => {
                const connectedClients = await Ts3.clientList({
                    clientType: 0
                });
            
            
            Severity: Major
            Found in packages/server/src/core/Steam/modules/richPresence.ts - About 2 hrs to fix

              Method initialize has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
              Open

                def initialize(release_hash, last_version)
                  @codename = release_hash["codename"] || ""
                  @description = release_hash["description"] || ""
                  @date = release_hash.fetch("date").to_date
                  @last_version = last_version
              Severity: Minor
              Found in scripts/util/metadata/release.rb - About 2 hrs 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 checkServerGroup has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              const checkServerGroup = async (
                  user: VerifiedClientDocument,
                  presenceString: string | undefined,
                  data: SteamUser.PersonaData,
                  client: TeamSpeakClient | undefined
              Severity: Major
              Found in packages/server/src/core/Steam/modules/richPresence.ts - About 2 hrs to fix

                Function loadPlugins has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                TeamSpeak.prototype.loadPlugins = async function (): Promise<void> {
                    getFiles(path.join(__dirname, `../../../core/TeamSpeak/plugins/${instance}`)).then((files) => {
                        const jsfiles = flattenArray(files).filter((f) => f.split('.').pop() === 'ts');
                        jsfiles.forEach((file) => {
                            try {
                Severity: Minor
                Found in packages/server/src/utils/teamspeak/node/custom.ts - About 1 hr to fix

                  Method to_struct has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def to_struct(should_have_keys: [], &block)
                      new_hash = {}
                  
                      each do |key, val|
                        new_hash[key] =
                  Severity: Minor
                  Found in scripts/util/core_ext/hash.rb - 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

                  Method get_new_version has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  def get_new_version(last_version, commits)
                    next_version =
                      if commits.any? { |c| breaking_change?(c) }
                        next_version = "#{last_version.major + 1}.0.0"
                  
                  
                  Severity: Minor
                  Found in scripts/release-prepare.rb - About 1 hr to fix

                    Function watchPlugins has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    TeamSpeak.prototype.watchPlugins = async function (): Promise<void> {
                        chokidar
                            .watch(path.join(__dirname, `../../../core/TeamSpeak/plugins/${instance}`), {
                                ignoreInitial: true
                            })
                    Severity: Minor
                    Found in packages/server/src/utils/teamspeak/node/custom.ts - About 1 hr to fix

                      Method create_release_meta_file! has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      def create_release_meta_file!(current_commits, new_version)
                        release_meta_path = "#{RELEASE_META_DIR}/#{new_version}.toml"
                      
                        # Grab all existing commits
                        existing_commits = get_existing_commits!
                      Severity: Minor
                      Found in scripts/release-prepare.rb - About 1 hr to fix

                        Function watchGames has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        SteamUser.prototype.watchGames = function (): void {
                            chokidar
                                .watch(path.join(__dirname, '../../../core/Steam/games'), { ignoreInitial: true })
                                .on('all', (event, file) => {
                                    const fileName = path.basename(file);
                        Severity: Minor
                        Found in packages/server/src/utils/steam/components/custom.ts - About 1 hr to fix

                          Function clientDescrtiption has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export const clientDescrtiption = async function (req: Request, res: Response): Promise<any> {
                              const canvas = Canvas.createCanvas(800, 250);
                              const ctx = canvas.getContext('2d');
                          
                              request
                          Severity: Minor
                          Found in packages/server/src/core/Website/api/controllers/widget.ts - About 1 hr to fix

                            Function main has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            export const main = async function (
                                data: SteamUser.PersonaData,
                                client: TeamSpeakClient | undefined,
                                user: VerifiedClientDocument
                            ): Promise<void> {
                            Severity: Minor
                            Found in packages/server/src/core/Steam/games/csgo.ts - About 1 hr to fix

                              Function login has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export const login = async function (req: Request, res: Response): Promise<any> {
                                  log.info(`Received login request from ${req.body.dbid}.`, { type: 'website' });
                                  try {
                                      const steamData = await findSecret(req);
                                      const [client] = await findClients(req, {
                              Severity: Minor
                              Found in packages/server/src/core/Website/api/controllers/verify.ts - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language