dalexhd/SteamSpeak

View on GitHub

Showing 97 of 107 total issues

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

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

    export const load = async function (): Promise<void> {
        const { interval } = info.config;
        main();
        loaded = setInterval(async () => {
            main();
    packages/server/src/core/TeamSpeak/plugins/first-instance/host_message.ts on lines 38..44
    packages/server/src/core/TeamSpeak/plugins/second-instance/server_name.ts on lines 42..48

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 75.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

    export const load = async function (): Promise<void> {
        const { interval } = info.config;
        main();
        loaded = setInterval(async () => {
            main();
    packages/server/src/core/TeamSpeak/plugins/first-instance/host_message.ts on lines 38..44
    packages/server/src/core/TeamSpeak/plugins/first-instance/multi_function.ts on lines 35..41

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 75.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 3 locations. Consider refactoring.
    Open

    export const load = async function (): Promise<void> {
        const { interval } = info.config;
        main();
        loaded = setInterval(async () => {
            main();
    packages/server/src/core/TeamSpeak/plugins/first-instance/multi_function.ts on lines 35..41
    packages/server/src/core/TeamSpeak/plugins/second-instance/server_name.ts on lines 42..48

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 75.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            export const load = async function (): Promise<void> {
                const { interval } = info.config;
                loaded = setInterval(async () => {
                    main();
                }, convertToMilliseconds(interval));
            packages/server/src/core/TeamSpeak/plugins/second-instance/afk_move.ts on lines 42..47

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 69.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

            export const load = async function (): Promise<void> {
                const { interval } = info.config;
                loaded = setInterval(async () => {
                    main();
                }, convertToMilliseconds(interval));
            packages/server/src/core/TeamSpeak/plugins/second-instance/afk_kick.ts on lines 22..27

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 69.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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

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

                        install(Vue) {
                            if (process.env.NODE_ENV === 'production') {
                                register(`${process.env.BASE_URL}service-worker.js`, {
                                    ready() {
                                        console.log(
                    Severity: Minor
                    Found in packages/client/src/registerServiceWorker.js - About 1 hr to fix

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                      export const clientconnect = async function (ev: ClientConnectEvent): Promise<void> {
                          const { client } = ev;
                          if (client.type === 0) {
                              main();
                          }
                      packages/server/src/core/TeamSpeak/plugins/first-instance/host_message.ts on lines 46..51

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 66.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                      export const clientdisconnect = async function (ev: ClientDisconnectEvent): Promise<void> {
                          const { client } = ev;
                          if (client?.type === 0) {
                              main();
                          }
                      packages/server/src/core/TeamSpeak/plugins/first-instance/host_message.ts on lines 53..58

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 66.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                      export const clientdisconnect = async function (ev: ClientDisconnectEvent): Promise<void> {
                          const { client } = ev;
                          if (client?.type === 0) {
                              main();
                          }
                      packages/server/src/core/TeamSpeak/plugins/second-instance/server_name.ts on lines 57..62

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 66.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Identical blocks of code found in 2 locations. Consider refactoring.
                      Open

                      export const clientconnect = async function (ev: ClientConnectEvent): Promise<void> {
                          const { client } = ev;
                          if (client.type === 0) {
                              main();
                          }
                      packages/server/src/core/TeamSpeak/plugins/second-instance/server_name.ts on lines 50..55

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 66.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      Severity
                      Category
                      Status
                      Source
                      Language