Showing 146 of 349 total issues
Avoid deeply nested control flow statements. Open
} else if (auth === KinveyHttpAuth.All) {
try {
return await this.setAuthorization(KinveyHttpAuth.Session);
} catch (error) {
try {
Function init
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function init(config: Config) {
// Check that an appKey was provided
if (config.kinveyConfig.appKey === null || config.kinveyConfig.appKey === undefined) {
throw new KinveyError('No app key was provided to initialize the Kinvey JavaScript SDK.');
}
- 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 completeMFALoginRetryable
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function completeMFALoginRetryable(
mfaComplete: (authenticator: string, context: MFAContext) => Promise<MFACompleteResult>,
context: MFAContext,
maxRetriesCount: number
): Promise<any> {
- 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 send
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export async function send(request: any) {
const { url, method, headers, body, timeout } = request;
let response;
// Add kinvey device information headers
- 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
if (pushResult.error) {
count -= 1;
}
Avoid deeply nested control flow statements. Open
if (!mfaSessionToken) {
throw new KinveyError('Missing MFA session token to authorize the request.');
}
Function _loginWithMFA
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function _loginWithMFA(
username: string,
password: string,
selectAuthenticator: (authenticators: object[], context: MFAContext) => Promise<string>,
mfaComplete: (authenticator: string, context: MFAContext) => Promise<MFACompleteResult>,
- 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 send
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export async function send(request: any) {
const { url, method, headers, body, timeout } = request;
let response;
// Add kinvey device information headers
- 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
if (currentContent !== defaultInfoPlistFileContent) {
fs.writeFileSync(destinationInfoPlistFile, defaultInfoPlistFileContent);
}
Consider simplifying this complex logical expression. Open
} else if (name === 'EntityNotFound'
|| name === 'CollectionNotFound'
|| name === 'AppNotFound'
|| name === 'UserNotFound'
|| name === 'BlobNotFound'
Function loginWithMFA
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
username: string,
password: string,
selectAuthenticator: (authenticators: object[], context: MFAContext) => Promise<string>,
mfaComplete: (authenticator: string, context: MFAContext) => Promise<MFACompleteResult>,
options: LoginOptions = {}
Function _loginWithMFA
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
username: string,
password: string,
selectAuthenticator: (authenticators: object[], context: MFAContext) => Promise<string>,
mfaComplete: (authenticator: string, context: MFAContext) => Promise<MFACompleteResult>,
options: LoginOptions = {}
Function loginWithMICUsingResourceOwnerCredentials
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export async function loginWithMICUsingResourceOwnerCredentials(username: string, password: string, options: MICOptions = {}) {
const activeUser = await getActiveUser();
const { micId } = options;
let clientId = getAppKey();
- 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 addFilter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
addFilter(field: string, ...args: any) {
if (!isString(field)) {
throw new QueryError('The field argument must be a string.');
}
- 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 group
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
group(aggregation: Aggregation, options: any = {}) {
const stream = Observable.create(async (observer: any) => {
try {
if (!(aggregation instanceof Aggregation)) {
throw new KinveyError('Invalid aggregation. It must be an instance of the Aggregation class.');
- 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 join
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private join(operator: string, queries: any) {
// Cast, validate, and parse arguments. If `queries` are supplied, obtain
// the `filter` for joining. The eventual return function will be the
// current query.
let result = new Query(this);
- 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 send
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export async function send(request: any) {
const { url, method, headers, body, timeout } = request;
let response;
// Add kinvey device information headers
- 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 addSyncEvent
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async addSyncEvent(event: SyncEvent, docs: any) {
const syncCache = new SyncCache(this.tag);
let singular = false;
let syncDocs: any = [];
let docsToSync = docs;
- 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 lookup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function lookup(query?: Query, options: LookupOptions = {}) {
const stream = Observable.create(async (observer: any) => {
try {
if (query && !(query instanceof Query)) {
throw new KinveyError('Invalid query. It must be an instance of the Query class.');
- 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 too many return
statements within this function. Open
return new BLError(message, debug);