Showing 49 of 62 total issues
Function get_image_hash
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
exp.get_image_hash = function(rid, userId, type, callback) {
cache.get_details(userId, function(err, cache_details) {
var cached_hash = null;
if (cache_details !== null) {
cached_hash = type === "skin" ? cache_details.skin : cache_details.cape;
Function store_cape
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function store_cape(rid, userId, profile, cache_details, callback) {
networking.get_cape_url(rid, userId, profile, function(err, url) {
if (!err && url) {
var cape_hash = get_hash(url);
if (cache_details && cache_details.cape === cape_hash) {
Function get_render
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
exp.get_render = function(rid, userId, scale, overlay, body, callback) {
exp.get_skin(rid, userId, function(err, skin_hash, status, img, slim) {
if (!skin_hash) {
callback(err, status, skin_hash, null);
return;
Function asset_request
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function asset_request(req, callback) {
const filename = path.join(__dirname, "public", ...req.url.path_list);
const relative = path.relative(path.join(__dirname, "public"), filename);
if (relative && !relative.startsWith('..') && !path.isAbsolute(relative)) {
fs.access(filename, function(fs_err) {
Function handle_default
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function handle_default(img_status, userId, size, def, req, err, callback) {
def = def || skins.default_skin(userId);
var defname = def.toLowerCase();
if (defname !== "steve" && defname !== "mhf_steve" && defname !== "alex" && defname !== "mhf_alex") {
if (helpers.id_valid(def)) {
- Read upRead up
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 handle_default
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function handle_default(img_status, userId, def, req, err, callback) {
def = def || skins.default_skin(userId);
var defname = def.toLowerCase();
if (defname !== "steve" && defname !== "mhf_steve" && defname !== "alex" && defname !== "mhf_alex") {
if (helpers.id_valid(def)) {
- Read upRead up
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 handle_default
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function handle_default(rid, scale, overlay, body, img_status, userId, size, def, req, err, callback) {
def = def || skins.default_skin(userId);
var defname = def.toLowerCase();
if (defname !== "steve" && defname !== "mhf_steve" && defname !== "alex" && defname !== "mhf_alex") {
if (helpers.id_valid(def)) {
- Read upRead up
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 draw_model
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
exp.draw_model = function(rid, img, scale, overlay, is_body, slim, callback) {
Function handle_default
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function handle_default(img_status, userId, size, def, req, err, callback) {
Function save_hash
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
exp.save_hash = function(rid, userId, skin_hash, cape_hash, slim, callback) {
Function resize_img
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exp.resize_img = function(inname, size, callback) {
lwip.open(inname, function(err, image) {
if (err) {
callback(err, null);
} else {
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if (crop_err) {
callback(crop_err);
} else {
face_img.paste(0, 0, helm_img, function(img_err, face_helm_img) {
if (img_err) {
Function handle_default
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function handle_default(img_status, userId, def, req, err, callback) {
Function getPart
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function getPart(src, x, y, width, height, scale) {
Function save_image
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exp.save_image = function(buffer, outpath, callback) {
lwip.open(buffer, "png", function(err, image) {
if (err) {
callback(err);
} else {
- Read upRead up
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 extract_face
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exp.extract_face = function(buffer, outname, callback) {
lwip.open(buffer, "png", function(err, image) {
if (err) {
callback(err);
} else {
- Read upRead up
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
Avoid deeply nested control flow statements. Open
if (skin_img.__trans) { // eslint-disable-line no-underscore-dangle
xloop:
for (var x = 0; x < helm_area.width(); x++) {
for (var y = 0; y < helm_area.height(); y++) {
// check if transparency-bounding-box has transparency
Function exports
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(req, callback) {
var raw_type = req.url.path_list[1] || "";
var rid = req.id;
var body = raw_type === "body";
var userId = (req.url.path_list[2] || "").split(".")[0];
- Read upRead up
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 get_render
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
exp.get_render = function(rid, userId, scale, overlay, body, callback) {
Function extract_helm
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
exp.extract_helm = function(rid, facefile, buffer, outname, callback) {
lwip.open(buffer, "png", function(err, skin_img) {
if (err) {
callback(err);
} else {
- Read upRead up
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"