hons82/node-git-lfs

View on GitHub
lib/routes/batch.js

Summary

Maintainability
A
3 hrs
Test Coverage

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

module.exports = function(app) {
    app.post('/:user/:repo/objects/batch', wrap(function* (req, res, next) {
        // validate request body according to JSON Schema
        try {
            var body = yield parse.json(req);
Severity: Major
Found in lib/routes/batch.js - About 2 hrs to fix

    Avoid too many return statements within this function.
    Open

                            return res.status(403).end();
    Severity: Major
    Found in lib/routes/batch.js - About 30 mins to fix

      This generator function does not have 'yield'.
      Open

      var handleUploadObject = function* (user, repo, object) {
      Severity: Minor
      Found in lib/routes/batch.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

      This generator function does not have 'yield'.
      Open

      var handleVerifyObject = function* (user, repo, object) {
      Severity: Minor
      Found in lib/routes/batch.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

      Unexpected lexical declaration in case block.
      Open

                      case 'upload':
      Severity: Minor
      Found in lib/routes/batch.js by eslint

      Disallow lexical declarations in case/default clauses (no-case-declarations)

      This rule disallows lexical declarations (let, const, function and class) in case/default clauses. The reason is that the lexical declaration is visible in the entire switch block but it only gets initialized when it is assigned, which will only happen if the case where it is defined is reached.

      To ensure that the lexical declaration only applies to the current case clause wrap your clauses in blocks.

      Rule Details

      This rule aims to prevent access to uninitialized lexical bindings as well as accessing hoisted functions across case clauses.

      Examples of incorrect code for this rule:

      /*eslint no-case-declarations: "error"*/
      /*eslint-env es6*/
      
      switch (foo) {
          case 1:
              let x = 1;
              break;
          case 2:
              const y = 2;
              break;
          case 3:
              function f() {}
              break;
          default:
              class C {}
      }

      Examples of correct code for this rule:

      /*eslint no-case-declarations: "error"*/
      /*eslint-env es6*/
      
      // Declarations outside switch-statements are valid
      const a = 0;
      
      switch (foo) {
          // The following case clauses are wrapped into blocks using brackets
          case 1: {
              let x = 1;
              break;
          }
          case 2: {
              const y = 2;
              break;
          }
          case 3: {
              function f() {}
              break;
          }
          case 4:
              // Declarations using var without brackets are valid due to function-scope hoisting
              var z = 4;
              break;
          default: {
              class C {}
          }
      }

      When Not To Use It

      If you depend on fall through behavior and want access to bindings introduced in the case block.

      Related Rules

      There are no issues that match your filters.

      Category
      Status