Binaryify/NeteaseCloudMusicApi

View on GitHub

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

        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

              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

                Function exports has 121 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/cloud.js - About 4 hrs to fix

                  Function consturctServer has 106 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  async function consturctServer(moduleDefs) {
                    const app = express()
                    const { CORS_ALLOW_ORIGIN } = process.env
                    app.set('trust proxy', true)
                  
                  
                  Severity: Major
                  Found in server.js - About 4 hrs to fix

                    Function cache has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        var cache = function (req, res, next) {
                          function bypass() {
                            debug('bypass detected, skipping cache.')
                            return next()
                          }
                    Severity: Major
                    Found in util/apicache.js - About 3 hrs to fix

                      Function ke has 77 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            ke = (function() {
                                    var import_table = {
                                        a: import_table_impl
                                    };
                      
                      
                      Severity: Major
                      Found in public/audio_match_demo/afp.js - About 3 hrs to fix

                        Function clear has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          this.clear = function (target, isAutomatic) {
                            var group = index.groups[target]
                            var redis = globalOptions.redisClient
                        
                            if (group) {
                        Severity: Major
                        Found in util/apicache.js - About 2 hrs to fix

                          Function CachePerformance has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function CachePerformance() {
                                /**
                                 * Tracks the hit rate for the last 100 requests.
                                 * If there have been fewer than 100 requests, the hit rate just considers the requests that have happened.
                                 */
                          Severity: Major
                          Found in util/apicache.js - About 2 hrs to fix

                            Function k has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                      k: function(t, e) {
                                          var r = "std::string" === (e = ct(e));
                                          _t(t, {
                                              name: e,
                                              fromWireType: function(t) {
                            Severity: Major
                            Found in public/audio_match_demo/afp.js - About 2 hrs to fix

                              Function makeResponseCacheable has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                function makeResponseCacheable(
                                  req,
                                  res,
                                  next,
                                  key,
                              Severity: Major
                              Found in util/apicache.js - About 2 hrs to fix

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

                                module.exports = async (query, request) => {
                                  // query.cookie.os = 'pc'
                                  const tracks = query.tracks.split(',')
                                  const data = {
                                    op: query.op, // del,add
                                Severity: Minor
                                Found in module/playlist_tracks.js - About 2 hrs to fix

                                  Function ExceptionInfo has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    function ExceptionInfo(excPtr) {
                                        this.excPtr = excPtr,
                                            this.ptr = excPtr - 16,
                                            this.set_type = function(t) {
                                                j[this.ptr + 4 >> 2] = t
                                  Severity: Minor
                                  Found in public/audio_match_demo/afp.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language