Showing 230 of 230 total issues
Identical blocks of code found in 2 locations. Consider refactoring. Open
updateUser(dn, copyACGroups(copyACRoles(copyACMetadata({}, acUser), acUser), acUser)).then(function(updatedUser) {
// Audit user signup
return auditService.audit('user updated from access checker', 'user', 'update',
User.auditCopy(localUser),
User.auditCopy(updatedUser)).then(function() {
- 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 61.
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 3 locations. Consider refactoring. Open
router.route('/admin/user/:userId')
.get( users.hasAdminAccess, users.adminGetUser)
.post( users.hasAdminAccess, users.adminUpdateUser)
.delete(users.hasAdminAccess, users.adminDeleteUser);
- 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 61.
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 3 locations. Consider refactoring. Open
router.route('/eua/:euaId')
.get( users.hasAdminAccess, users.getEuaById)
.post( users.hasAdminAccess, users.updateEua)
.delete(users.hasAdminAccess, users.deleteEua);
- 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 61.
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 3 locations. Consider refactoring. Open
router.route('/admin/message/:msgId')
.get( users.hasAccess, messages.read)
.post( users.hasAdminAccess, messages.update)
.delete(users.hasAdminAccess, messages.delete);
- 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 61.
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 ngOnInit
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
ngOnInit() {
this.alertService.clearAllAlerts();
this.user = this.authService.getCurrentUser();
Function search
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.search = function(req, res) {
let search = req.body.s || null;
let query = req.body.q || {};
query = util.toMongoose(query);
Function adminGetFeedbackCSV
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.adminGetFeedbackCSV = function(req, res) {
let exportFileName;
const exportId = req.params.exportId;
const dateCallback = (value) => (value) ? new Date(value).toISOString(): '';
Function sendMail
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
const sendMail = (mailOptions) => {
return new Promise((resolve, reject) => {
const postData = JSON.stringify(transformMailOptions(mailOptions));
const options = generateOptions();
Function getQuery
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
private getQuery(): any {
let query: any;
let elements: any[] = [];
if (this.filters.bypassAC) {
Function signupEmail
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.signupEmail = function(user, req) {
let defer = q.defer();
req.app.render('../../admin/templates/user-signup-alert-email', {
name: user.name,
Function audit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.audit = function(message, eventType, eventAction, eventActor, eventObject, eventMetadata) {
let Audit = dbs.admin.model('Audit');
let utilService = deps.utilService;
// Extract additional metadata to audit
Function exports
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(app, db) {
// Create a new HTTP server
logger.info('Creating HTTP Server');
var server = http.createServer(app);
Function searchTeamMembers
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
function searchTeamMembers(search, query, queryParams, team) {
let page = util.getPage(queryParams);
let limit = util.getLimit(queryParams);
let offset = page * limit;
Function verify
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.verify = function(role) {
return function(req, res, next) {
// Grab the Authentication header
var authentication = req.headers.authentication;
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (_.isArray(src.tags)) {
toReturn.tags = src.tags.map((t) => _.pick(t, ['_id']));
}
- 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 57.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if (_.isArray(src.tags)) {
toReturn.tags = src.tags.map((t) => _.pick(t, ['_id']));
}
- 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 57.
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 getValidationErrors
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function getValidationErrors(err) {
var errors = [];
if(null != err.errors) {
for (var field in err.errors) {
- 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 verify
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports.verify = function(role) {
return function(req, res, next) {
// Grab the Authentication header
var authentication = req.headers.authentication;
- 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 getGlobbedPaths
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
let getGlobbedPaths = (globPatterns, excludes) => {
// URL paths regex
let urlRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
// The output array
Function get
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.get = function (id) {
var defer = q.defer();
if(null == id) {
return q.reject('id cannot be null or undefined');