dalexhd/SteamSpeak

View on GitHub

Showing 97 of 107 total issues

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

        jsfiles.forEach((file) => {
            try {
                // eslint-disable-next-line @typescript-eslint/no-var-requires
                const plugin = require(path.resolve(file));
                validatePlugin(plugin.info)
Severity: Major
Found in packages/server/src/utils/teamspeak/node/custom.ts and 1 other location - About 1 day to fix
packages/server/src/utils/steam/components/custom.ts on lines 16..40

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 294.

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

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

        jsfiles.forEach((file) => {
            try {
                // eslint-disable-next-line @typescript-eslint/no-var-requires
                const game = require(path.resolve(file));
                validateGame(game.info)
Severity: Major
Found in packages/server/src/utils/steam/components/custom.ts and 1 other location - About 1 day to fix
packages/server/src/utils/teamspeak/node/custom.ts on lines 45..69

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 294.

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 default {
    '#DISPLAY_PUBLIC': '{#STATUS_%status_visibility%}{#DETAIL_INFO}{#ELAPSED_%elapsed_visibility%}',
    '#DISPLAY_CUSTOM':
        '{#STATUS_%status_visibility%}{#MODE_%mode_name%} {#MODE}{#ELAPSED_%elapsed_visibility%}',
    '#DISPLAY_CUSTOM_TRAINING': '{#MODE_%mode_name%} {#MODE}{#ELAPSED_%elapsed_visibility%}',
Severity: Major
Found in packages/server/src/locales/en/steam/tokens/578080.ts and 1 other location - About 1 day to fix
packages/server/src/locales/es/steam/tokens/578080.ts on lines 1..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 239.

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 default {
    '#DISPLAY_PUBLIC': '{#STATUS_%status_visibility%}{#DETAIL_INFO}{#ELAPSED_%elapsed_visibility%}',
    '#DISPLAY_CUSTOM':
        '{#STATUS_%status_visibility%}{#MODE_%mode_name%} {#MODE}{#ELAPSED_%elapsed_visibility%}',
    '#DISPLAY_CUSTOM_TRAINING': '{#MODE_%mode_name%} {#MODE}{#ELAPSED_%elapsed_visibility%}',
Severity: Major
Found in packages/server/src/locales/es/steam/tokens/578080.ts and 1 other location - About 1 day to fix
packages/server/src/locales/en/steam/tokens/578080.ts on lines 1..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 239.

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 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

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

        const edited_name = {
            '[ONLINE]': data.showQueryClients
                ? serverInfo.virtualserverClientsonline
                : serverInfo.virtualserverClientsonline - serverInfo.virtualserverQueryclientsonline,
            '[MAX_CLIENTS]': serverInfo.virtualserverMaxclients,
    packages/server/src/core/TeamSpeak/plugins/first-instance/host_message.ts on lines 12..25

    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 119.

    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

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

        const replacements = {
            '[SERVER_ONLINE]': data.showQueryClients
                ? serverInfo.virtualserverClientsonline
                : serverInfo.virtualserverClientsonline - serverInfo.virtualserverQueryclientsonline,
            '[SERVER_MAX_CLIENTS]': serverInfo.virtualserverMaxclients,
    packages/server/src/core/TeamSpeak/plugins/second-instance/server_name.ts on lines 12..25

    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 119.

    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 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

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

        export default {
            730: 'CS:GO',
            227300: 'ETS2',
            252490: 'Rust',
            270880: 'ATS',
        Severity: Major
        Found in packages/server/src/locales/es/steam/games.ts and 1 other location - About 2 hrs to fix
        packages/server/src/locales/en/steam/games.ts on lines 1..19

        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 89.

        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 default {
            730: 'CS:GO',
            227300: 'ETS2',
            252490: 'Rust',
            270880: 'ATS',
        Severity: Major
        Found in packages/server/src/locales/en/steam/games.ts and 1 other location - About 2 hrs to fix
        packages/server/src/locales/es/steam/games.ts on lines 1..19

        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 89.

        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

        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

        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 === 1) {
                Cache.del(`afkChecker:${client.databaseId}`);
            }
        packages/server/src/core/TeamSpeak/plugins/second-instance/afk_move.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 84.

        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 === 1) {
                Cache.del(`afkChecker:${client.databaseId}`);
            }
        packages/server/src/core/TeamSpeak/plugins/second-instance/afk_kick.ts on lines 33..38

        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 84.

        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

        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

              Severity
              Category
              Status
              Source
              Language