Showing 415 of 610 total issues
Function emit
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
emit(name /*: string */, ...args /*: any[] */) /*: boolean */ {
switch (name) {
case 'online':
this.update({ offline: false })
break
Function onRegisterRemote
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
async onRegisterRemote(
event /*: ElectronEvent */,
arg /*: { cozyUrl: string, location: string } */
) {
const syncSession = session.fromPartition(SESSION_PARTITION_NAME)
Function start
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
start() {
log.debug('Starting...')
this.resetInitialScanParams()
Remote
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class Remote /*:: implements Reader, Writer */ {
/*::
name: SideName
other: Reader & Writer
config: Config
Function apply
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
async apply(
change /*: RemoteChange */
) /*: Promise<?{ change: RemoteChange, err: Error }> */ {
const docType = _.get(change, 'doc.docType')
const path = _.get(change, 'doc.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 setupProxy
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
const setupProxy = async (
electronApp /*: App */,
networkConfig /*: Object */,
session /*: Session */
) => {
Function moveFolderAsync
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
async moveFolderAsync(
side /*: SideName */,
doc /*: Metadata */,
was /*: SavedMetadata */,
newRemoteRevs /*: ?RemoteRevisionsByID */
Function constructor
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(...opts /*: { app: ElectronApp, desktop: CoreApp } */) {
super(...opts)
autoUpdater.logger = log
autoUpdater.autoDownload = false
Function moveFolderRecursivelyAsync
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
async moveFolderRecursivelyAsync(
side /*: SideName */,
folder /*: Metadata */,
was /*: SavedMetadata */,
newRemoteRevs /*: ?RemoteRevisionsByID */
Function createInitialTree
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
const createInitialTree = async function (
scenario /*: * */,
cozy /*: * */,
pouch /*: Pouch */
) {
Function putFolderRecursivelyAsync
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async putFolderRecursivelyAsync(
side /*: SideName */,
folder /*: Metadata */,
was /*: SavedMetadata */
) {
- 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 initialScanSorter
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
const initialScanSorter = (a /*: LocalChange */, b /*: LocalChange */) => {
if (a.wip && !b.wip) return aFirst
if (b.wip && !a.wip) return bFirst
if (localChange.isChildAdd(a, b)) return aFirst
- 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 trashFileAsync
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async trashFileAsync(
side /*: SideName */,
trashed /*: SavedMetadata */,
doc /*: Metadata */
) /*: Promise<void> */ {
- 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 analyseEvents
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function analyseEvents(
events /*: LocalEvent[] */,
pendingChanges /*: LocalChange[] */
) /*: LocalChange[] */ {
const stopMeasure = measureTime('LocalWatcher#analyseEvents')
- 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 deleteFolderAsync
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
async deleteFolderAsync(side /*: SideName */, doc /*: SavedMetadata */) {
log.debug({ path: doc.path }, 'deleteFolderAsync')
const folder /*: ?SavedMetadata */ = await this.pouch.byIdMaybe(doc._id)
if (!folder) {
RemoteWatcher
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class RemoteWatcher {
/*::
config: Config
pouch: Pouch
prep: Prep
Consider simplifying this complex logical expression. Open
if (attributes.type === DIR_TYPE) {
return {
...attributes,
dir_id: attributes.dir_id || '',
name: attributes.name || '',
Function _withDomainErrors
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
async _withDomainErrors /*:: <T: FullRemoteFile|RemoteDir> */(
data /*: Readable */,
options /*: Object */,
fn /*: () => Promise<T> */
) /*: Promise<T> */ {
Function default
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.default = async function (configuration) {
const { execSync } = require('child_process')
const whoami = 'customSign.js'
Function getNextChanges
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
async getNextChanges(seq /*: number */) /*: Promise<Change[]> */ {
const stopMeasure = measureTime('Sync#getNextChanges')
const opts = {
...this.baseChangeOptions(seq),
include_docs: true,