Showing 415 of 610 total issues
Function setupDesktop
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const setupDesktop = async () => {
try {
// TODO: allow setting desktop up without running migrations (when opening
// a cozy-note)?
await desktop.setup()
- 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 connect
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
async connect(
req /*: http.ClientRequest */,
opts /*: AgentConnectOpts */
) /*: Promise<http.Agent> */ {
const { secureEndpoint } = opts
- 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 showWindow
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
const showWindow = async bounds => {
if (
notificationsState.revokedAlertShown ||
notificationsState.syncDirUnlinkedShown
)
- 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 trashWithParentOrByItself
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
async trashWithParentOrByItself(
doc /*: SavedMetadata */,
side /*: Writer */
) /*: Promise<void> */ {
const parentPath = dirname(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 setupDesktop
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
const setupDesktop = async () => {
try {
// TODO: allow setting desktop up without running migrations (when opening
// a cozy-note)?
await desktop.setup()
Function handleBunyanMessage
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
const handleBunyanMessage = msg => {
const level =
msg.level >= bunyan.FATAL
? 'fatal'
: msg.level >= bunyan.ERROR
Function detectOperation
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
const detectOperation = async (
change /*: PouchDBFeedData */,
sync /*: Sync */
) /*: Promise<SyncOperation> */ => {
const outdatedSide = sync.selectSide(change)
Function analyseEvents
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
function analyseEvents(
events /*: LocalEvent[] */,
pendingChanges /*: LocalChange[] */
) /*: LocalChange[] */ {
const stopMeasure = measureTime('LocalWatcher#analyseEvents')
Function networkConfig
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
const networkConfig = (argv /*: Array<*> */ = process.argv) => {
const networkConfig = yargs
.env('COZY_DRIVE')
.conflicts('proxy-script', 'proxy-rules')
.option('proxy-script', {
Function apply
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
async apply(change /*: Change */) /*: Promise<void> */ {
let stopMeasure = () => {}
try {
this.events.emit('sync-current', change.seq)
Function getDirectoryContent
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function getDirectoryContent(context) {
const { client } = context
const dir = { _id: ROOT_DIR_ID, path: '/', name: '/' }
const dirContent = { [dir.name]: {} }
let resp /*: { next: boolean, bookmark?: string, data: Object[] } */ = {
Function squashMoves
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
const squashMoves = (
doc /*: Metadata */,
was /*: SavedMetadata */,
previousChanges /*: RemoteChange[] */,
encounteredMoves /*: Array<RemoteDirMove|RemoteDescendantChange> */
Function loop
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function loop(
channel /*: Channel */,
opts /*: { config: Config, pouch: Pouch, fatal: Error => any } */
) /*: Channel */ {
const syncPath = opts.config.syncPath
Function openNote
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
const openNote = async (
filePath /*: string */,
{ desktop } /*: { desktop: App } */
) => {
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 ipcEvents
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
ipcEvents() {
return {
confirm: async (
event /*: ElectronEvent */,
{
- 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 identifyChange
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
identifyChange(
remoteDoc /*: CouchDBDoc|CouchDBDeletion|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 buildEvent
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
async buildEvent(
event /*: ParcelEvent */,
{ fromScan = false } /*: { fromScan: boolean } */
) /*: Promise<?ChannelEvent> */ {
// Completely skip events for Desktop's temporary files
- 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 runAndRecordChokidarEvents
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const runAndRecordChokidarEvents = scenario => {
return new Promise((resolve, reject) => {
const watcher = chokidar.watch('.', chokidarOptions)
const cleanCallback = cb =>
function () {
Function detectNameIncompatibilities
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const detectNameIncompatibilities = (
name /*: string */,
type /*: 'file'|'folder' */,
platform /*: string */
) /*: NameIncompatibility[] */ => {
Function overwriteFileAsync
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
async overwriteFileAsync(
doc /*: SavedMetadata */,
onProgress /*: ?ProgressCallback */
) /*: Promise<void> */ {
const { path } = doc