Showing 55 of 190 total issues
Function findDeepInObjImpl
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function findDeepInObjImpl(obj, fn, result = []) {
if (typeof obj === 'object' && obj != null) {
for (const key of Object.keys(obj)) {
if (fn(key)) {
result.push([key, obj[key]])
- 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
Avoid deeply nested control flow statements. Open
if (new Date(comment.created_at) > dbPR.last_push) {
frozenComments.push(frozenComment)
}
Function getCommentStatsForConfig
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async getCommentStatsForConfig(repository, comments, config, token) {
const that = this
async function checkComment(stats, comment) {
let matchesTotal = false
- 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 handleExistingPullRequests
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async handleExistingPullRequests(dbRepo, checkType, {config, token}) {
const PR_TYPES = [
Approval.TYPE,
Specification.TYPE,
PullRequestMilestone.TYPE,
- 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 getEffectiveConfiguration
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function getEffectiveConfiguration(userConfig, repository, defaultConfig, ignorePaths, applyConfigIfOwnedBy) {
Function reduce
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function reduce(aggregator, index, array, resolve, reject) {
Function countApprovalsAndVetos
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async countApprovalsAndVetos(repository, pull_request, comments, config, token) {
const ignore = await this.fetchIgnoredUsers(repository, pull_request, config, token)
const approvalPattern = config.pattern
const vetoPattern = _.get(config, 'veto.pattern')
- 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 generateProblemMiddleware
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function generateProblemMiddleware({exposableErrorTypes}) {
return async function problemMiddleware(ctx, next) {
try {
await next()
} catch (e) {
- 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 check
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function check(state = {
error: false,
isUpdating: false,
isEnabled: false
}, action) {
- 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 getIn
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function getIn(obj, path, returnDefault = null) {
if (!obj || typeof path === 'undefined') {
return returnDefault
}
if (!Array.isArray(path)) {
- 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 generatePrometheusMiddleware
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function generatePrometheusMiddleware(router, opts = {}) {
const ROUTES = router.stack.map(({regexp, path}) => ({regexp, path}))
/**
- 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 fetchIgnoredUsers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async fetchIgnoredUsers(repository, pull_request, config, token) {
if (!config.ignore || config.ignore === 'none') {
return []
}
const ignoreConfig = config.ignore
- 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 updateWebhookFor
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
async updateWebhookFor(user, repo, events, accessToken) {
debug(`${user}/${repo}: updating webhook with events: ${events.join(", ")}`)
let path = API_URL_TEMPLATES.HOOK.replace('${owner}', user).replace('${repo}', repo)
const HOOK_URL = nconf.get('HOOK_URL')
let hook_url = HOOK_URL ? HOOK_URL : nconf.get('HOST_ADDR') + '/api/hook'
- 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 setIn
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function setIn(obj, path, value) {
if (!Array.isArray(path)) {
path = [path]
}
const [head, ...tail] = path
- 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 validation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function validation(state = {
status: UNKNOWN,
config: null,
message: ''
}, action) {
- 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"