ezpaarse-project/ezpaarse

View on GitHub

Showing 156 of 291 total issues

Function logParser has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
Open

module.exports = function logParser(options) {
  options            = options || {};
  options.dateFormat = options.dateFormat || 'DD/MMM/YYYY:HH:mm:ss Z';

  var parser = {};
Severity: Minor
Found in lib/logparser.js - About 1 day 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 init has 295 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function* init(req, res, options) {
  const self      = this;
  const jobID     = this.jobID;
  const logPath   = path.resolve(tmpDir, jobID.charAt(0), jobID.charAt(1), jobID);
  const predefKey = req.get('ezPAARSE-Predefined-Settings');
Severity: Major
Found in lib/job/init.js - About 1 day to fix

    Function init has a Cognitive Complexity of 66 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports = function* init(req, res, options) {
      const self      = this;
      const jobID     = this.jobID;
      const logPath   = path.resolve(tmpDir, jobID.charAt(0), jobID.charAt(1), jobID);
      const predefKey = req.get('ezPAARSE-Predefined-Settings');
    Severity: Minor
    Found in lib/job/init.js - About 1 day 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 Job has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
    Open

    function Job(req, res, jobID, options) {
      const self = ezJobs[jobID] = this;
      req._jobID = jobID;
    
      io().in('admin').emit('jobs', Object.keys(ezJobs));
    Severity: Minor
    Found in lib/job.js - About 1 day 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 214 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    module.exports = function () {
      var currentCompletion;
      var possibleFields = {};
    
      var rl = readline.createInterface({
    Severity: Major
    Found in lib/bin/platform-init.js - About 1 day to fix

      Function LinesProcessor has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
      Open

      const LinesProcessor = function (job) {
        let ecNumber   = 0;
        let nbBadLines = 0;
        let firstLine  = true;
        const emit = this.emit.bind(this);
      Severity: Minor
      Found in lib/lineprocessor.js - About 1 day 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 LinesProcessor has 204 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const LinesProcessor = function (job) {
        let ecNumber   = 0;
        let nbBadLines = 0;
        let firstLine  = true;
        const emit = this.emit.bind(this);
      Severity: Major
      Found in lib/lineprocessor.js - About 1 day to fix

        Function ridChecker has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
        Open

        var ridChecker = function () {
          var self = this;
          var DoNotCheckPattern = new RegExp('^#');
          var ISSNPattern = new RegExp('[0-9]{4}\\-[0-9]{3}([0-9Xx])?');
          var ISBNPattern = new RegExp('((978[-– ])?[0-9][0-9-– ]{10}[-– ][0-9xX])|((978)?[0-9]{9}[0-9])');
        Severity: Minor
        Found in lib/rid-syntax-checker.js - About 1 day 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 Job has 175 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function Job(req, res, jobID, options) {
          const self = ezJobs[jobID] = this;
          req._jobID = jobID;
        
          io().in('admin').emit('jobs', Object.keys(ezJobs));
        Severity: Major
        Found in lib/job.js - About 7 hrs to fix

          Function EcBulkMaker has 167 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.EcBulkMaker = function () {
          
            var yargs = require('yargs')
              .usage('Inject files to ezPAARSE (for batch purpose)' +
                '\n  Usage: $0 [-rflvH] SOURCE_DIR [RESULT_DIR]')
          Severity: Major
          Found in lib/bin/ecbulkmaker.js - About 6 hrs to fix

            File info.js has 420 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // ##EZPAARSE
            
            'use strict';
            
            const fs             = require('fs-extra');
            Severity: Minor
            Found in routes/info.js - About 6 hrs to fix

              Function read has 151 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function* read(req, res) {
                const self = this;
              
                this.logger?.info('Starting response');
              
              
              Severity: Major
              Found in lib/job/read.js - About 6 hrs to fix

                File admin.js has 416 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                'use strict';
                
                const fs         = require('fs');
                const path       = require('path');
                const Boom       = require('boom');
                Severity: Minor
                Found in routes/admin.js - About 6 hrs to fix

                  Function ridChecker has 134 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  var ridChecker = function () {
                    var self = this;
                    var DoNotCheckPattern = new RegExp('^#');
                    var ISSNPattern = new RegExp('[0-9]{4}\\-[0-9]{3}([0-9Xx])?');
                    var ISBNPattern = new RegExp('((978[-– ])?[0-9][0-9-– ]{10}[-– ][0-9xX])|((978)?[0-9]{9}[0-9])');
                  Severity: Major
                  Found in lib/rid-syntax-checker.js - About 5 hrs to fix

                    Function validate has 134 lines of code (exceeds 25 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: Major
                    Found in lib/pkbvalidator.js - About 5 hrs to fix

                      File job-logs-test.js has 381 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      /* eslint no-sync: 0 */
                      /* global describe, it */
                      'use strict';
                      
                      var fs      = require('fs');
                      Severity: Minor
                      Found in test/job-logs-test.js - About 5 hrs to fix

                        Function logParser has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = function logParser(options) {
                          options            = options || {};
                          options.dateFormat = options.dateFormat || 'DD/MMM/YYYY:HH:mm:ss Z';
                        
                          var parser = {};
                        Severity: Major
                        Found in lib/logparser.js - About 4 hrs to fix

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

                          module.exports = function (req, res, job, next) {
                            job.logger?.verbose('Initializing EC writer');
                          
                            var acceptEncoding = req.header('response-encoding');
                            var zip;
                          Severity: Major
                          Found in lib/init/init-writer.js - About 4 hrs to fix

                            Function pkbValidator has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            exports.pkbValidator = function () {
                              var yargs = require('yargs')
                                .usage('Check a platform knowledge base file.' +
                                  '\n  Usage: $0 [-csvw] pkb_file1.txt [pkb_file2.txt]')
                                .boolean(['c', 's', 'v', 'w'])
                            Severity: Major
                            Found in lib/bin/pkbvalidator.js - About 4 hrs to fix

                              Function pkbValidator has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                              Open

                              exports.pkbValidator = function () {
                                var yargs = require('yargs')
                                  .usage('Check a platform knowledge base file.' +
                                    '\n  Usage: $0 [-csvw] pkb_file1.txt [pkb_file2.txt]')
                                  .boolean(['c', 's', 'v', 'w'])
                              Severity: Minor
                              Found in lib/bin/pkbvalidator.js - About 4 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

                              Severity
                              Category
                              Status
                              Source
                              Language