BerniWittmann/spielplanismaning

View on GitHub

Showing 181 of 353 total issues

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

  function createParams(model, docs, paths, options, lean) {
Severity: Minor
Found in src/config/mongoose-deep-populate.js - About 35 mins to fix

    Function getEntityQuery has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    function getEntityQuery(model, req) {
        logger.silly('Getting Entity Query');
        if (req.query.id) {
            return queryId(model, req.query.id);
        } else if (req.query.team) {
    Severity: Minor
    Found in src/routes/helpers.js - About 35 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

    Function fillBeendeteSpieleWithEmpty has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    function fillBeendeteSpieleWithEmpty(beendeteSpiele) {
        const maxNr = _.maxBy(beendeteSpiele, 'nummer');
        if (maxNr && maxNr.nummer !== beendeteSpiele.length) {
            const arr = [];
            for (let i = 1; i <= maxNr.nummer; i++) {
    Severity: Minor
    Found in src/routes/spielplanGenerator/helper.js - About 35 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

    Function exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function () {
        const logger = require('winston').loggers.get('api');
        function send(obj, res) {
            let level = 'warn';
            if (obj.STATUSCODE < 400) {
    Severity: Minor
    Found in src/routes/messages/messages.js - About 35 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 spiel.teamA || spiel.teamB || spiel.fromA || spiel.fromB;

      Avoid too many return statements within this function.
      Open

                      return event;
      Severity: Major
      Found in src/public/services/veranstaltungen.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                            return game['team' + teamStr + 'Label'];
        Severity: Major
        Found in src/public/services/spiel.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return 0;
          Severity: Major
          Found in src/routes/spielplanGenerator/helper.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                                return '';
            Severity: Major
            Found in src/public/services/spiel.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                                  return undefined;
              Severity: Major
              Found in src/public/services/veranstaltungen.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return routeconfig.split(' ');
                Severity: Major
                Found in src/routes/helpers.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return undefined;
                  Severity: Major
                  Found in src/routes/helpers.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return queryIdentifier(model, req.query.identifier);
                    Severity: Major
                    Found in src/routes/helpers.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return {
                              dailyStartTime: dailyStartTime,
                              dailyEndTime: dailyEndTime,
                              spielePerDay: spielePerDay,
                              offsetDays: offsetDays,
                      Severity: Major
                      Found in src/routes/helpers.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return querySlug(model, req.query.slug);
                        Severity: Major
                        Found in src/routes/helpers.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return {
                                  searchById: false,
                                  query: model.find({})
                              }
                          Severity: Major
                          Found in src/routes/helpers.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return routeconfig;
                            Severity: Major
                            Found in src/routes/helpers.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return queryDate(model, req.query.date);
                              Severity: Major
                              Found in src/routes/helpers.js - About 30 mins to fix

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

                                function calcSortForHalbFinale(a, b) {
                                    if (a.label === spielLabels.HALBFINALE && a.label !== b.label) {
                                        return b.rankA >= 3 ? 1 : -1;
                                    } else if (b.label === spielLabels.HALBFINALE && a.label !== b.label) {
                                        return a.rankA >= 3 ? -1 : 1;
                                Severity: Minor
                                Found in src/routes/spielplanGenerator/helper.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

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

                                function sortEndrundeSpiele(a, b) {
                                    if (a.label === spielLabels.ZWISCHENRUNDENSPIEL || b.label === spielLabels.ZWISCHENRUNDENSPIEL) {
                                        return calcSortForZwischenrunde(a, b);
                                    }
                                    if (a.label === spielLabels.FINALE || b.label === spielLabels.FINALE) {
                                Severity: Minor
                                Found in src/routes/spielplanGenerator/helper.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