Planifica/encryption

View on GitHub

Showing 7 of 7 total issues

File EncryptionUtils.js has 415 lines of code (exceeds 250 allowed). Consider refactoring.
Open

var CONFIG_PAT = {
    enforceEmailVerification: Match.Optional(Boolean),
    onGeneratedKeypair: Match.Optional(Function)
};

Severity: Minor
Found in EncryptionUtils.js - About 5 hrs to fix

    `` has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    EncryptionUtils = {
        /**
         * standard options
         */
        options: {
    Severity: Minor
    Found in EncryptionUtils.js - About 3 hrs to fix

      Function encryptDocWithId has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          encryptDocWithId: function (doc, fields, name, documentKey) {
              var self = this,
                  // client only so this works :)
                  user = Meteor.user(),
                  newDoc = {},
      Severity: Major
      Found in EncryptionUtils.js - About 2 hrs to fix

        Function extendProfile has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            extendProfile: function (password) {
                var self = this;
                var userId = Meteor.userId();
                // generate keypair
                var keyPair = nacl.box.keyPair();
        Severity: Minor
        Found in EncryptionUtils.js - About 1 hr to fix

          Function onSignIn has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              onSignIn: function (password) {
                  var self = this,
                      user = Meteor.user();
          
                  if (self.options.enforceEmailVerification === true && user.emails[
          Severity: Minor
          Found in EncryptionUtils.js - About 1 hr to fix

            Function shareDocWithUser has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                shareDocWithUser: function (docId, docType, userId) {
                    var self = this,
                        asymNonce = self.generate24ByteNonce();
            
                    // find principal of user to share post with
            Severity: Minor
            Found in EncryptionUtils.js - About 1 hr to fix

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

                  encryptDocWithId: function (doc, fields, name, documentKey) {
                      var self = this,
                          // client only so this works :)
                          user = Meteor.user(),
                          newDoc = {},
              Severity: Minor
              Found in EncryptionUtils.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

              Severity
              Category
              Status
              Source
              Language