Asymmetrik/mean2-starter

View on GitHub

Showing 230 of 230 total issues

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

module.exports = function() {

    passport.use(new ProxyPkiStrategy({
        header: 'x-ssl-client-s-dn'
    }, function(req, dn, done) {
Severity: Major
Found in src/server/lib/strategies/proxy-pki.js - About 2 hrs to fix

    Function reset has 68 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.reset = (req, res, next) => {
    
        // Init Variables
        let password = req.body.password;
    
    

      Function forgot has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.forgot = (req, res, next) => {
      
          // Make sure there is a username
          if(null == req.body.username) {
              return res.status(400).json({ message: 'Username is missing.' });

        File teams.server.service.js has 266 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        'use strict';
        
        let
            path = require('path'),
            q = require('q'),
        Severity: Minor
        Found in src/server/app/teams/services/teams.server.service.js - About 2 hrs to fix

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

          TagSchema.statics.createCopy = function(tag) {
              let toReturn = {};
          
              toReturn.name = tag.name;
              toReturn.description = tag.description;
          Severity: Major
          Found in src/server/app/teams/models/tags.server.model.js and 1 other location - About 2 hrs to fix
          src/server/app/teams/models/team.server.model.js on lines 94..102

          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 81.

          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 2 locations. Consider refactoring.
          Open

          TeamSchema.statics.createCopy = function(team) {
              let toReturn = {};
          
              toReturn.name = team.name;
              toReturn.description = team.description;
          Severity: Major
          Found in src/server/app/teams/models/team.server.model.js and 1 other location - About 2 hrs to fix
          src/server/app/teams/models/tags.server.model.js on lines 72..80

          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 81.

          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

          File admin-list-users.component.ts has 262 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import { Component, ViewChild } from '@angular/core';
          import { Response } from '@angular/http';
          import { ActivatedRoute, Params } from '@angular/router';
          
          import * as _ from 'lodash';
          Severity: Minor
          Found in src/client/app/admin/user-management/admin-list-users.component.ts - About 2 hrs to fix

            Function checkAdminAccess has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                protected checkAdminAccess(url: string, route: ActivatedRouteSnapshot): boolean {
                    if (!this.userStateService.user.isAdmin()) {
                        // -----------------------------------------------------------
                        // Check the role requirements for the route
                        // -----------------------------------------------------------
            Severity: Minor
            Found in src/client/app/core/auth-guard.service.ts - 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 searchTeams has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function searchTeams(search, query, queryParams, user) {
                    let page = util.getPage(queryParams);
                    let limit = util.getLimit(queryParams, 1000);
            
                    let offset = page * limit;
            Severity: Minor
            Found in src/server/app/teams/services/teams.server.service.js - About 1 hr to fix

              Function searchTags has 49 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function searchTags(search, query, queryParams, user) {
                      let page = util.getPage(queryParams);
                      let limit = util.getLimit(queryParams);
              
                      let offset = page * limit;
              Severity: Minor
              Found in src/server/app/teams/services/tags.server.service.js - About 1 hr to fix

                Function handleErrorResponse has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    protected handleErrorResponse(err: any, _caught: Observable<any>): Observable<any> {
                        let errData = _.isString(err._body) ? JSON.parse(err._body) : err._body;
                        switch (err.status) {
                            case 401:
                
                
                Severity: Minor
                Found in src/client/app/shared/asy-http.service.ts - About 1 hr 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 toMongoose has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                function toMongoose(obj) {
                    if (null != obj) {
                        if (typeof obj === 'object') {
                            if (Array.isArray(obj)) {
                                var arr = [];
                Severity: Minor
                Found in src/server/app/util/services/util.server.service.js - About 1 hr 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 searchResources has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function searchResources(query, queryParams, user) {
                        let page = util.getPage(queryParams);
                        let limit = util.getLimit(queryParams, 1000);
                
                
                
                Severity: Minor
                Found in src/server/app/resources/services/resources.server.service.js - About 1 hr to fix

                  Function updateCurrentUser has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  exports.updateCurrentUser = (req, res) => {
                  
                      // Make sure the user is logged in
                      if (null == req.user){
                          res.status(400).json({

                    Function getErrorMessage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                    Open

                    module.exports.getErrorMessage = function(err) {
                        var message = '';
                    
                        if (null == err || typeof err === 'string') {
                            message = err;
                    Severity: Minor
                    Found in src/server/app/core/controllers/errors.server.controller.js - About 1 hr 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

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

                        eua.save()
                            .then(
                                (results) => {
                                    res.status(200).json(results);
                                },
                    src/server/app/admin/controllers/users/eua.server.controller.js on lines 143..151

                    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 69.

                    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 2 locations. Consider refactoring.
                    Open

                        UserAgreement.getCurrentEua()
                            .then(
                                (results) => {
                                    res.status(200).json(results);
                                },
                    src/server/app/admin/controllers/users/eua.server.controller.js on lines 77..85

                    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 69.

                    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

                    Function initialize has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public initialize() {
                            this.messageService.initialize();
                    
                            this.authentication.initializing$
                                .subscribe(() => {
                    Severity: Minor
                    Found in src/client/app/messages/message-handler.service.ts - About 1 hr to fix

                      Function searchTest has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      exports.searchTest = function(req, res) {
                          let query = req.body.q || {};
                          let search = req.body.s;
                      
                          if (search) {
                      Severity: Minor
                      Found in src/server/app/messages/controllers/message.server.controller.js - About 1 hr to fix

                        Function updateRole has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            updateRole(member: TeamMember, role: string) {
                                // No update required
                                if (member.role === role) {
                                    return;
                                }
                        Severity: Minor
                        Found in src/client/app/teams/list-team-members.component.ts - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language