gitevents/core

View on GitHub

Showing 7 of 25 total issues

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

module.exports = (payload, superEvent) => {
  return new Promise(function (resolve, reject) {
    log.debug('processing talk');

    let github = new GitHubApi({
Severity: Major
Found in lib/talks.js - About 5 hrs to fix

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

module.exports = (payload) => {
  return new Promise(function (resolve, reject) {
    log.debug('processing event');

    let github = new GitHubApi({
Severity: Major
Found in lib/events.js - About 4 hrs to fix

Function addTalk has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

let addTalk = (payload, speaker, github) => {
  return new Promise(function (resolve, reject) {
    log.debug('addTalk()');

    let eventId = payload.issue.milestone.description;
Severity: Major
Found in lib/events.js - About 2 hrs to fix

Function issueHandler has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

let issueHandler = (event) => {
  log.debug('New event: ' + event.event);

  if (event.payload) {
    let payload = event.payload;
Severity: Major
Found in gitevents.js - About 2 hrs to fix

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

let issueHandler = (event) => {
  log.debug('New event: ' + event.event);

  if (event.payload) {
    let payload = event.payload;
Severity: Minor
Found in gitevents.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 createOrUpdateEvent has 55 lines of code (exceeds 25 allowed). Consider refactoring.
Open

let createOrUpdateEvent = (payload, event, sender, github) => {
  return new Promise(function (resolve, reject) {
    log.debug('createOrUpdateEvent()');

    let commit = {
Severity: Major
Found in lib/events.js - About 2 hrs to fix

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

let getMilestones = (repo, eventId, github) => {
  return new Promise(function (resolve, reject) {
    log.debug('getMilestone()');
    github.issues.getAllMilestones({
      user: config.github.org,
Severity: Minor
Found in lib/milestone.js - About 1 hr to fix
Severity
Category
Status
Source
Language