resource-watch/doc-executor

View on GitHub

Showing 13 of 45 total issues

Function processRow has 80 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    async processRow(stream, reject, data) {
        try {
            stream.pause();
            logger.debug(`[ImporterService] Processing row for file ${this.url}`);
            try {
Severity: Major
Found in app/src/services/importer.service.js - About 3 hrs to fix

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

    module.exports = (grunt) => {
    
        grunt.file.setBase('..');
        // eslint-disable-next-line import/no-extraneous-dependencies
        require('load-grunt-tasks')(grunt);
    Severity: Major
    Found in app/Gruntfile.js - About 2 hrs to fix

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

          constructor() {
              logger.info(`Connecting to Elasticsearch at ${elasticUrl}`);
      
              const elasticSearchConfig = {
                  node: elasticUrl
      Severity: Major
      Found in app/src/services/elastic.service.js - About 2 hrs to fix

        Function requestDownloadFile has 58 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            new Bluebird((resolve, reject) => {
                logger.debug(`[DownloadService] Sending request to ${url}`);
                try {
                    let dlprogress = 0;
                    let oldProgress = 0;
        Severity: Major
        Found in app/src/services/downloadService.js - About 2 hrs to fix

          Function createIndex has 58 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              async createIndex(index, legend) {
                  logger.debug(`Creating index ${index}  in elastic`);
                  const body = {
                      settings: {
                          index: {
          Severity: Major
          Found in app/src/services/elastic.service.js - About 2 hrs to fix

            Function start has 57 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                async start() {
                    // eslint-disable-next-line no-async-promise-executor
                    return new Promise(async (resolve, reject) => {
                        let converter;
                        try {
            Severity: Major
            Found in app/src/services/importer.service.js - About 2 hrs to fix

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

                  constructor() {
                      logger.info(`Connecting to Elasticsearch at ${elasticUrl}`);
              
                      const elasticSearchConfig = {
                          node: elasticUrl
              Severity: Minor
              Found in app/src/services/elastic.service.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 processRow has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                  async processRow(stream, reject, data) {
                      try {
                          stream.pause();
                          logger.debug(`[ImporterService] Processing row for file ${this.url}`);
                          try {
              Severity: Minor
              Found in app/src/services/importer.service.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 processMessage has 37 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  static async processMessage(msg, executorQueueService) {
                      // logger.debug('Processing message', msg);
                      switch (msg.type) {
              
                          case ExecutionMessages.EXECUTION_CREATE:
              Severity: Minor
              Found in app/src/services/executor.service.js - About 1 hr to fix

                Function consume has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    async consume(msg) {
                        let message = null;
                        try {
                            logger.debug('[Executor Queue] Message received', msg.content.toString());
                            message = JSON.parse(msg.content.toString());
                Severity: Minor
                Found in app/src/services/executor-queue.service.js - About 1 hr to fix

                  Function consume has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      async consume(msg) {
                          let message = null;
                          try {
                              logger.debug('[Executor Queue] Message received', msg.content.toString());
                              message = JSON.parse(msg.content.toString());
                  Severity: Minor
                  Found in app/src/services/executor-queue.service.js - About 45 mins 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      async init() {
                          if (this.checkURL.test(this.url)) {
                              logger.debug('[CSVConverter] Is a url. Downloading file');
                              const exists = await DownloadService.checkIfExists(this.url);
                              if (!exists) {
                  Severity: Minor
                  Found in app/src/services/converters/csvConverter.js - About 35 mins 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 deleteIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                      static async deleteIndex(msg) {
                          logger.debug('Deleting index', msg.index);
                          try {
                              await elasticService.deleteIndex(msg.index);
                          } catch (error) {
                  Severity: Minor
                  Found in app/src/services/executor.service.js - About 25 mins 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