Showing 101 of 230 total issues
Function format
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static format(value: string | number | Moment, format?: string): string {
if (null != value) {
let momentDate;
if (moment.isMoment(value)) {
momentDate = value;
- 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 searchTest
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.searchTest = function(req, res) {
let query = req.body.q || {};
let search = req.body.s;
if (search) {
- 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 toTimestamp
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
static toTimestamp(value: string | number): number {
if (null != value) {
// If it's a number, assume it's a timestamp
if (_.isNumber(value)) {
return value;
- 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 search
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports.search = function(schema, query, searchTerms, limit, offset, sortArr, runCount) {
Function stream
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports.stream = function(schema, query, searchTerms, limit, offset, sortArr, lean) {
Function getQuery
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private getQuery(): any {
let query: any;
let elements: any[] = [];
if (this.filters.bypassAC) {
- 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 audit
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports.audit = function(message, eventType, eventAction, eventActor, eventObject, eventMetadata) {
Function getGlobbedPaths
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
let getGlobbedPaths = (globPatterns, excludes) => {
// URL paths regex
let urlRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
// The output array
- 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 containsQuery
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
CacheEntrySchema.statics.containsQuery = function(queryTerms, fields, search, limit, offset, sortArr) {
Function search
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports.search = function(query, queryParams, user) {
if (!user || !user._id) {
return q.reject('Notification Service: user._id must be defined');
}
- 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 itemsRaw
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
set itemsRaw(newValue: string) {
if (newValue) {
let split = new RegExp(this.delimiter, 'g');
this._items = _.map(newValue.match(split), (val: string) => {
if (
- 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 transform
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
transform(n: number): string {
let scale: any = this.getScale(n);
let postfix: string = '';
let fraction: number = n;
let fractionSize: number;
- 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 containsQuery
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
UserSchema.statics.containsQuery = function(queryTerms, fields, search, limit, offset, sortArr) {
Function requiresExternalRoles
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports.requiresExternalRoles = (req) => {
let promise;
// If there are required roles, check for them
if(req.user.bypassAccessCheck === false && null != config.auth && _.isArray(config.auth.requiredRoles) && config.auth.requiredRoles.length > 0) {
- 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
Avoid deeply nested control flow statements. Open
for (let partition in offsets[topic]) {
offsets[topic][partition] = Math.min.apply(null, offsets[topic][partition]);
logger.info(`Kafka Consumer: Connected to topic ${topic}, partition: ${partition}, offset: ${offsets[topic][partition]}`);
}
Avoid deeply nested control flow statements. Open
for (let i in excludes) {
file = file.replace(excludes[i], '');
}
Consider simplifying this complex logical expression. Open
if (
(val.charAt(0) === '"' || val.charAt(0) === '\'' || val.charAt(0) === '“') &&
(val.charAt(val.length - 1) === '"' || val.charAt(val.length - 1) === '\'' || val.charAt(val.length - 1) === '”')) {
val = val.substring(1, val.length - 1);
Function updateMemberRole
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function updateMemberRole(user, team, role, requester, headers) {
Function exportCSV
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.exportCSV = function(req, res, filename, columns, data) {
Function search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
CacheEntrySchema.statics.search = function(queryTerms, searchTerms, limit, offset, sortArr) {