ezpaarse-project/ezpaarse

View on GitHub

Showing 156 of 291 total issues

Avoid too many return statements within this function.
Open

  if (!req.body.jobID) { return sendMail(); }
Severity: Major
Found in routes/feedback.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        if (!exports.equals(x[p], y[p], datify)) { return false; }
    Severity: Major
    Found in test/helpers.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                return sendError(util.format('The process seems to have ended prematurely, please see %s',
                  report.general['URL-Traces']));
      Severity: Major
      Found in lib/ecmake.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                if (!reportFile) { return callback(); }
        Severity: Major
        Found in lib/ecmake.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

            return { valid: true };
          Severity: Major
          Found in lib/ecfilter.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return {
                    valid: false,
                    reason: `Ignored HTTP status code: ${ec.status}`
                  };
            Severity: Major
            Found in lib/ecfilter.js - About 30 mins to fix

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

              exports.clean = function () {
                const yargs = require('yargs')
                  .usage('Clean knowledge bases.' +
                    '\n  Usage: $0 [-nvp] [DIR_TO_CLEAN]')
                  .boolean(['n', 'v'])
              Severity: Minor
              Found in lib/bin/pkb-cleaner.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 isQualified has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.isQualified = function (ec) {
                let level = 0;
                for (const field in qualifyingFactors) {
                  if (ec[field]) {
                    level += qualifyingFactors[field];
              Severity: Minor
              Found in lib/ecfilter.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 updateFile has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              ReportManager.prototype.updateFile = function (callback, noWait) {
                var self = this;
              
                if (noWait) {
                  if (typeof callback === 'function') {
              Severity: Minor
              Found in lib/reportmanager.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 exports has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports = function (req, res, job, next) {
                job.logger?.verbose('Initializing charsets');
              
                var reqCharset = req.header('request-charset')  || 'utf-8';
                var resCharset = req.header('response-charset') || 'utf-8';
              Severity: Minor
              Found in lib/init/init-charset.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 compute has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              ReportManager.prototype.compute = function () {
                var nbRejects     = this.get('rejets', 'nb-lines-unknown-formats');
                nbRejects        += this.get('rejets', 'nb-lines-unknown-domains');
                nbRejects        += this.get('rejets', 'nb-lines-unqualified-ecs');
                nbRejects        += this.get('rejets', 'nb-lines-unknown-errors');
              Severity: Minor
              Found in lib/reportmanager.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 connectToMongo has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              async function connectToMongo () {
                try {
                  await mongo.connect(config.EZPAARSE_MONGO_URL);
                } catch (err) {
                  logger.error(`Cannot connect to MongoDB at ${config.EZPAARSE_MONGO_URL}`);
              Severity: Minor
              Found in server.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 resolve has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.resolve = function (host, job, cb) {
                var r = {};
              
                if (typeof job == 'function') { cb = job; job = null; }
                if (!job) { job = {}; }
              Severity: Minor
              Found in lib/hostlocalize.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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              ReportManager.prototype.get = function (group, entry) {
                if (arguments.length == 1) {
                  entry = group;
                  group = false;
                }
              Severity: Minor
              Found in lib/reportmanager.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 checkMongodb has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              async function checkMongodb() {
                try {
                  await mongo.connect(config.EZPAARSE_MONGO_URL, { serverSelectionTimeoutMS: 5000 });
                } catch (err) {
                  errorMessage(`Cannot connect to ${config.EZPAARSE_MONGO_URL}`);
              Severity: Minor
              Found in lib/bin/checkconfig.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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.validate = function (file, callback) {
                var titleIDs      = {}; // List of title IDs
                var titleIdColumn = false;
                var syntaxError   = false;
                var currentLine   = 1;
              Severity: Minor
              Found in lib/pkbvalidator.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