HR/CryptoSync

View on GitHub

Showing 598 of 598 total issues

Function decrypt has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

exports.decrypt = function (origpath, destpath, key, iv, authTag, callback) {
  // encrypts any arbitrary data passed with the pass
  // const pass = (Array.isArray(key)) ? shares2pass(key) : key
  if (!authTag || !iv) {
    // extract from last line of file
Severity: Minor
Found in src/crypto.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 main has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.main = function () {
  // Decrypt db (the Vault) and get ready for use
  // open mdb
  logger.verbose(`PROMISE: Main initialisation`)
  return new Promise(function (resolve, reject) {
Severity: Minor
Found in init.js - About 1 hr to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      const JSONstream = origin.on('error', function (e) {
        callback(e)
      }).pipe(decipher).on('error', function (e) {
        callback(e)
      })
    Severity: Major
    Found in src/crypto.js and 2 other locations - About 55 mins to fix
    src/crypto.js on lines 107..112
    src/crypto.js on lines 210..214

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 53.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

      origin.on('error', function (e) {
        callback(e)
      })
      .pipe(cipher).on('error', function (e) {
        callback(e)
    Severity: Major
    Found in src/crypto.js and 2 other locations - About 55 mins to fix
    src/crypto.js on lines 134..138
    src/crypto.js on lines 210..214

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 53.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        fd.on('error', function (e) {
          reject(e)
        }).pipe(hash).on('error', function (e) {
          reject(e)
        })
    Severity: Major
    Found in src/crypto.js and 2 other locations - About 55 mins to fix
    src/crypto.js on lines 107..112
    src/crypto.js on lines 134..138

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 53.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    gulp.task('run', function () {
      return gulp.src('*', {
        read: false
      })
        .pipe(shell([
    Severity: Minor
    Found in gulpfile.js and 1 other location - About 50 mins to fix
    gulpfile.js on lines 67..75

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 51.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    gulp.task('lint', function () {
      return gulp.src('*', {
        read: false
      })
        .pipe(shell([
    Severity: Minor
    Found in gulpfile.js and 1 other location - About 50 mins to fix
    gulpfile.js on lines 57..65

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 51.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function decrypt has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    exports.decrypt = function (origpath, destpath, key, iv, authTag, callback) {
    Severity: Minor
    Found in src/crypto.js - About 45 mins to fix

      Function Account has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      function Account (type, name, email, profileImg, quota, oauth) {
      Severity: Minor
      Found in src/Account.js - About 45 mins to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            const hash = crypto.createHash(defaults.hash_alg).update(`${pass}${salt}`).digest('hex')
        Severity: Minor
        Found in src/crypto.js and 1 other location - About 45 mins to fix
        src/crypto.js on lines 188..188

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 50.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            const hash = crypto.createHash(defaults.hash_alg).update(`${pass}${salt}`).digest('hex')
        Severity: Minor
        Found in src/crypto.js and 1 other location - About 45 mins to fix
        src/crypto.js on lines 183..183

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 50.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function decryptObj has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        exports.decryptObj = function (origpath, mpkey, viv, vtag, callback) {
        Severity: Minor
        Found in src/crypto.js - About 35 mins to fix

          Function encryptObj has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          exports.encryptObj = function (obj, destpath, mpkey, viv, callback) {
          Severity: Minor
          Found in src/crypto.js - About 35 mins to fix

            Function pushCryptQueue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.pushCryptQueue = function (file) {
              logger.verbose(`PROMISE: pushCryptQueue for ${file.name}`)
              return new Promise(function (resolve, reject) {
                exports.cryptQueue.push(file, function (err, file) {
                  if (err) {
            Severity: Minor
            Found in src/sync.js - About 35 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 Prompt has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.Prompt = function (reset = false) {
              return new Promise(function (resolve, reject) {
                Main.MasterPassPrompt(reset, function (err, gotMP) {
                  if (err) reject(err)
                  if (gotMP) {
            Severity: Minor
            Found in src/MasterPass.js - About 35 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

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

              if (dotRegex.test(path)) {
                // Ignore dot file
                logger.info(`IGNORE added file ${path}, stats.mtime = ${stats.mtime}`)
                watcher.unwatch(path)
              } else {
            Severity: Minor
            Found in src/watch.js and 1 other location - About 30 mins to fix
            src/watch.js on lines 48..56

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                if (dotRegex.test(path)) {
                  // Ignore dot file
                  logger.info(`IGNORE added file ${path}, stats ${stats.mtime}`)
                  watcher.unwatch(path)
                } else {
            Severity: Minor
            Found in src/watch.js and 1 other location - About 30 mins to fix
            src/watch.js on lines 16..43

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Function init has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.init = function () {
              return new Promise(function (resolve, reject) {
                // Set drain (callback) handlers
                exports.initDrains()
            
            
            Severity: Minor
            Found in src/synker.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

            Function MasterPassKey has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            const MasterPassKey = (function () {
              const mpk = new WeakMap()
            
              function MasterPassKey (key) {
                mpk.set(this, key)
            Severity: Minor
            Found in src/_MasterPassKey.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

            Function decrypt has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            exports.decrypt = function (mpkey) {
              return new Promise(function (resolve, reject) {
                if (!mpkey) reject(new Error('No MasterPassKey passed'))
                crypto.decryptObj(global.paths.vault, mpkey, global.creds.viv, global.creds.authTag, function (err, vault) {
                  if (err) {
            Severity: Minor
            Found in src/vault.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

            Severity
            Category
            Status
            Source
            Language