cozy-labs/cozy-desktop

View on GitHub
core/app.js

Summary

Maintainability
C
1 day
Test Coverage

File app.js has 306 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/** Entry point of the synchronization core.
 *
 * @module core/app
 * @flow
 */
Severity: Minor
Found in core/app.js - About 3 hrs to fix

    Function setup has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      async setup() {
        const clientInfo = this.clientInfo()
        log.info(clientInfo, 'user config')
    
        if (!this.config.isValid()) {
    Severity: Minor
    Found in core/app.js - About 1 hr to fix

      Function sendMailToSupport has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async sendMailToSupport(content /*: string */) {
          const incidentID = uuid()
          const zipper = createGzip({
            // TODO tweak this values, low resources for now.
            memLevel: 7,
      Severity: Minor
      Found in core/app.js - About 1 hr to fix

        Function setup has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          async setup() {
            const clientInfo = this.clientInfo()
            log.info(clientInfo, 'user config')
        
            if (!this.config.isValid()) {
        Severity: Minor
        Found in core/app.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 addRemote has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          async addRemote(
            cozyUrl /*: string */,
            syncPath /*: string */,
            deviceName /*: string */
          ) {
        Severity: Minor
        Found in core/app.js - About 1 hr to fix

          Function uploadFileToSupport has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async uploadFileToSupport(
              incident /*: string */,
              name /*: string */,
              data /*: string|stream.Readable */
            ) {
          Severity: Minor
          Found in core/app.js - About 1 hr to fix

            Function addRemote has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              async addRemote(
                cozyUrl /*: string */,
                syncPath /*: string */,
                deviceName /*: string */
              ) {
            Severity: Minor
            Found in core/app.js - About 45 mins 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 removeRemote has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

              async removeRemote() {
                try {
                  if (!this.remote) this.instanciate()
            
                  try {
            Severity: Minor
            Found in core/app.js - About 25 mins 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

            There are no issues that match your filters.

            Category
            Status