cozy-labs/cozy-desktop

View on GitHub

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()
Severity: Minor
Found in gui/main.js - About 1 hr to fix

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
Severity: Minor
Found in gui/js/network/agent.js - About 1 hr to fix

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
  )
Severity: Minor
Found in gui/main.js - About 1 hr to fix

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)
Severity: Minor
Found in core/sync/index.js - About 1 hr to fix

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()
Severity: Minor
Found in gui/main.js - About 1 hr to fix

    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
    Severity: Minor
    Found in core/utils/sentry.js - About 1 hr to fix

      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)
      Severity: Minor
      Found in core/sync/index.js - About 1 hr to fix

        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')
        Severity: Minor
        Found in core/local/chokidar/analysis.js - About 1 hr to fix

          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', {
          Severity: Minor
          Found in gui/js/network/index.js - About 1 hr to fix

            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)
            
            
            Severity: Minor
            Found in core/sync/index.js - About 1 hr to fix

              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[] } */ = {
              Severity: Minor
              Found in dev/remote/change-dir-exclusions.js - About 1 hr to fix

                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> */
                Severity: Minor
                Found in core/remote/watcher/squashMoves.js - About 1 hr to fix

                  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
                  Severity: Minor
                  Found in core/local/channel_watcher/add_infos.js - About 1 hr to fix

                    Function openNote has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    const openNote = async (
                      filePath /*: string */,
                      { desktop } /*: { desktop: App } */
                    ) => {
                      try {
                    Severity: Minor
                    Found in gui/utils/notes.js - About 1 hr to fix

                    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 */,
                            {
                    Severity: Minor
                    Found in gui/js/tray.window.js - About 1 hr to fix

                    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> */,
                    Severity: Minor
                    Found in core/remote/watcher/index.js - About 1 hr to fix

                    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
                    Severity: Minor
                    Found in core/local/channel_watcher/parcel_producer.js - About 1 hr to fix

                    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 () {
                    Severity: Minor
                    Found in dev/capture/local.js - About 1 hr to fix

                      Function detectNameIncompatibilities has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const detectNameIncompatibilities = (
                        name /*: string */,
                        type /*: 'file'|'folder' */,
                        platform /*: string */
                      ) /*: NameIncompatibility[] */ => {
                      Severity: Minor
                      Found in core/incompatibilities/platform.js - About 1 hr to fix

                        Function overwriteFileAsync has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          async overwriteFileAsync(
                            doc /*: SavedMetadata */,
                            onProgress /*: ?ProgressCallback */
                          ) /*: Promise<void> */ {
                            const { path } = doc
                        Severity: Minor
                        Found in core/remote/index.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language