4minitz/4minitz

View on GitHub
imports/collections/users_private.js

Summary

Maintainability
C
7 hrs
Test Coverage

Function users.editProfile has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    'users.editProfile'(userId, eMail, longName) {
        check(eMail, String);
        check(longName, String);
        if (! Meteor.userId()) {
            throw new Meteor.Error('Cannot edit profile', 'User not logged in.');
Severity: Minor
Found in imports/collections/users_private.js - About 2 hrs 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

Function users.editProfile has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    'users.editProfile'(userId, eMail, longName) {
        check(eMail, String);
        check(longName, String);
        if (! Meteor.userId()) {
            throw new Meteor.Error('Cannot edit profile', 'User not logged in.');
Severity: Minor
Found in imports/collections/users_private.js - About 1 hr to fix

    Function users.admin.registerUser has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        'users.admin.registerUser'(username, longname, email, password1, password2, sendMail, sendPassword) {
            console.log('users.admin.registerUser for user: '+username);
            // #Security: Only logged in admin may invoke this method: users.admin.registerUser
            if (! Meteor.userId()) {
                throw new Meteor.Error('Cannot register user', 'User not logged in.');
    Severity: Minor
    Found in imports/collections/users_private.js - About 1 hr to fix

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

          'users.admin.changePassword'(userId, password1, password2) {
              if (Meteor.isServer) {
                  // #Security: Only logged in admin may invoke this method: users.admin.changePassword
                  console.log('users.admin.changePassword for user: '+Meteor.userId());
                  if (! Meteor.userId()) {
      Severity: Minor
      Found in imports/collections/users_private.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

      Function users.admin.registerUser has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          'users.admin.registerUser'(username, longname, email, password1, password2, sendMail, sendPassword) {
      Severity: Major
      Found in imports/collections/users_private.js - About 50 mins to fix

        Function users.admin.registerUser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            'users.admin.registerUser'(username, longname, email, password1, password2, sendMail, sendPassword) {
                console.log('users.admin.registerUser for user: '+username);
                // #Security: Only logged in admin may invoke this method: users.admin.registerUser
                if (! Meteor.userId()) {
                    throw new Meteor.Error('Cannot register user', 'User not logged in.');
        Severity: Minor
        Found in imports/collections/users_private.js - About 25 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

        Function users.admin.ToggleInactiveUser has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            'users.admin.ToggleInactiveUser'(userId) {
                console.log('users.admin.ToggleInactiveUser for '+userId);
                // #Security: Only logged in admin may invoke this method: users.admin.ToggleInactiveUser
                if (! Meteor.user().isAdmin) {
                    throw new Meteor.Error('Cannot toggle inactive user', 'You are not admin.');
        Severity: Minor
        Found in imports/collections/users_private.js - About 25 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

        There are no issues that match your filters.

        Category
        Status