bbyars/mountebank

View on GitHub
src/models/protocols.js

Summary

Maintainability
C
1 day
Test Coverage
B
83%

Function load has 132 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function load (builtInProtocols, customProtocols, options, isAllowedConnection, mbLogger, impostersRepository) {
    function inProcessCreate (createProtocol) {
        return async (creationRequest, logger, responseFn) => {
            const server = await createProtocol(creationRequest, logger, responseFn),
                stubs = impostersRepository.stubsFor(server.port),
Severity: Major
Found in src/models/protocols.js - About 5 hrs to fix

    Function outOfProcessCreate has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function outOfProcessCreate (protocolName, config) {
            function customFieldsFor (creationRequest) {
                const fields = {},
                    commonFields = ['protocol', 'port', 'name', 'recordRequests', 'stubs', 'defaultResponse'];
                Object.keys(creationRequest).forEach(key => {
    Severity: Major
    Found in src/models/protocols.js - About 4 hrs to fix

      Function resolveWithMetadata has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                  function resolveWithMetadata (possibleJSON) {
                      let metadata = {};
      
                      try {
                          metadata = JSON.parse(possibleJSON);
      Severity: Minor
      Found in src/models/protocols.js - About 1 hr to fix

        Function load has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        function load (builtInProtocols, customProtocols, options, isAllowedConnection, mbLogger, impostersRepository) {
        Severity: Minor
        Found in src/models/protocols.js - About 45 mins to fix

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

          function loadProtocols (options, baseURL, logger, isAllowedConnection, imposters) {
          Severity: Minor
          Found in src/models/protocols.js - About 35 mins to fix

            Parsing error: Invalid ecmaVersion.
            Open

            'use strict';
            Severity: Minor
            Found in src/models/protocols.js by eslint

            For more information visit Source: http://eslint.org/docs/rules/

            There are no issues that match your filters.

            Category
            Status