feathersjs/feathers-express

View on GitHub

Showing 5 of 5 total issues

Function feathersExpress has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

function feathersExpress (feathersApp) {
  if (!feathersApp) {
    return express();
  }

Severity: Minor
Found in lib/index.js - About 2 hrs 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 feathersExpress has 54 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function feathersExpress (feathersApp) {
  if (!feathersApp) {
    return express();
  }

Severity: Major
Found in lib/index.js - About 2 hrs to fix

    Function getHandler has 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getHandler (method, getArgs) {
      return service => {
        return function (req, res, next) {
          const { query } = req;
          const route = omit(req.params, '__feathersId');
    Severity: Minor
    Found in lib/rest/wrappers.js - About 1 hr to fix

      Function rest has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function rest (handler = formatter) {
        return function () {
          const app = this;
      
          if (typeof app.route !== 'function') {
      Severity: Minor
      Found in lib/rest/index.js - About 1 hr to fix

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

            use (location) {
              let service;
              let middleware = Array.from(arguments)
                .slice(1)
                .reduce(function (middleware, arg) {
        Severity: Minor
        Found in lib/index.js - About 1 hr to fix
          Severity
          Category
          Status
          Source
          Language