ezpaarse-project/ezpaarse

View on GitHub

Showing 291 of 291 total issues

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  describe('receives a log file with an unsupported output format requested', function () {
    it('and sends back a JSON with an error 4006 (@06)', function (done) {
      var headers = {
        'Accept': 'unsupported/format'
      };
Severity: Major
Found in test/injectionerrors-test.js and 2 other locations - About 6 hrs to fix
test/injectionerrors-test.js on lines 29..48
test/injectionerrors-test.js on lines 49..68

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 167.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

  describe('receives a gzipped log file with an unknown content-encoding', function () {
    it('and sends back a JSON with an error 4005 (@04)', function (done) {
      var headers = {
        'content-encoding': 'unsupported/encoding'
      };
Severity: Major
Found in test/injectionerrors-test.js and 2 other locations - About 6 hrs to fix
test/injectionerrors-test.js on lines 29..48
test/injectionerrors-test.js on lines 69..88

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 167.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      helpers.get(reportURL, function (error, response, reportBody) {
        if (!response) { throw new Error('ezPAARSE is not running'); }
        if (error)     { throw error; }
        response.statusCode.should.equal(200,
          'failed to get the report, server responded with a code ' + response.statusCode);
Severity: Major
Found in test/istex-genre-test.js and 1 other location - About 6 hrs to fix
test/istex-test.js on lines 35..47

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 165.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      helpers.get(reportURL, function (error, response, reportBody) {
        if (!response) { throw new Error('ezPAARSE is not running'); }
        if (error)     { throw error; }
        response.statusCode.should.equal(200,
          'failed to get the report, server responded with a code ' + response.statusCode);
Severity: Major
Found in test/istex-test.js and 1 other location - About 6 hrs to fix
test/istex-genre-test.js on lines 74..86

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 165.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  if (argv.header) {
    if (!Array.isArray(argv.header)) { argv.header = [argv.header]; }

    argv.header.forEach(function (item) {
      var i = item.indexOf(':');
Severity: Major
Found in lib/bin/ecmaker.js and 1 other location - About 6 hrs to fix
lib/bin/ecbulkmaker.js on lines 67..79

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 157.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  if (argv.header) {
    if (!Array.isArray(argv.header)) { argv.header = [argv.header]; }

    argv.header.forEach(function (item) {
      var i = item.indexOf(':');
Severity: Major
Found in lib/bin/ecbulkmaker.js and 1 other location - About 6 hrs to fix
lib/bin/ecmaker.js on lines 38..50

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 157.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          this.addOutputFields = function (fields) {
            if (!fields) { return; }
            if (!Array.isArray(fields)) { fields = [fields]; }
            let { added, removed } = this.outputFields;
        
        
        Severity: Major
        Found in lib/job/init.js and 1 other location - About 5 hrs to fix
        lib/job/init.js on lines 167..178

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 143.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          this.removeOutputFields = function (fields) {
            if (!fields) { return; }
            if (!Array.isArray(fields)) { fields = [fields]; }
            let { added, removed } = this.outputFields;
        
        
        Severity: Major
        Found in lib/job/init.js and 1 other location - About 5 hrs to fix
        lib/job/init.js on lines 154..165

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 143.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

          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

            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

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    helpers.post('/', filteredEC, headers, function (err, res, body) {
                      if (!res) { throw new Error('ezPAARSE is not running'); }
                      if (err)  { throw err; }
                      res.statusCode.should.equal(200, 'expected 200, got ' + res.statusCode);
              
              
              Severity: Major
              Found in test/job-logs-test.js and 1 other location - About 5 hrs to fix
              test/job-logs-test.js on lines 420..429

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 136.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                    helpers.post('/', robotEC, headers, function (err, res, body) {
                      if (!res) { throw new Error('ezPAARSE is not running'); }
                      if (err)  { throw err; }
                      res.statusCode.should.equal(200, 'expected 200, got ' + res.statusCode);
              
              
              Severity: Major
              Found in test/job-logs-test.js and 1 other location - About 5 hrs to fix
              test/job-logs-test.js on lines 375..383

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 136.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                    var yargs = require('yargs')
                      .usage('Inject data into ezPAARSE and gets the response' +
                        '\nUsage: $0')
                      .alias('help', 'h')
                      .alias('input', 'i')
                  Severity: Major
                  Found in lib/bin/loginjector.js and 1 other location - About 4 hrs to fix
                  lib/bin/csvextractor.js on lines 9..24

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 121.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Similar blocks of code found in 2 locations. Consider refactoring.
                  Open

                    var yargs = require('yargs')
                      .usage('Execute the scrapers of one or more platforms' +
                              '\nUsage: $0 [-alvfc] [Platform] [Platform] ...')
                      .alias('help', 'h')
                      .alias('all', 'a')
                  Severity: Major
                  Found in lib/bin/scrape.js and 1 other location - About 4 hrs to fix
                  lib/bin/loganonymizer.js on lines 18..31

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 121.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language