ezpaarse-project/ezpaarse

View on GitHub

Showing 291 of 291 total issues

Function EcMaker has a Cognitive Complexity of 12 (exceeds 5 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: Minor
Found in lib/bin/ecmaker.js - About 1 hr 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 pkbGetter has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function pkbGetter(platform, pkb) {
  var missingFile = path.join(__dirname, '/../platforms/', platform, 'pkb', platform +
    '.pkb.miss.txt');

  var missQueue = async.queue(function (titleID, callback) {
Severity: Minor
Found in lib/pkbmanager.js - About 1 hr to fix

    Function readFile has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        (function readFile() {
          const file = files.pop();
          if (!file) { return callback(null, Object.keys(robots).length); }
    
          const type = file.substr(0, file.indexOf('.'));
    Severity: Minor
    Found in lib/ecfilter.js - About 1 hr to fix

      Function Organizer has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function Organizer() {
        var self   = this;
        var buffer = new Map();
        var next   = 1;
        var last   = false;
      Severity: Minor
      Found in lib/organizer.js - About 1 hr to fix

        Function nextFile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          var nextFile = function () {
            var file   = files[i++];
            if (!file) { process.exit(status); }
        
            pkbValidator.validate(file)
        Severity: Minor
        Found in lib/bin/pkbvalidator.js - About 1 hr to fix

          Function readConfig has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          exports.readConfig = function () {
            var config = require('../config.js');
            var pkg    = require('../../package.json');
          
          
          
          Severity: Minor
          Found in lib/bin/readconfig.js - About 1 hr to fix

            Function Writer has 33 lines of code (exceeds 25 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 1 hr to fix

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

                  fields.removed.forEach(function (field) {
                    var index = outputFields.indexOf(field);
                    if (index !== -1) {
                      outputFields.splice(index, 1);
                    }
              Severity: Major
              Found in lib/outputformats/tsv.js and 1 other location - About 1 hr to fix
              lib/outputformats/csv.js on lines 32..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 61.

              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('Usage: $0 --platform=[string] --nb=[num] --rate=[num] --duration=[seconds]\nExample: $0 --platform="sd|npg" --rate=100 --duration=10')
                  .demand('platform').default('platform', '-')
                  .demand('nb').alias('nb', 'n').default('nb', 'nolimit')
                  .demand('rate').alias('rate', 'r').default('rate', 10)
              Severity: Major
              Found in lib/bin/logfaker.js and 1 other location - About 1 hr to fix
              lib/bin/logextractor.js on lines 16..19

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

              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

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

                  fields.removed.forEach(function (field) {
                    var index = outputFields.indexOf(field);
                    if (index !== -1) {
                      outputFields.splice(index, 1);
                    }
              Severity: Major
              Found in lib/outputformats/csv.js and 1 other location - About 1 hr to fix
              lib/outputformats/tsv.js on lines 33..38

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

              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('Extract specific fields from a log stream\nUsage: $0 --fields=[string] --separator=";"')
                  .demand('fields').alias('fields', 'f')
                  .demand('separator').alias('separator', 'sep').alias('separator', 's').default('separator', '\t')
              Severity: Major
              Found in lib/bin/logextractor.js and 1 other location - About 1 hr to fix
              lib/bin/logfaker.js on lines 14..18

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

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

              async function getMiddlewaresData() {
                const middlewaresFolder = path.resolve(__dirname, '../middlewares');
                const result = await dbConfig.getConfig('middlewares');
                const savedMiddlewares = result && result.data;
              
              
              Severity: Minor
              Found in routes/info.js - About 1 hr to fix

                Function readNextDir has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    (async function readNextDir(callback) {
                      const folder = folders[i++];
                
                      if (!folder) { return callback(); }
                      if (folder == 'js-parser-skeleton') { return readNextDir(callback); }
                Severity: Minor
                Found in routes/info.js - About 1 hr to fix

                  Function extract has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                  exports.extract = function (source, options, callback) {
                    if (typeof options == 'function') {
                      callback = options;
                      options  = {};
                    }
                  Severity: Minor
                  Found in lib/csvextractor.js - About 1 hr 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 update has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

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

                  exports.logInjector = function () {
                  
                    var fs      = require('fs-extra');
                    var request = require('request');
                    var config  = require('../config.js');
                  Severity: Minor
                  Found in lib/bin/loginjector.js - About 1 hr 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 clearCache has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function clearCache(filePath) {
                    if (!filePath) { return Promise.resolve(); }
                  
                    return new Promise((resolve, reject) => {
                      fs.stat(filePath, (err, stat) => {
                  Severity: Minor
                  Found in routes/admin.js - About 1 hr to fix

                    Function getCertifications has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    exports.getCertifications = (docurl) => new Promise((resolve, reject) => {
                      const requestOptions = {
                        method: 'GET',
                        url: 'http://analyses.ezpaarse.org/api/platforms',
                        json: true,
                    Severity: Minor
                    Found in lib/analogist.js - About 1 hr to fix

                      Function logFaker has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      exports.logFaker = function () {
                      
                        var logF = require('../logfaker.js');
                      
                        // get the command line argument
                      Severity: Minor
                      Found in lib/bin/logfaker.js - About 1 hr to fix

                        Function getPkbPackages has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            const getPkbPackages = function (pkbDir, callback) {
                              fs.readdir(pkbDir, function (err, files) {
                                if (err && err.code != 'ENOENT') { return callback(err); }
                        
                                files = files || [];
                        Severity: Minor
                        Found in routes/info.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language