zotoio/github-task-manager

View on GitHub

Showing 13 of 44 total issues

File EventHandler.js has 380 lines of code (exceeds 300 allowed). Consider refactoring.
Open

'use strict';
import requireDir from 'require-dir';
import { Plugin } from './Plugin';
import { default as formatJson } from 'format-json';
import { Executor } from './Executor';
Severity: Minor
Found in src/agent/EventHandler.js - About 3 hrs to fix

    Function handler has 152 lines of code (exceeds 100 allowed). Consider refactoring.
    Open

    function handler(event, context, callback) {
        if (process.env.IAM_ENABLED) {
            AWS.config.update({
                httpOptions: {
                    agent: PROXY_AGENT(process.env.AWS_PROXY)
    Severity: Major
    Found in src/serverless/gtmGithubMetricCapture/gtmGithubMetricCapture.js - About 3 hrs to fix

      AgentUtils has 27 functions (exceeds 25 allowed). Consider refactoring.
      Open

      export class AgentUtils {
          static agentId() {
              return AgentLogger.AGENT_ID;
          }
      
      
      Severity: Minor
      Found in src/agent/AgentUtils.js - About 2 hrs to fix

        File AgentUtils.js has 310 lines of code (exceeds 300 allowed). Consider refactoring.
        Open

        'use strict';
        
        const pullRequestData = require('./pullrequest.json');
        const { URL } = require('url');
        const crypto = require('crypto');
        Severity: Minor
        Found in src/agent/AgentUtils.js - About 2 hrs to fix

          File AgentMetrics.js has 306 lines of code (exceeds 300 allowed). Consider refactoring.
          Open

          import { default as ExpressSSE } from 'express-sse';
          import { default as AWS } from 'aws-sdk';
          import { default as AgentLogger } from './AgentLogger';
          import { default as json } from 'format-json';
          import { default as DynamoDBStream } from 'dynamodb-stream';
          Severity: Minor
          Found in src/agent/AgentMetrics.js - About 2 hrs to fix

            Function processTasks has 117 lines of code (exceeds 100 allowed). Consider refactoring.
            Open

                async processTasks(event, parent) {
                    let promises = [];
                    let log = this.log;
            
                    if (parent.tasks) {
            Severity: Major
            Found in src/agent/EventHandler.js - About 1 hr to fix

              Function setIntialTaskState has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  async setIntialTaskState(event, parent) {
                      let promises = [];
                      let log = this.log;
              
                      let url;
              Severity: Minor
              Found in src/agent/EventHandler.js - About 55 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 toYaml has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  static toYaml(optionsDict) {
                      for (let parameter in optionsDict) {
                          if (parameter.startsWith('YAML_')) {
                              let yamlString = yamljs.stringify(optionsDict[parameter], 8);
                              let varName = parameter.replace('YAML_', '');
              Severity: Minor
              Found in src/agent/AgentUtils.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 createPullRequestStatus has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function createPullRequestStatus(eventData, state, context, description, url) {
              Severity: Minor
              Found in src/serverless/gtmGithubUtils.js - About 35 mins to fix

                Function executeTask has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    async executeTask(task) {
                        this.jenkins = await this.initJenkins();
                        let log = this.log;
                        let jobName = task.options.jobName || null;
                        let buildParams = task.options.parameters || null;
                Severity: Minor
                Found in src/executors/ExecutorJenkins.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 handleEvent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    async handleEvent() {
                        let log = this.log;
                        let startTime = new Date().getTime();
                
                        if (this.eventType === 'pull_request') {
                Severity: Minor
                Found in src/agent/EventHandler.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

                Function validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    validate(task, output) {
                        let log = this.log;
                        let valid = true;
                
                        if (task.options.validator && task.options.validator.type === 'outputRegex') {
                Severity: Minor
                Found in src/executors/ExecutorDocker.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

                Function addEventComment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    async addEventComment(event, commentBody, task) {
                        let log = this.log;
                        // don't add comment to PR if disabled for this event type, or disabled for current task
                        if (!event.taskConfig[event.eventType].disableComments && (!task || !task.disableComments)) {
                            if (commentBody === '') commentBody = 'no comment';
                Severity: Minor
                Found in src/agent/EventHandler.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