Binaryify/NeteaseCloudMusicApi

View on GitHub

Showing 286 of 286 total issues

Function AudioFingerprintRuntime has a Cognitive Complexity of 521 (exceeds 5 allowed). Consider refactoring.
Open

let AudioFingerprintRuntime = (() => {
  var n, o = void 0 !== o ? o : {},i = {};
  for (n in o)
      o.hasOwnProperty(n) && (i[n] = o[n]);
  var read_, readAsync, readBinary, c, f, l = [],
Severity: Minor
Found in public/audio_match_demo/afp.js - About 1 wk 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 AudioFingerprintRuntime has 1546 lines of code (exceeds 25 allowed). Consider refactoring.
Open

let AudioFingerprintRuntime = (() => {
  var n, o = void 0 !== o ? o : {},i = {};
  for (n in o)
      o.hasOwnProperty(n) && (i[n] = o[n]);
  var read_, readAsync, readBinary, c, f, l = [],
Severity: Major
Found in public/audio_match_demo/afp.js - About 1 wk to fix

    File afp.js has 1567 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // https://fn.music.163.com/g/chrome-extension-home-page-beta/
    let AudioFingerprintRuntime = (() => {
      var n, o = void 0 !== o ? o : {},i = {};
      for (n in o)
          o.hasOwnProperty(n) && (i[n] = o[n]);
    Severity: Major
    Found in public/audio_match_demo/afp.js - About 4 days to fix

      Function ApiCache has a Cognitive Complexity of 191 (exceeds 5 allowed). Consider refactoring.
      Open

      function ApiCache() {
        var memCache = new MemoryCache()
      
        var globalOptions = {
          debug: false,
      Severity: Minor
      Found in util/apicache.js - About 3 days 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 ApiCache has 576 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function ApiCache() {
        var memCache = new MemoryCache()
      
        var globalOptions = {
          debug: false,
      Severity: Major
      Found in util/apicache.js - About 2 days to fix

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

          const result = await request(
            'post',
            `https://interface.music.163.com/weapi/voice/workbench/voice/batch/upload/v2`,
            {
              dupkey: createDupkey(),
        Severity: Major
        Found in module/voice_upload.js and 1 other location - About 1 day to fix
        module/voice_upload.js on lines 96..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 247.

        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

          await request(
            'post',
            `https://interface.music.163.com/weapi/voice/workbench/voice/batch/upload/preCheck`,
            {
              dupkey: createDupkey(),
        Severity: Major
        Found in module/voice_upload.js and 1 other location - About 1 day to fix
        module/voice_upload.js on lines 130..163

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

        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

        File apicache.js has 608 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        var url = require('url')
        var MemoryCache = require('./memory-cache')
        
        var t = {
          ms: 1,
        Severity: Major
        Found in util/apicache.js - About 1 day to fix

          Function createRequest has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
          Open

          const createRequest = (method, url, data = {}, options) => {
            return new Promise((resolve, reject) => {
              let headers = { 'User-Agent': chooseUserAgent(options.ua) }
              options.headers = options.headers || {}
              headers = {
          Severity: Minor
          Found in util/request.js - About 1 day 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 cache has 193 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            this.middleware = function cache(
              strDuration,
              middlewareToggle,
              localOptions,
            ) {
          Severity: Major
          Found in util/apicache.js - About 7 hrs to fix

            Function createRequest has 176 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const createRequest = (method, url, data = {}, options) => {
              return new Promise((resolve, reject) => {
                let headers = { 'User-Agent': chooseUserAgent(options.ua) }
                options.headers = options.headers || {}
                headers = {
            Severity: Major
            Found in util/request.js - About 7 hrs to fix

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

              module.exports = (query, request) => {
                query.cookie.os = 'ios'
                query.cookie.appver = '8.10.90'
                const data = {
                  id: query.id,
              Severity: Major
              Found in module/send_album.js and 1 other location - About 5 hrs to fix
              module/send_song.js on lines 3..18

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

              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

              module.exports = (query, request) => {
                query.cookie.os = 'ios'
                query.cookie.appver = '8.10.90'
                const data = {
                  id: query.id,
              Severity: Major
              Found in module/send_song.js and 1 other location - About 5 hrs to fix
              module/send_album.js on lines 3..18

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

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

              module.exports = async (query, request) => {
                let ext = 'mp3'
                if (query.songFile.name.indexOf('flac') > -1) {
                  ext = 'flac'
                }
              Severity: Major
              Found in module/voice_upload.js - About 5 hrs to fix

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

                module.exports = (query, request) => {
                  query.cookie.os = 'pc'
                  const data = {
                    rid: query.id,
                    limit: query.limit || 20,
                Severity: Major
                Found in module/comment_dj.js and 5 other locations - About 5 hrs to fix
                module/comment_album.js on lines 3..22
                module/comment_music.js on lines 3..22
                module/comment_mv.js on lines 3..22
                module/comment_playlist.js on lines 3..22
                module/comment_video.js on lines 3..22

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

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

                module.exports = (query, request) => {
                  query.cookie.os = 'pc'
                  const data = {
                    rid: query.id,
                    limit: query.limit || 20,
                Severity: Major
                Found in module/comment_video.js and 5 other locations - About 5 hrs to fix
                module/comment_album.js on lines 3..22
                module/comment_dj.js on lines 3..22
                module/comment_music.js on lines 3..22
                module/comment_mv.js on lines 3..22
                module/comment_playlist.js on lines 3..22

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

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

                module.exports = (query, request) => {
                  query.cookie.os = 'pc'
                  const data = {
                    rid: query.id,
                    limit: query.limit || 20,
                Severity: Major
                Found in module/comment_playlist.js and 5 other locations - About 5 hrs to fix
                module/comment_album.js on lines 3..22
                module/comment_dj.js on lines 3..22
                module/comment_music.js on lines 3..22
                module/comment_mv.js on lines 3..22
                module/comment_video.js on lines 3..22

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

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

                module.exports = (query, request) => {
                  query.cookie.os = 'pc'
                  const data = {
                    rid: query.id,
                    limit: query.limit || 20,
                Severity: Major
                Found in module/comment_mv.js and 5 other locations - About 5 hrs to fix
                module/comment_album.js on lines 3..22
                module/comment_dj.js on lines 3..22
                module/comment_music.js on lines 3..22
                module/comment_playlist.js on lines 3..22
                module/comment_video.js on lines 3..22

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

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

                module.exports = (query, request) => {
                  query.cookie.os = 'pc'
                  const data = {
                    rid: query.id,
                    limit: query.limit || 20,
                Severity: Major
                Found in module/comment_music.js and 5 other locations - About 5 hrs to fix
                module/comment_album.js on lines 3..22
                module/comment_dj.js on lines 3..22
                module/comment_mv.js on lines 3..22
                module/comment_playlist.js on lines 3..22
                module/comment_video.js on lines 3..22

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

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

                module.exports = (query, request) => {
                  query.cookie.os = 'pc'
                  const data = {
                    rid: query.id,
                    limit: query.limit || 20,
                Severity: Major
                Found in module/comment_album.js and 5 other locations - About 5 hrs to fix
                module/comment_dj.js on lines 3..22
                module/comment_music.js on lines 3..22
                module/comment_mv.js on lines 3..22
                module/comment_playlist.js on lines 3..22
                module/comment_video.js on lines 3..22

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

                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