ezpaarse-project/ezpaarse

View on GitHub

Showing 291 of 291 total issues

Function EcMaker has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.EcMaker = function () {
  var fs      = require('fs-extra');
  var path    = require('path');
  var ecmaker = require('../../lib/ecmake.js');
  var outpath;
Severity: Major
Found in lib/bin/ecmaker.js - About 2 hrs to fix

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

    module.exports = function (logFormat, laxist) {
      var usedProperties = [];
      var parameters = {
        '%h': {property: 'host',     regexp: '([a-zA-Z0-9.\\-:]+(?:, ?[a-zA-Z0-9.\\-:]+)*)'},
        '%u': {property: 'login',    regexp: '([a-zA-Z0-9@.\\-_%,=]+)'},
    Severity: Major
    Found in lib/proxyformats/ezproxy.js - About 2 hrs to fix

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

      module.exports = function (logFormat, laxist) {
        var usedProperties = [];
        var parameters = {
          '%h':  {property: 'host',     regexp: '([a-zA-Z0-9.\\-:]+(?:, ?[a-zA-Z0-9.\\-:]+)*)'},
          '%l':  {property: 'identd',   regexp: '([a-zA-Z0-9\\-]+)'},
      Severity: Major
      Found in lib/proxyformats/apache.js - About 2 hrs to fix

        Function Writer has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        var Writer = function (outputStream, outputFields) {
          var self     = this;
          outputFields = outputFields || [];
        
          outputStream.on('drain', function () {
        Severity: Minor
        Found in lib/outputformats/csv.js - About 2 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

        Function getHeaders has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        function getHeaders (settings) {
          if (!settings) { return {}; }
          const headers = {};
        
          if (settings.outputFormat) { headers['Accept'] = settings.outputFormat; }
        Severity: Minor
        Found in client/store/settings.js - About 2 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

        Function csvExtractor has 59 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        exports.csvExtractor = function () {
          var csvextractor = require('../../lib/csvextractor.js');
          var yargs = require('yargs')
            .usage('Parse a csv source into json.' +
              '\n  Usage: $0 [-sc] [-f string | -d string | -k string] [--no-header]')
        Severity: Major
        Found in lib/bin/csvextractor.js - About 2 hrs to fix

          Function logExtractor has 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.logExtractor = function () {
          
            var Lazy   = require('lazy');
            var fs     = require('fs-extra');
            var parser = require('../logparser.js');
          Severity: Major
          Found in lib/bin/logextractor.js - About 2 hrs to fix

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

                helpers.post('/', upmcLogFile, headers, function (err, res, body) {
                  if (!res) { throw new Error('ezPAARSE is not running'); }
                  if (err)  { throw err; }
                  res.statusCode.should.equal(400, 'expected a status code of 400, got ' + res.statusCode);
            
            
            Severity: Major
            Found in test/predefined-test.js and 1 other location - About 2 hrs to fix
            test/predefined-test.js on lines 31..37

            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 82.

            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('/', upmcLogFile, headers, function (err, res, body) {
                  if (!res) { throw new Error('ezPAARSE is not running'); }
                  if (err)  { throw err; }
                  res.statusCode.should.equal(200, 'expected a status code of 200, got ' + res.statusCode);
            
            
            Severity: Major
            Found in test/predefined-test.js and 1 other location - About 2 hrs to fix
            test/predefined-test.js on lines 16..22

            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 82.

            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 nextPlatform has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function nextPlatform() {
                  var item = items.shift();
                  if (!item) { return console.log('\nDone, %d scrapers executed', executed); }
            
                  fs.stat(path.join(platformsDir, item), function (err, stat) {
            Severity: Major
            Found in lib/bin/scrape.js - About 2 hrs to fix

              Function isValid has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

              exports.isValid = function (ec, job) {
                const validCodes = new Set(['200', '304']);
                const deniedCodes = new Set(['401', '403']);
                const filterRedirs = job.hasOwnProperty('filterRedirs') ? job.filterRedirs : true;
                const filterStatus = job.hasOwnProperty('filterStatus') ? job.filterStatus : true;
              Severity: Minor
              Found in lib/ecfilter.js - About 2 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

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

                if (iconv.encodingExists(resCharset)) {
                  job.logger?.info('Charset for response : ' + resCharset);
                  job.outputCharset = resCharset;
                } else {
                  job.logger?.warn('(response) Charset is  not supported');
              Severity: Major
              Found in lib/init/init-charset.js and 1 other location - About 2 hrs to fix
              lib/init/init-charset.js on lines 18..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 80.

              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 (iconv.encodingExists(reqCharset)) {
                  job.logger?.info('Charset for request : ' + reqCharset);
                  job.inputCharset = reqCharset;
                } else {
                  job.logger?.warn('(request) Charset is  not supported');
              Severity: Major
              Found in lib/init/init-charset.js and 1 other location - About 2 hrs to fix
              lib/init/init-charset.js on lines 26..32

              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 80.

              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 getISBN has 56 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                self.getISBN = function (rid) {
                  var product, rest, calculatedKey;
              
                  var isbn = rid.replace(blocSep, '');
                  var result = {
              Severity: Major
              Found in lib/rid-syntax-checker.js - About 2 hrs to fix

                Function hostLocalize has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                exports.hostLocalize = function () {
                  var csvextractor = require('../../lib/csvextractor.js');
                  var hostlocalize = require('../../lib/hostlocalize.js');
                  require('sugar'); // add more methods to Objects (like merge)
                  var yargs = require('yargs')
                Severity: Major
                Found in lib/bin/hostlocalize.js - About 2 hrs to fix

                  Function csvTotalizer has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  exports.csvTotalizer = function () {
                    // get the command line argument
                    // platform
                    var yargs = require('yargs')
                      .usage('Totalize fields from a CSV stream\n' +
                  Severity: Major
                  Found in lib/bin/csvtotalizer.js - About 2 hrs to fix

                    Function getISSN has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      self.getISSN = function (rid) {
                        var issn = rid;
                        var product, rest, calculatedKey;
                        var result = {
                          'rid': rid,        // identifier value
                    Severity: Major
                    Found in lib/rid-syntax-checker.js - About 2 hrs to fix

                      Function cache has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function cache(collectionName) {
                      
                        const collection = mongo.db.collection(collectionName);
                      
                        if (!collection) { return null; }
                      Severity: Major
                      Found in lib/cache.js - About 2 hrs to fix

                        File deduplication-test.js has 256 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /*eslint max-len: 0*/
                        /*global describe, it*/
                        'use strict';
                        
                        var fs      = require('fs');
                        Severity: Minor
                        Found in test/deduplication-test.js - About 2 hrs to fix

                          Function PROCESS has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              async PROCESS ({ commit, rootState, dispatch }, formData) {
                                const headers = await dispatch('settings/GET_HEADERS', null, { root: true });
                                const abortController = new AbortController();
                                const jobID = uuidv1();
                          
                          
                          Severity: Major
                          Found in client/store/process.js - About 2 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language