wbyoung/admit-one

View on GitHub

Showing 10 of 10 total issues

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

module.exports = function(adapter, middleware, opts) {
  var users = adapter.users;

  /**
   * User creation middleware.
Severity: Minor
Found in lib/middleware/create.js - About 1 hr to fix

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

    module.exports = function(adapter/*, middleware, opts*/) {
      var users = adapter.users;
    
      /**
       * Middleware for invalidating session
    Severity: Minor
    Found in lib/middleware/invalidate.js - About 1 hr to fix

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

      module.exports = function(adapter, middleware, opts) {
        var users = adapter.users;
        var attrs = adapter.attrs;
      
        /**
      Severity: Minor
      Found in lib/middleware/extract.js - About 1 hr to fix

        Identical blocks of code found in 4 locations. Consider refactoring.
        Open

              Promise.resolve().then(function() {
                var auth = req.auth;
                if (!auth.token) { raise(401, 'invalid credentials', '(token)'); }
                if (!auth.user) { raise(401, 'invalid credentials', '(user lookup)'); }
              })
        Severity: Major
        Found in lib/middleware/authorize.js and 3 other locations - About 55 mins to fix
        lib/middleware/authenticate.js on lines 36..52
        lib/middleware/create.js on lines 31..55
        lib/middleware/invalidate.js on lines 30..53

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 54.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 4 locations. Consider refactoring.
        Open

            Promise.resolve()
            .bind({})
            .then(extractParams(req, opts.params.create, 'username', 'password'))
            .then(findUser(adapter, opts))
            .tap(raise.verify.not.defined(422, 'username taken'))
        Severity: Major
        Found in lib/middleware/create.js and 3 other locations - About 55 mins to fix
        lib/middleware/authenticate.js on lines 36..52
        lib/middleware/authorize.js on lines 36..45
        lib/middleware/invalidate.js on lines 30..53

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 54.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 4 locations. Consider refactoring.
        Open

            Promise.resolve()
            .bind({})
            .then(extractParams(req, opts.params.authenticate, 'username', 'password'))
            .then(findUser(adapter, opts))
            .tap(raise.verify.defined(401, 'invalid credentials', '(username)'))
        Severity: Major
        Found in lib/middleware/authenticate.js and 3 other locations - About 55 mins to fix
        lib/middleware/authorize.js on lines 36..45
        lib/middleware/create.js on lines 31..55
        lib/middleware/invalidate.js on lines 30..53

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 54.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 4 locations. Consider refactoring.
        Open

            Promise.resolve()
            .then(function() {
              if (!req.auth) { raise(401, 'not authorized', '(auth)'); }
              if (!req.auth.user) { raise(401, 'not authorized', '(auth[user])'); }
              if (!req.auth.db.user) { raise(401, 'not authorized', '(auth[db][user])'); }
        Severity: Major
        Found in lib/middleware/invalidate.js and 3 other locations - About 55 mins to fix
        lib/middleware/authenticate.js on lines 36..52
        lib/middleware/authorize.js on lines 36..45
        lib/middleware/create.js on lines 31..55

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 54.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

          opts.params.create.username = opts.params.create.username ||
            'user[' + opts.username + ']';
        Severity: Minor
        Found in lib/admit.js and 2 other locations - About 35 mins to fix
        lib/admit.js on lines 20..21
        lib/admit.js on lines 22..23

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

          opts.params.authenticate.username = opts.params.authenticate.username ||
            'session[' + opts.username + ']';
        Severity: Minor
        Found in lib/admit.js and 2 other locations - About 35 mins to fix
        lib/admit.js on lines 18..19
        lib/admit.js on lines 20..21

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

          opts.params.create.password = opts.params.create.password ||
            'user[' + opts.password + ']';
        Severity: Minor
        Found in lib/admit.js and 2 other locations - About 35 mins to fix
        lib/admit.js on lines 18..19
        lib/admit.js on lines 22..23

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Severity
        Category
        Status
        Source
        Language