f-hj/slsk-client

View on GitHub

Showing 29 of 29 total issues

Function constructor has 149 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  constructor (serverAddress, cb) {
    super()
    this.conn = net.createConnection(serverAddress, cb)

    let msgs = new Messages()
Severity: Major
Found in lib/server.js - About 5 hrs to fix

    Function constructor has 111 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      constructor (socket, peer) {
        super(socket, peer)
    
        this.conn.on('connect', () => {
          if (peer.token) {
    Severity: Major
    Found in lib/peer/default-peer.js - About 4 hrs to fix

      Function exports has 78 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = (host, port, token, user, noPierce) => {
        debug(`downloadPeerFile ${user}`)
        let conn = net.createConnection({
          host,
          port
      Severity: Major
      Found in lib/peer/download-peer-file.js - About 3 hrs to fix

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

          write32 (val) {
            let b = Buffer.alloc(4)
            b.writeUInt32LE(val, 0)
            this.data = Buffer.concat([this.data, b])
            this.pointer += 4
        Severity: Major
        Found in lib/message.js and 1 other location - About 2 hrs to fix
        lib/message.js on lines 33..39

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

        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

          write8 (val) {
            let b = Buffer.alloc(1)
            b.writeUInt8(val, 0)
            this.data = Buffer.concat([this.data, b])
            this.pointer += 1
        Severity: Major
        Found in lib/message.js and 1 other location - About 2 hrs to fix
        lib/message.js on lines 40..46

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

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

          constructor (port) {
            super()
            this.port = port
        
            this.server = net.createServer((c) => {
        Severity: Minor
        Found in lib/listen.js - About 1 hr to fix

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

            constructor (socket, peer) {
              super(socket, peer)
          
              this.conn.on('connect', () => {
                if (peer.token) {
          Severity: Minor
          Found in lib/peer/distributed-peer.js - About 1 hr to fix

            Function connectToPeer has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              connectToPeer (peer) {
                debug(`connectToPeer ${peer.user} ${peer.host} ${peer.port} ${peer.token} ${peer.type}`)
            
                switch (peer.type) {
                  case 'F': {
            Severity: Minor
            Found in lib/slsk-client.js - About 1 hr to fix

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

                  this.server = net.createServer((c) => {
                    let user
              
                    let msgs = new Messages()
                    c.on('data', chunk => {
              Severity: Minor
              Found in lib/listen.js - About 1 hr to fix

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

                  transferRequest (file, token) {
                    debug(`Transfer request ${file}`)
                    this.conn.write(MessageFactory
                      .to.peer
                      .transferRequest(file, token)
                Severity: Major
                Found in lib/peer/peer.js and 1 other location - About 1 hr to fix
                lib/server.js on lines 174..180

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

                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

                  fileSearch (query, token) {
                    debug(`send FileSearch: ${query}`)
                    this.conn.write(MessageFactory
                      .to.server
                      .fileSearch(query, token)
                Severity: Major
                Found in lib/server.js and 1 other location - About 1 hr to fix
                lib/peer/peer.js on lines 22..28

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

                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

                  getPeerAddress (username) {
                    debug(`send GetPeerAddress ${username}`)
                    this.conn.write(MessageFactory
                      .to.server
                      .getPeerAddress(username)
                Severity: Major
                Found in lib/server.js and 1 other location - About 1 hr to fix
                lib/server.js on lines 182..188

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

                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

                  setWaitPort (port) {
                    debug(`send SetWaitPort ${port}`)
                    this.conn.write(MessageFactory
                      .to.server
                      .setWaitPort(port)
                Severity: Major
                Found in lib/server.js and 1 other location - About 1 hr to fix
                lib/server.js on lines 190..196

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

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

                      fileSearchResult: (buffer) => {
                        let msg = new Message(buffer)
                        let user = msg.str()
                        let currentToken = msg.rawHexStr(4)
                        let nbFiles = msg.int32()
                Severity: Minor
                Found in lib/message-factory.js - About 1 hr to fix

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

                          case 83: {
                            let number = msg.int32()
                            debug(`ParentMinSpeed is ${number}. msg length: ${msg.data.length}`)
                            break
                          }
                  Severity: Major
                  Found in lib/server.js and 3 other locations - About 45 mins to fix
                  lib/server.js on lines 115..119
                  lib/server.js on lines 125..129
                  lib/server.js on lines 150..154

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

                  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 4 locations. Consider refactoring.
                  Open

                          case 69: {
                            let number = msg.int32()
                            debug(`there are ${number} PrivilegedUsers. msg length: ${msg.data.length}`)
                            break
                          }
                  Severity: Major
                  Found in lib/server.js and 3 other locations - About 45 mins to fix
                  lib/server.js on lines 120..124
                  lib/server.js on lines 125..129
                  lib/server.js on lines 150..154

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

                  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 4 locations. Consider refactoring.
                  Open

                          case 84: {
                            let number = msg.int32()
                            debug(`ParentSpeedRatio is ${number}. msg length: ${msg.data.length}`)
                            break
                          }
                  Severity: Major
                  Found in lib/server.js and 3 other locations - About 45 mins to fix
                  lib/server.js on lines 115..119
                  lib/server.js on lines 120..124
                  lib/server.js on lines 150..154

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

                  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 4 locations. Consider refactoring.
                  Open

                          case 104: {
                            let number = msg.int32()
                            debug(`Whishlist interval is ${number}. msg length: ${msg.data.length}`)
                            break
                          }
                  Severity: Major
                  Found in lib/server.js and 3 other locations - About 45 mins to fix
                  lib/server.js on lines 115..119
                  lib/server.js on lines 120..124
                  lib/server.js on lines 125..129

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

                  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

                            let host = ip[3] + '.' + ip[2] + '.' + ip[1] + '.' + ip[0]
                  Severity: Minor
                  Found in lib/server.js and 2 other locations - About 35 mins to fix
                  lib/server.js on lines 85..85
                  lib/server.js on lines 139..139

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

                  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

                              let host = ip[3] + '.' + ip[2] + '.' + ip[1] + '.' + ip[0]
                  Severity: Minor
                  Found in lib/server.js and 2 other locations - About 35 mins to fix
                  lib/server.js on lines 67..67
                  lib/server.js on lines 85..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 47.

                  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