dalexhd/SteamSpeak

View on GitHub

Showing 51 of 107 total issues

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

    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

              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

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

                    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

                          Function main has 26 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 replacements = {
                                  '[SERVER_ONLINE]': data.showQueryClients

                            Function drawTextWithEmoji has 7 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                fillType: string,
                                text: string,
                                x: number,
                                y: number,
                                maxWidth?: number,
                            Severity: Major
                            Found in packages/server/src/utils/canvas/custom.ts - About 50 mins to fix

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

                                  vsfunction(json) {
                                      for (const clave in json) {
                                          if (Object.prototype.hasOwnProperty.call(json, clave)) {
                                              let colorx;
                                              if (/^[rgb(]/g.test(json[clave])) {
                              Severity: Minor
                              Found in packages/client/src/assets/utils/theme.js - 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

                              Method component has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def component
                                  return @component if defined?(@component)
                              
                                  component_name = name.split(" ").first
                              
                              
                              Severity: Minor
                              Found in scripts/util/metadata/commit_scope.rb - 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 drawTextWithEmoji has a Cognitive Complexity of 8 (exceeds 5 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 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

                              Severity
                              Category
                              Status
                              Source
                              Language