ezpaarse-project/ezpaarse

View on GitHub

Showing 291 of 291 total issues

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

      send: function (callback) {
        callback = callback || function () {};

        // Keep backward compatibility with nodemailer 0.7 configuration
        if (opts.hasOwnProperty('attachments')) {
Severity: Minor
Found in lib/mailer.js - About 1 hr to fix

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

      function getWriterOutputStream(resType, ext) {
        var stream;
    
        if (zipExt) { ext += zipExt; }
    
    
    Severity: Minor
    Found in lib/init/init-writer.js - About 1 hr to fix

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

                (function nextScraper() {
                  var scraper = scrapers[j++];
                  if (!scraper) {
      
                    if (!argv.clean) { return nextPlatform(); }
      Severity: Minor
      Found in lib/bin/scrape.js - About 1 hr to fix

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

          if (argv.help || argv.h || argv._.length < 1) {
            yargs.showHelp();
            process.exit(0);
          }
        Severity: Major
        Found in lib/bin/ecbulkmaker.js and 1 other location - About 1 hr to fix
        lib/bin/ecmaker.js on lines 29..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 58.

        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

            } else if (ec.status && !validCodes.has(ec.status)) {
              // Filters http codes other than 200 or 304
              return {
                valid: false,
                reason: `Ignored HTTP status code: ${ec.status}`
        Severity: Major
        Found in lib/ecfilter.js and 1 other location - About 1 hr to fix
        lib/ecfilter.js on lines 133..139

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

        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

            files = files.filter(function (file) {
              return kbartReg.test(file);
            }).sort(function (a, b) {
              // XXXX-XX-XX.txt
              return (a.substr(a.length - 14) < b.substr(b.length - 14) ? -1 : 1);
        Severity: Major
        Found in lib/pkb-cleaner.js and 1 other location - About 1 hr to fix
        lib/pkbmanager.js on lines 148..151

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

        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

            SET_HEADER_NAME (state, { index, value }) {
              const header = state.settings.headers[index];
              if (header) {
                header.name = value;
              }
        Severity: Major
        Found in client/store/settings.js and 1 other location - About 1 hr to fix
        client/store/settings.js on lines 264..269

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

        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.help || argv.h || argv._.length < 2) {
            yargs.showHelp();
            process.exit(0);
          }
        Severity: Major
        Found in lib/bin/ecmaker.js and 1 other location - About 1 hr to fix
        lib/bin/ecbulkmaker.js on lines 42..45

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

        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

                pkbFiles.sort(function (a, b) {
                  // XXXX-XX-XX.txt
                  return (a.substr(a.length - 14) < b.substr(b.length - 14) ? -1 : 1);
                });
        Severity: Major
        Found in lib/pkbmanager.js and 1 other location - About 1 hr to fix
        lib/pkb-cleaner.js on lines 45..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 58.

        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

            SET_HEADER_VALUE (state, { index, value }) {
              const header = state.settings.headers[index];
              if (header) {
                header.value = value;
              }
        Severity: Major
        Found in client/store/settings.js and 1 other location - About 1 hr to fix
        client/store/settings.js on lines 258..263

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

        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 (ec.status && !filterStatus.has(ec.status)) {
              // Filters http codes which are not listed in filterStatus
              return {
                valid: false,
                reason: `Ignored HTTP status code: ${ec.status}`
        Severity: Major
        Found in lib/ecfilter.js and 1 other location - About 1 hr to fix
        lib/ecfilter.js on lines 125..131

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

        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 connectToMongo has 28 lines of code (exceeds 25 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 1 hr to fix

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

          module.exports = function (req, res, job, next) {
            job.logger?.verbose('Initializing output fields');
            job.outputFields = job.outputFields || { added: [], removed: [] };
          
            var fieldsHeader = req.header('Output-Fields');
          Severity: Minor
          Found in lib/init/init-outputfields.js - About 1 hr to fix

            Function testSudoc has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function testSudoc(callback) {
              var headers = {
                'Accept': 'application/json',
                'sudoc-Enrich': 'true'
              };
            Severity: Minor
            Found in test/sudoc-test.js - About 1 hr to fix

              Function EcBulkMaker has a Cognitive Complexity of 10 (exceeds 5 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: Minor
              Found in lib/bin/ecbulkmaker.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 exports has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

              module.exports = function (job) {
                var _domains = {};
              
                return {
                  increment: function (domain) {
              Severity: Minor
              Found in lib/alerts/unknown-domains.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 addDomainsOf has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                async addDomainsOf(platform) {
                  const platformDir  = path.resolve(platformsDir, platform);
                  const manifestFile = path.resolve(platformDir, 'manifest.json');
                  const parserFile   = path.resolve(platformDir, 'parser.js');
                  const pkbFolder    = path.resolve(platformDir, 'pkb');
              Severity: Minor
              Found in lib/parserlist.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 writeHead has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                self.writeHead = function (fields) {
                  var header = '';
                  fields.added.forEach(function (field) {
                    if (outputFields.indexOf(field) === -1) {
                      outputFields.push(field);
              Severity: Minor
              Found in lib/outputformats/tsv.js - About 1 hr to fix

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

                  Function update has 27 lines of code (exceeds 25 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
                    Severity
                    Category
                    Status
                    Source
                    Language