crafatar/crafatar

View on GitHub

Showing 49 of 62 total issues

Avoid deeply nested control flow statements.
Open

                  if (skin_err) {
                    callback(skin_err, null, slim);
                  } else {
                    skins.extract_face(img, facepath, function(err2) {
                      if (err2) {
Severity: Major
Found in lib/helpers.js - About 45 mins to fix

    Consider simplifying this complex logical expression.
    Open

      if (defname !== "steve" && defname !== "mhf_steve" && defname !== "alex" && defname !== "mhf_alex") {
        if (helpers.id_valid(def)) {
          // clean up the old URL to match new image
          req.url.searchParams.delete('default');
          req.url.path_list[2] = def;
    Severity: Major
    Found in lib/routes/renders.js - About 40 mins to fix

      Function store_skin has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function store_skin(rid, userId, profile, cache_details, callback) {
      Severity: Minor
      Found in lib/helpers.js - About 35 mins to fix

        Function extract_helm has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        exp.extract_helm = function(rid, facefile, buffer, outname, callback) {
        Severity: Minor
        Found in lib/skins.js - About 35 mins to fix

          Function get_avatar has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          exp.get_avatar = function(rid, userId, overlay, size, callback) {
          Severity: Minor
          Found in lib/helpers.js - About 35 mins to fix

            Function store_images has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function store_images(rid, userId, cache_details, type, callback) {
            Severity: Minor
            Found in lib/helpers.js - About 35 mins to fix

              Function resume has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function resume(userId, type, err, hash, slim) {
              Severity: Minor
              Found in lib/helpers.js - About 35 mins to fix

                Function store_cape has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function store_cape(rid, userId, profile, cache_details, callback) {
                Severity: Minor
                Found in lib/helpers.js - About 35 mins to fix

                  Function get_from_options has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  exp.get_from_options = function(rid, url, options, callback) {
                    var is_session_req = config.server.sessions_rate_limit && url.startsWith(session_url);
                  
                    // This is to prevent being blocked by CloudFront for exceeding the rate limit
                    if (is_session_req && req_count() >= config.server.sessions_rate_limit) {
                  Severity: Minor
                  Found in lib/networking.js - About 25 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