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';
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)
AgentUtils
has 27 functions (exceeds 25 allowed). Consider refactoring. Open
export class AgentUtils {
static agentId() {
return AgentLogger.AGENT_ID;
}
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');
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';
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) {
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;
- Read upRead up
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_', '');
- Read upRead up
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) {
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;
- Read upRead up
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') {
- Read upRead up
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';
- Read upRead up
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') {
- Read upRead up
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"