Showing 126 of 126 total issues
Function autoMerge
has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring. Open
public autoMerge (node: RSNode): RSNode {
if (node.remote) {
if (node.local) {
if (isFolder(node.path)) {
return this.autoMergeFolder(node);
- 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 equal
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
export const equal = (a: any, b: any, seen = []): boolean => {
let key;
if (typeof (a) !== typeof (b)) {
return 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
Sync
has 39 functions (exceeds 20 allowed). Consider refactoring. Open
class Sync {
// TODO remove when RS is defined, or if unnecessary
rs: { [propName: string]: any };
numThreads: number;
Function fetchDelta
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
fetchDelta (...args: undefined[]): Promise<undefined[]> {
// If fetchDelta was already called, and didn't finish, return the existing
// promise instead of calling Dropbox API again
if (this._fetchDeltaPromise) {
return this._fetchDeltaPromise;
- 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
RemoteStorage
has 33 functions (exceeds 20 allowed). Consider refactoring. Open
class RemoteStorage {
/**
* Pending get/put/delete calls
* @private
*/
Function corruptServerItemsMap
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
public corruptServerItemsMap (itemsMap, force02?: boolean): boolean {
if ((typeof(itemsMap) !== 'object') || (Array.isArray(itemsMap))) {
return true;
}
- 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 fetchDelta
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
fetchDelta (...args: undefined[]): Promise<undefined[]> {
// If fetchDelta was already called, and didn't finish, return the existing
// promise instead of calling Dropbox API again
if (this._fetchDeltaPromise) {
return this._fetchDeltaPromise;
Function _request
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
async _request (method: string, uri: string, token: string | false, headers: HeadersInit, body: XMLHttpRequestBodyInit, getEtag: boolean, fakeRevision?: string): Promise<RemoteResponse> {
if (this.isForbiddenRequestMethod(method, uri)) {
return Promise.reject(`Don't use ${method} on directories!`);
}
Function constructor
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
constructor (cfg?: object) {
// Initial configuration property settings.
// TODO use modern JS to merge object properties
if (typeof cfg === 'object') { extend(config, cfg); }
- 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 markChildren
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async markChildren (path, itemsMap, changedNodes: RSNodes, missingChildren): Promise<void> {
const paths = [];
const meta = {};
const recurse = {};
Function _getFolder
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
_getFolder (path: string) {
const revCache = this._revCache;
const processResponse = (resp) => {
let body;
- 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 _request
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
async _request (method: string, url: string, options, numAttempts = 1): Promise<any> {
if (this.isForbiddenRequestMethod(method, url)) {
throw `Don't use ${method} on directories!`;
}
- 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 getLatest
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
function getLatest (node: RSNode): any {
if (typeof (node) !== 'object' || typeof (node.path) !== 'string') {
return;
}
if (isFolder(node.path)) {
- 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 get
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
get (path: string, options: { ifNoneMatch?: string } = {}): Promise<RemoteResponse> {
if (! this.connected) { return Promise.reject("not connected (path: " + path + ")"); }
const savedRev = this._revCache.get(path);
if (savedRev === null) {
// file was deleted server side
Function _request
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
async _request (method: string, url: string, options, numAttempts = 1): Promise<any> {
if (this.isForbiddenRequestMethod(method, url)) {
throw `Don't use ${method} on directories!`;
}
Function finishTask
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
public finishTask (task: SyncTask, queueTask = true): void | Promise<void> {
if (task.action === undefined) {
delete this._running[task.path];
return;
}
Function put
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
async put (path: string, body: unknown, contentType: string): Promise<RSNodes> {
const paths = pathsFromRoot(path);
function _processNodes(nodePaths: string[], nodes: RSNodes): RSNodes {
try {
- 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 fetch
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
const fetch = async (cursor: string) => {
let url;
let requestBody;
if (typeof cursor === 'string') {
Function _fetchRequestWithTimeout
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function _fetchRequestWithTimeout(method: string, url: string, options: RequestOptions): Promise<XMLHttpRequest> {
const abortController = typeof AbortController === 'function' ?
new AbortController() :
null;
let timeoutId;
Function completeFetch
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
public async completeFetch (path: string, bodyOrItemsMap: object, contentType: string, revision: string): Promise<any> {
let paths: Array<string>;
let parentPath: string;
const pathsFromRootArr = pathsFromRoot(path);