Showing 146 of 349 total issues
Function batchCreateEntities
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
const batchCreateEntities = async (): Promise<any> => {
const localIdsToRemove = [];
const entitiesForInsert = await Promise.all(
syncDocsForInsert.map(async (doc, index) => {
const entity = await cache.findById(doc.entityId);
Function removeById
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async removeById(id: string, options: any = {}) {
const autoSync = options.autoSync === true || this.autoSync;
const cache = new DataStoreCache(this.collectionName, this.tag);
const sync = new Sync(this.collectionName, this.tag);
let count = 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
Function process
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
process(docs: object[] = []) {
const queryPlainObject = this.toPlainObject();
if (!Array.isArray(docs)) {
throw new Error('data argument must be of type: Array.');
UserService
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable({
providedIn: 'root'
})
export class UserService {
constructor(@Inject(KinveyConfigToken) config: any) {
User
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
export class User extends KinveyUser {
static exists(username: string, options?: ExistsOptions) {
return exists(username, options);
}
UserService
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
@Injectable({
providedIn: 'root'
})
export class UserService {
constructor(@Inject(KinveyConfigToken) config: any) {
Function open
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
open(objectStoreName: string, write = false, success: any, error: any, force = false) {
try {
if (this.db) {
if (this.db.objectStoreNames.contains(objectStoreName)) {
const mode = write ? IndexedDBTransactionMode.readWrite : IndexedDBTransactionMode.readOnly;
- 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 process
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
process(docs: object[] = []) {
const queryPlainObject = this.toPlainObject();
if (!Array.isArray(docs)) {
throw new Error('data argument must be of type: 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 open
has 56 lines of code (exceeds 25 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;
Function execute
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
function execute(dbName, tableName, sqlQueries, write = false) {
const escapedTableName = `"${tableName}"`;
const isMaster = tableName === MASTER_TABLE_NAME;
return new SQLite(dbName)
Function findById
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
findById(id: string, options: any = {}) {
const stream = Observable.create(async (observer: any) => {
try {
// if (!id) {
// throw new Error('No id was provided. A valid id is required.');
- 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 open
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
open(url = '/') {
if (this._open !== true) {
const webViewIntercept = (webview: any, error: any, url: string): boolean => {
let urlStr = '';
- 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 _refreshMICSession
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
async _refreshMICSession(micSession) {
const kinveyMICIdentityKey = 'kinveyAuth';
try {
// Refresh the MIC session
File indexeddb.ts
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
const DB_CACHE: any = {};
const IndexedDBTransactionMode = {
readWrite: 'readwrite',
readOnly: 'readonly',
Function exports
has 50 lines of code (exceeds 25 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'));
Function open
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
open(objectStoreName: string, write = false, success: any, error: any, force = false) {
try {
if (this.db) {
if (this.db.objectStoreNames.contains(objectStoreName)) {
const mode = write ? IndexedDBTransactionMode.readWrite : IndexedDBTransactionMode.readOnly;
Function create
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
async create(docs: any, options: any = {}) {
const batchSize = 100;
const apiVersion = getApiVersion();
if (isArray(docs)) {
Function _loginWithMFA
has 42 lines of code (exceeds 25 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>,
Consider simplifying this complex logical expression. Open
if (!appDirectoryPath) {
reject(new Error('Unable to get path to app directory'));
} else {
const platform = (((hookArgs && hookArgs.checkForChangesOpts) || hookArgs.prepareData).platform || '').toLowerCase();
const pathToPackageJson = path.join(appDirectoryPath, 'package.json');
Function execute
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
async execute(retry = true): Promise<HttpResponse> {
if (this.auth) {
await this.headers.setAuthorization(this.auth);
}