xcv58/meteor-collectionapi

View on GitHub

Showing 14 of 14 total issues

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

import fibers from 'fibers';
import url from 'url';
import querystring from 'querystring';

import { isFunction, getReturnObject, getNestedValue } from './util';
Severity: Minor
Found in meteor/lib/request-listener.js - About 2 hrs to fix

    RequestListener has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class RequestListener {
      constructor(server, request, response) {
        this._server = server;
        this._request = request;
        this._response = response;
    Severity: Minor
    Found in meteor/lib/request-listener.js - About 2 hrs to fix

      Function start has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        start() {
          const startupMessage = `Collection API v${this.version}`;
      
          if (this.options.standAlone === true) {
            let httpServer = http;
      Severity: Minor
      Found in meteor/lib/collection-api.js - About 1 hr to fix

        Function constructor has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructor(server, request, response) {
            this._server = server;
            this._request = request;
            this._response = response;
        
        
        Severity: Minor
        Found in meteor/lib/request-listener.js - About 1 hr to fix

          Function get has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            get(fromRequest = 'GET') {
              fibers(() => {
                try {
                  const { collectionId } = this._requestPath;
                  let cursor = null;
          Severity: Minor
          Found in meteor/lib/request-listener.js - About 1 hr to fix

            Function put has 35 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              put() {
                if (!this._requestPath.collectionId) {
                  return this._notFoundResponse('Missing _id');
                }
            
            
            Severity: Minor
            Found in meteor/lib/request-listener.js - About 1 hr to fix

              Function _authenticate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                _authenticate(...args) {
                  const collectionOptions = this._collectionOptions;
                  let authCount = 0;
              
                  // Check the global auth token
              Severity: Minor
              Found in meteor/lib/request-listener.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 constructor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                constructor(server, request, response) {
                  this._server = server;
                  this._request = request;
                  this._response = response;
              
              
              Severity: Minor
              Found in meteor/lib/request-listener.js - About 45 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

              Avoid too many return statements within this function.
              Open

                      return this._okResponse(stringify(records));
              Severity: Major
              Found in meteor/lib/request-listener.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return this._internalServerErrorResponse(e);
                Severity: Major
                Found in meteor/lib/request-listener.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                            return this._notFoundResponse('No Record(s) Found');
                  Severity: Major
                  Found in meteor/lib/request-listener.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                              return this._createdResponse(stringify(records));
                    Severity: Major
                    Found in meteor/lib/request-listener.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return this.get('PUT');
                      Severity: Major
                      Found in meteor/lib/request-listener.js - About 30 mins to fix

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

                          start() {
                            const startupMessage = `Collection API v${this.version}`;
                        
                            if (this.options.standAlone === true) {
                              let httpServer = http;
                        Severity: Minor
                        Found in meteor/lib/collection-api.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