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) {
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'),
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;
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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;
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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';
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
// -----------------------------------------------------------
- Read upRead up
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;
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;
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:
- Read upRead up
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 = [];
- Read upRead up
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);
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;
- Read upRead up
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);
},
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
UserAgreement.getCurrentEua()
.then(
(results) => {
res.status(200).json(results);
},
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function initialize
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
public initialize() {
this.messageService.initialize();
this.authentication.initializing$
.subscribe(() => {
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) {
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;
}