dalexhd/SteamSpeak

View on GitHub

Showing 97 of 107 total issues

Function checkDescriptionBanner has 36 lines of code (exceeds 25 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 1 hr to fix

    Function send has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export const send = async function (req: Request, res: Response): Promise<any> {
        log.info(`Received verification send request to ${req.body.dbid} from remote.`, {
            type: 'website'
        });
        try {
    Severity: Minor
    Found in packages/server/src/core/Website/api/controllers/verify.ts - About 1 hr to fix

      Method to_toml has 35 lines of code (exceeds 25 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 1 hr to fix

        Function send has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function login has 33 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 [client] = await findClients(
                      req,
          Severity: Minor
          Found in packages/server/src/core/Website/api/controllers/auth.ts - About 1 hr to fix

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

            const {
                Offline,
                Online,
                Busy,
                Away,
            Severity: Major
            Found in packages/server/src/locales/en/steam/status.ts and 1 other location - About 1 hr to fix
            packages/server/src/locales/es/steam/status.ts on lines 1..11

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

            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

            const {
                Offline,
                Online,
                Busy,
                Away,
            Severity: Major
            Found in packages/server/src/locales/es/steam/status.ts and 1 other location - About 1 hr to fix
            packages/server/src/locales/en/steam/status.ts on lines 1..11

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

            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 getColor has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

                getColor(colorx, alphax = 1, defaultx = true) {
                    // change color hex to RGB
                    if (/^[#]/.test(colorx)) {
                        const c = this.hexToRgb(colorx);
            
            
            Severity: Minor
            Found in packages/client/src/assets/utils/color.js - 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 create_release_meta_file! has a Cognitive Complexity of 11 (exceeds 5 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

            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

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

                            try {
                                delete require.cache[require.resolve(path.resolve(file))];
                                // 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 hr to fix
            packages/server/src/utils/steam/components/custom.ts on lines 76..103

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

            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

                            try {
                                delete require.cache[require.resolve(path.resolve(file))];
                                // 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 hr to fix
            packages/server/src/utils/teamspeak/node/custom.ts on lines 108..136

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

            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 main has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const main = async function (): Promise<void> {
                const { data } = info.config;
                const serverInfo = await Ts3.serverInfo();
                const edited_name = {
                    '[ONLINE]': data.showQueryClients

              Method parse_commit_message! has 30 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def parse_commit_message!(message)
                    match = message.match(/^(?<type>[a-z]*)(\((?<scope>[a-z0-9_,\- ]*)\))?(?<breaking_change>!)?: (?<description>.*?)( \(#(?<pr_number>[0-9]*)\))?$/)
              
                    if match.nil?
                      raise <<~EOF
              Severity: Minor
              Found in scripts/util/metadata/commit.rb - About 1 hr to fix

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

                export const main = async function (): Promise<void> {
                    const { data } = info.config;
                    const clients = await Ts3.clientList({ clientType: 0 });
                    clients.forEach(async (client) => {
                        if (client.isAfk(data.minTime) && client.cid !== data.dest) {

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

                          schema
                              .validateAsync(plugin)
                              .then((result) => {
                                  resolve(result.value);
                              })
                  Severity: Major
                  Found in packages/server/src/utils/files.ts and 1 other location - About 1 hr to fix
                  packages/server/src/utils/files.ts on lines 78..85

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

                  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

                          schema
                              .validateAsync(game)
                              .then((result) => {
                                  resolve(result.value);
                              })
                  Severity: Major
                  Found in packages/server/src/utils/files.ts and 1 other location - About 1 hr to fix
                  packages/server/src/utils/files.ts on lines 51..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 57.

                  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 rColor has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                      rColor(colorx, opacity = 1) {
                          if (/^[#]/.test(colorx)) {
                              const c = this.hexToRgb(colorx);
                              colorx = `rgba(${c.r},${c.g},${c.b},${opacity})`;
                          } else if (/^[rgb]/.test(colorx)) {
                  Severity: Minor
                  Found in packages/client/src/assets/utils/color.js - 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

                  Function loadGames has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  SteamUser.prototype.loadGames = async function (): Promise<void> {
                      getFiles(path.join(__dirname, '../../../core/Steam/games')).then((files) => {
                          const jsfiles = flattenArray(files).filter((f) => f.split('.').pop() === 'ts');
                          jsfiles.forEach((file) => {
                              try {
                  Severity: Minor
                  Found in packages/server/src/utils/steam/components/custom.ts - About 1 hr to fix

                    Function drawTextWithEmoji has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    Canvas.CanvasRenderingContext2D.prototype.drawTextWithEmoji = async function (
                        fillType: string,
                        text: string,
                        x: number,
                        y: number,
                    Severity: Minor
                    Found in packages/server/src/utils/canvas/custom.ts - About 1 hr to fix

                      Function changePosition has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          changePosition(elx, content, conditional) {
                              let topx = 0;
                              let leftx = 0;
                              let widthx = 0;
                              const scrollTopx = window.pageYOffset || document.documentElement.scrollTop;
                      Severity: Minor
                      Found in packages/client/src/assets/utils/index.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language