Showing 35 of 102 total issues
Function formatMessageFromData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const formatMessageFromData = function(data) {
// Build a list of verification statuses (core or custom) to be selected
// Get the current status (label and color)
- 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 executeMutation
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
const executeMutation = function(mutationQuery, vars, fail, done, token, callback, event, data) {
Function process
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const process = function(data, callback, context) {
if (data.token === VERIFICATION_TOKEN) {
getCheckSlackUser(data.user.id,
function(err) {
- 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 updateTitleOrDescription
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
const updateTitleOrDescription = function(attribute, event, data, token, callback, done) {
Function createProjectMedia
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
const createProjectMedia = function(team_id, responseUrl, vars, token, data, callback) {
Function getProject
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
const getProject = function(teamSlug, projectId, token, done, fail, callback) {
Function sendErrorMessage
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
const sendErrorMessage = function(e, vars, text, team_id, responseUrl, callback) {
Function saveAndReply
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
const saveAndReply = function(data, token, callback, mode, newMessage, attachments) {
Function getIdentifier
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const getIdentifier = function(text) {
let identifier = null;
// The identifier is different depending on the platform
if (/WhatsApp Messenger/.test(text)) {
identifier = text.match(/Phone Number:\s(.*)/)[1];
- 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 fail
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
const fail = function(callback, thread, channel, link, e) {
Function setSmoochUserSlackChannelUrl
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
const setSmoochUserSlackChannelUrl = function(event, data, token, callback, done) {
Function getProjectMedia
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
const getProjectMedia = function(teamSlug, projectId, projectMediaId, callback, done) {
Function createComment
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
const createComment = function(event, data, token, callback, done) {
Function saveToRedisAndReplyToSlack
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
const saveToRedisAndReplyToSlack = function(redisKey, value, message, done, callback) {
Function handler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.handler = function(event, context, callback) {
const body = config.awsRegion === 'local' ? event.body : qs.parse(decodeURIComponent(event.body));
const teamConfig = getTeamConfig(body.team_id);
if (body.token === teamConfig.verificationToken) {
if (/^bot /.test(body.text) || body.text === '') {
- 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"