Showing 146 of 349 total issues
Function push
has 205 lines of code (exceeds 25 allowed). Consider refactoring. Open
async push(providedQuery?: Query, options?: any) {
if (this.isPushInProgress()) {
throw new SyncError('Data is already being pushed to the backend. Please wait for it to complete before pushing new data to the backend.');
}
Function exports
has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function (hookArgs) {
return new Promise((resolve, reject) => {
const appDirectoryPath = ((hookArgs && hookArgs.checkForChangesOpts && hookArgs.checkForChangesOpts.projectData && hookArgs.checkForChangesOpts.projectData) || hookArgs.projectData).appDirectoryPath;
if (!appDirectoryPath) {
reject(new Error('Unable to get path to app directory'));
- 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
File query.ts
has 457 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { isString, isNumber, isPlainObject, isObject, isEmpty, isArray, cloneDeep, pick } from 'lodash-es';
import sift from 'sift';
import { QueryError } from './errors/query';
const UNSUPPORTED_CONDITIONS = ['$nearSphere'];
File cachestore.ts
has 435 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { isArray, times } from 'lodash-es';
import { Observable } from 'rxjs';
import { Query } from '../query';
import { KinveyError } from '../errors/kinvey';
import { MissingConfigurationError } from '../errors/missingConfiguration';
Function setAuthorization
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
async setAuthorization(auth: KinveyHttpAuth): Promise<void> {
const appKey = getAppKey();
const appSecret = getAppSecret();
const masterSecret = getMasterSecret();
const session = await getSession();
- 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 push
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
async push(providedQuery?: Query, options?: any) {
if (this.isPushInProgress()) {
throw new SyncError('Data is already being pushed to the backend. Please wait for it to complete before pushing new data to the backend.');
}
- 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 error
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
get error() {
if (!this.isSuccess()) {
if (isPlainObject(this.data)) {
const message = this.data.message || this.data.description;
const name = this.data.name || this.data.error;
- 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
Query
has 39 functions (exceeds 20 allowed). Consider refactoring. Open
export class Query {
private _parent?: Query;
public filter: any;
private _fields?: string[];
private _sort?: any;
Function _pullInternal
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
async _pullInternal(query: Query = new Query(), pullOptions: any = {}, options: { paginationCountsOnly?: boolean } = {}) : Promise<any[]|number> {
const network = new NetworkStore(this.collectionName);
const cache = new DataStoreCache(this.collectionName, this.tag);
const queryCache = new QueryCache(this.tag);
const useDeltaSet = pullOptions.useDeltaSet === true || this.useDeltaSet;
- 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
File networkstore.ts
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { isArray, cloneDeep } from 'lodash-es';
import { Observable } from 'rxjs';
import { getDeviceId } from '../device';
import { Aggregation } from '../aggregation';
import { Query } from '../query';
Function execute
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
async execute(retry = true): Promise<HttpResponse> {
if (this.auth) {
await this.headers.setAuthorization(this.auth);
}
- 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
File sync.ts
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { Query } from '../query';
import { SyncError } from '../errors/sync';
import { NotFoundError } from '../errors/notFound';
import { NetworkStore } from './networkstore';
import { DataStoreCache, SyncCache, SyncEvent } from './cache';
Function error
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
get error() {
if (!this.isSuccess()) {
if (isPlainObject(this.data)) {
const message = this.data.message || this.data.description;
const name = this.data.name || this.data.error;
Function _pullInternal
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
async _pullInternal(query: Query = new Query(), pullOptions: any = {}, options: { paginationCountsOnly?: boolean } = {}) : Promise<any[]|number> {
const network = new NetworkStore(this.collectionName);
const cache = new DataStoreCache(this.collectionName, this.tag);
const queryCache = new QueryCache(this.tag);
const useDeltaSet = pullOptions.useDeltaSet === true || this.useDeltaSet;
CacheStore
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
export class CacheStore {
public collectionName: string;
public tag?: string;
public useDeltaSet: boolean;
public useAutoPagination: boolean;
User
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
export class User {
public data: UserData;
constructor(data: UserData = {}) {
this.data = data;
Function execute
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
function execute(dbName: string, tableName: string, sqlQueries: any, write = false): Promise<any> {
const escapedTableName = `"${tableName}"`;
const isMaster = tableName === MASTER_TABLE_NAME;
return new Promise((resolve, reject) => {
File user.ts
has 276 lines of code (exceeds 250 allowed). Consider refactoring. Open
import { isArray } from 'lodash-es';
import { Acl } from '../acl';
import { Kmd } from '../kmd';
import { getDeviceId } from '../device';
import {
Function open
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
async open(url = '/', options: PopupOptions = {}) {
if (this._open !== true) {
const activity = Application.android.startActivity || Application.android.foregroundActivity;
let shouldClose = false;
let success = false;
- 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 setAuthorization
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
async setAuthorization(auth: KinveyHttpAuth): Promise<void> {
const appKey = getAppKey();
const appSecret = getAppSecret();
const masterSecret = getMasterSecret();
const session = await getSession();