hons82/node-git-lfs

View on GitHub
lib/routes/objects.js

Summary

Maintainability
A
55 mins
Test Coverage

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

var checkJWT = function(action) {
    return wrap(function*(req, res, next) {
        let user = req.params.user;
        let repo = req.params.repo;
        let oid = req.params.oid;
Severity: Minor
Found in lib/routes/objects.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

This generator function does not have 'yield'.
Open

    return wrap(function*(req, res, next) {
Severity: Minor
Found in lib/routes/objects.js by eslint

Disallow generator functions that do not have yield (require-yield)

Rule Details

This rule generates warnings for generator functions that do not have the yield keyword.

Examples

Examples of incorrect code for this rule:

/*eslint require-yield: "error"*/
/*eslint-env es6*/

function* foo() {
  return 10;
}

Examples of correct code for this rule:

/*eslint require-yield: "error"*/
/*eslint-env es6*/

function* foo() {
  yield 5;
  return 10;
}

function foo() {
  return 10;
}

// This rule does not warn on empty generator functions.
function* foo() { }

When Not To Use It

If you don't want to notify generator functions that have no yield expression, then it's safe to disable this rule.

Related Rules

There are no issues that match your filters.

Category
Status