fdesjardins/express-routes-visualizer

View on GitHub
lib/middleware.js

Summary

Maintainability
A
3 hrs
Test Coverage

Function determineHierarchy has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const determineHierarchy = (routeStack, includeHttpMethods = true) => {
  const transformed = {}
  routeStack.map(element => {
    if (element.route) {
      const split = element.route.path.split('/').slice(1)
Severity: Minor
Found in lib/middleware.js - About 1 hr to fix

    Function exports has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = options => (req, res, next) => {
      const config = {
        includeHttpMethods: false,
        ...options
      }
    Severity: Minor
    Found in lib/middleware.js - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                  if (element.route.methods) {
                    if (includeHttpMethods) {
                      Object.keys(element.route.methods).map(method => {
                        existingElement[key][method.toUpperCase()] = {
                          isHttpMethod: true,
      Severity: Major
      Found in lib/middleware.js - About 45 mins to fix

        There are no issues that match your filters.

        Category
        Status