Showing 415 of 610 total issues
Function syncBatch
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
async syncBatch() /*: Promise<void> */ {
let change /*: Change */ = {}
while (!this.lifecycle.willStop()) {
await this.lifecycle.ready()
Pouch
has 39 functions (exceeds 20 allowed). Consider refactoring. Open
class Pouch {
/*::
config: Config
db: PouchDB
updater: any
File analysis.js
has 381 lines of code (exceeds 250 allowed). Consider refactoring. Open
/** Turn messy low-level events into normalized high-level ones.
*
* ## Input
*
* The analysis receives
Function updateFileAsync
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
async updateFileAsync(side /*: SideName */, doc /*: Metadata */) {
log.debug({ path: doc.path }, 'updateFileAsync')
const file /*: ?SavedMetadata */ = await this.pouch.bySyncedPath(doc.path)
if (!file) {
Function moveFolderRecursivelyAsync
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
async moveFolderRecursivelyAsync(
side /*: SideName */,
folder /*: Metadata */,
was /*: SavedMetadata */,
newRemoteRevs /*: ?RemoteRevisionsByID */
- 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 compareChanges
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
const compareChanges = (
{ operation: opA, doc: docA } /*: Change */,
{ operation: opB, doc: docB } /*: Change */
) => {
// Operations on different sides don't have dependencies for now. This will
- 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
RemoteCozy
has 37 functions (exceeds 20 allowed). Consider refactoring. Open
class RemoteCozy {
/*::
config: Config
url: string
client: OldCozyClient
Function addFile
has 120 lines of code (exceeds 25 allowed). Consider refactoring. Open
addFile(
doc /*: SavedMetadata */,
onProgress /*: ?ProgressCallback */,
callback /*: Callback */
) /*: void */ {
Function ipcEvents
has 119 lines of code (exceeds 25 allowed). Consider refactoring. Open
ipcEvents() {
return {
confirm: async (
event /*: ElectronEvent */,
{
File index.js
has 353 lines of code (exceeds 250 allowed). Consider refactoring. Open
/** The remote side read/write interface.
*
* @module core/remote
* @flow
*/
Function apply
has 111 lines of code (exceeds 25 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')
File migrations.js
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @module core/migrations/migrations
* @flow
*/
Function moveFolderAsync
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
async moveFolderAsync(
side /*: SideName */,
doc /*: Metadata */,
was /*: SavedMetadata */,
newRemoteRevs /*: ?RemoteRevisionsByID */
- 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 runActions
has 100 lines of code (exceeds 25 allowed). Consider refactoring. Open
const runActions = (scenario /*: * */, cozy /*: * */) => {
debug('[actions]')
return Promise.each(scenario.actions, async action => {
const now = new Date().toISOString()
File errors.js
has 325 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* @module core/remote/errors
* @flow
*/
Config
has 30 functions (exceeds 20 allowed). Consider refactoring. Open
class Config {
/*::
configPath: string
dbPath: string
fileConfig: FileConfig
Function defaultSorter
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
const defaultSorter = (a /*: LocalChange */, b /*: LocalChange */) => {
if (a.wip && !b.wip) return aFirst
if (b.wip && !a.wip) return bFirst
// b is deleting something which is a children of what a adds
- 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 updateState
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
const updateState = async ({ newState, data }) => {
const { status, filename, userAlerts, errors } = data || {}
if (newState === 'sync-state') {
if (status === 'uptodate') tray.setStatus('online')
- 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 identifyExistingDocChange
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
identifyExistingDocChange(
remoteDoc /*: CouchDBDoc|FullRemoteFile|RemoteDir */,
was /*: ?SavedMetadata */,
previousChanges /*: Array<RemoteChange> */,
originalMoves /*: Array<RemoteDirMove|RemoteDescendantChange> */,
Function applyDoc
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
async applyDoc(
doc /*: SavedMetadata */,
side /*: Writer */
) /*: Promise<*> */ {
if (doc.incompatibilities && side.name === 'local') {