adobe/brackets

View on GitHub
src/extensions/default/StaticServer/node/StaticServerDomain.js

Summary

Maintainability
D
1 day
Test Coverage

Function init has 112 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function init(domainManager) {
    _domainManager = domainManager;

    if (!domainManager.hasDomain("staticServer")) {
        domainManager.registerDomain("staticServer", {major: 0, minor: 1});
Severity: Major
Found in src/extensions/default/StaticServer/node/StaticServerDomain.js - About 4 hrs to fix

    Function _createServer has 80 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function _createServer(path, port, createCompleteCallback) {
        var server,
            app,
            address,
            pathKey = getPathKey(path);
    Severity: Major
    Found in src/extensions/default/StaticServer/node/StaticServerDomain.js - About 3 hrs to fix

      File StaticServerDomain.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
       * Copyright (c) 2012 - present Adobe Systems Incorporated. All rights reserved.
       *
       * Permission is hereby granted, free of charge, to any person obtaining a
       * copy of this software and associated documentation files (the "Software"),
      Severity: Minor
      Found in src/extensions/default/StaticServer/node/StaticServerDomain.js - About 2 hrs to fix

        Function _createServer has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        function _createServer(path, port, createCompleteCallback) {
            var server,
                app,
                address,
                pathKey = getPathKey(path);
        Severity: Minor
        Found in src/extensions/default/StaticServer/node/StaticServerDomain.js - About 1 hr 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 rewrite has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function rewrite(req, res, next) {
                var location = {pathname: parse(req).pathname},
                    hasListener = _rewritePaths[pathKey] && _rewritePaths[pathKey][location.pathname],
                    requestId = _filterRequestCounter++,
                    timeoutId;
        Severity: Minor
        Found in src/extensions/default/StaticServer/node/StaticServerDomain.js - About 1 hr to fix

          There are no issues that match your filters.

          Category
          Status