Ilshidur/node-mercure

View on GitHub
src/server.js

Summary

Maintainability
B
4 hrs
Test Coverage

Function publishEndpointHandler has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function publishEndpointHandler() {
  return async (req, res, next) => {
    const hub = req.app.get('hub');

    // Authorize publisher
Severity: Major
Found in src/server.js - About 2 hrs to fix

    Avoid too many return statements within this function.
    Open

              return res.status(401).send('Unauthorized');
    Severity: Major
    Found in src/server.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return res.status(400).send(`Exceeded limit of ${hub.config.maxTopics} topics`);
      Severity: Major
      Found in src/server.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return next(err);
        Severity: Major
        Found in src/server.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return res.status(200).send(updateId);
          Severity: Major
          Found in src/server.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return res.status(400).send('Invalid "retry" parameter');
            Severity: Major
            Found in src/server.js - About 30 mins to fix

              There are no issues that match your filters.

              Category
              Status