Showing 415 of 610 total issues
Function buildAppMenu
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.buildAppMenu = app => {
const template = [
{
label: translate('AppMenu Edit'),
submenu: [
Function blockSyncFor
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
blockSyncFor(
cause
/*: {| err: RemoteError |} | {| err: SyncError, change: Change |} */
) {
log.debug(cause, 'blocking sync for error')
Function deleteFolderAsync
has a Cognitive Complexity of 24 (exceeds 5 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) {
- 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 app.js
has 306 lines of code (exceeds 250 allowed). Consider refactoring. Open
/** Entry point of the synchronization core.
*
* @module core/app
* @flow
*/
File tray.window.js
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* @flow */
const electron = require('electron')
const { dialog, shell } = electron
const path = require('path')
File index.js
has 305 lines of code (exceeds 250 allowed). Consider refactoring. Open
/** The Local side read/write interface.
*
* @module core/local
* @flow
*/
Function step
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
function step(
state /*: { incompletes: IncompleteItem[] } */,
opts /*: IncompleteFixerOptions */
) {
return async (events /*: ChannelBatch */) /*: Promise<ChannelBatch> */ => {
Function putFolderAsync
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
async putFolderAsync(side /*: SideName */, doc /*: Metadata */) {
log.debug({ path: doc.path }, 'putFolderAsync')
const folder /*: ?SavedMetadata */ = await this.pouch.bySyncedPath(doc.path)
if (!folder) {
Sync
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class Sync {
/*::
changes: any
events: EventEmitter
ignore: Ignore
Function runActions
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
const runActions = (scenario /*: * */, cozy /*: * */) => {
debug('[actions]')
return Promise.each(scenario.actions, async action => {
const now = new Date().toISOString()
- 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 squashMoves
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function squashMoves(changes /*: LocalChange[] */) {
log.trace('Squash moves...')
const stopMeasure = measureTime('LocalWatcher#squashMoves')
for (let i = 0; i < changes.length; i++) {
- 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 debounce
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
function debounce(waiting /*: WaitingItem[] */, events /*: ChannelEvent[] */) {
for (let i = 0; i < events.length; i++) {
const event = events[i]
if (event.incomplete) {
continue
- 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 create
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
create() {
this.log.debug('create')
const opts = {
indexPath: path.resolve(__dirname, '..', 'index.html'),
...this.windowOptions()
Function setup
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
function setup(clientInfos /*: ClientInfo */) {
if (CI || COZY_NO_SENTRY || isSentryConfigured) {
log.info(
{ COZY_NO_SENTRY, isSentryConfigured },
'skipping Sentry configuration'
Function analyseEvent
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
function analyseEvent(
e /*: LocalEvent */,
previousChanges /*: LocalChangeMap */
) /*: ?LocalChange|true */ {
const sameInodeChange = previousChanges.findByInode(getInode(e))
Function moveFileAsync
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
async moveFileAsync(
side /*: SideName */,
doc /*: Metadata */,
was /*: SavedMetadata */
) /*: Promise<*> */ {
Function createInitialTree
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
const createInitialTree = async function (
scenario /*: * */,
cozy /*: * */,
pouch /*: Pouch */
) {
- 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 a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
identifyExistingDocChange(
remoteDoc /*: CouchDBDoc|FullRemoteFile|RemoteDir */,
was /*: ?SavedMetadata */,
previousChanges /*: Array<RemoteChange> */,
originalMoves /*: Array<RemoteDirMove|RemoteDescendantChange> */,
- 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 emitStatus
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
emitStatus() {
const {
offline,
remaining,
buffering,
- 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 detectOperation
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
const detectOperation = async (
change /*: PouchDBFeedData */,
sync /*: Sync */
) /*: Promise<SyncOperation> */ => {
const outdatedSide = sync.selectSide(change)
- 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"